Data Logging

Hi,I am using NRF5340 ,I want to log data of 2 channels of mic with sampling rate of 16000 but while logging I am receiving "120 messages dropped" and with some random numbers if I change configurations.

CONFIG_I2S=y
CONFIG_I2C=y

CONFIG_LOG_PRINTK=y

CONFIG_UART_CONSOLE=n
CONFIG_RTT_CONSOLE=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG=y
CONFIG_LOG_MEM_UTILIZATION=y

CONFIG_LOG_MODE_OVERFLOW=n
CONFIG_SEGGER_RTT_BUFFER_SIZE_UP=65536
CONFIG_LOG_BUFFER_SIZE=65536

CONFIG_LOG_PROCESS_THREAD_STACK_SIZE=2048

Parents Reply
  • Hi,

     

    Each 244*1/16kHz, equals around 15.25 ms interval for each time this function is called.

    I fear that the high CPU utilization is the root cause of the print issue, causing the logger thread to be blocked for larger periods of time.

    Does this issue happen "after a while" ? Meaning that from boot, you're able to read out for some period of time before it starts to print "dropped messages" in the log?

    You can setup blocking printing, but this will then block other functions from executing.

    You could try running the CPU at 128 MHz for debugging purposes:

    https://github.com/nrfconnect/sdk-nrf/blob/main/samples/wifi/shell/src/main.c#L54-L55

     

    If that does not work, then the only option is to optimize functions around, to ensure that the logger thread has the time to execute the prints.

     

    Kind regards,

    Håkon

Children
  • Does this issue happen "after a while" ? Meaning that from boot, you're able to read out for some period of time before it starts to print "dropped messages" in the log?

    Yes,if I took buffer of 244, 16 messages are dropping and it repeats as same for next buffer of 244  again 16 messages are dropping.I attatched logging file where in each lineit print left and right mic data.

    data.log

  • Hi,

     

    Did you try to run the CPU at 128 MHz to see if this is a cpu constraint?

     

    Kind regards,

    Håkon

  • Yes,I set to 128 MHZ ,I cant see any messages dropped error .But when I am logging data and converting to audio file ,i can see some data is missing.I have played numbers which says at each second in mic ,I can see 11 numbers played in 9 seconds itself.Will this can be solved any issue in logging speed clocks?can we increase that clocks?

  • Hi,

     

    It does sound like you are missing data, especially on '14' and possibly on '7'.

    Have you considered using usb as the loopback instance instead?

     

    Also, if you use an external debugger (JLink Base compact for instance), you can increase the SWD speed, for more throughput on the actual reads from the JLink debugger itself.

     

    Kind regards,

    Håkon

  • Have you considered using usb as the loopback instance instead?

    what does it refer?

    Also, if you use an external debugger (JLink Base compact for instance), you can increase the SWD speed, for more throughput on the actual reads from the JLink debugger itself

    I am using same jlink  base compact at max speed even though i am getting same audio mismatch.Audio is not missing at end it's missing between the data.If it's sampling at 16000 ,how data logging is missing in between,it should go one by one?I am not sure how data log works.I am using SEGGER_RTT_PRINTF.I thought to use SEGGER_RTT_WRITE ,I am getting data like(

    ù
    ûù
    Æù
    ºù
    ¾ù
    4ù) but converting it to wave getting only noise.
    static void copyBuffer(int32_t *Buff_In,int16_t *Buff_Out,uint16_t number_of_samples)
    {
    	int i=0;
    	
    	for( i = 0; i < number_of_samples; i++) 
    	{
    		Buff_Out[i]= (Buff_In[i]>>16);
    		
    		// printk("%hx %hx\n",bellMicData,ancMicData);
    		 SEGGER_RTT_printf(0,"%d\n",Buff_Out[i]);
     		// SEGGER_RTT_Write(0,(const void*) &Buff_Out[i], 2);
    	}
    	// SEGGER_RTT_Write(0,&newline,1); 
     }
    while rearding one mic i didnt got issue,on logging two only i am getting issue
Related