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 Children
  • static void copyBuffer(int32_t *Buff_In,int16_t *Buff_Out,uint16_t number_of_samples)
    {
    for(int i = 0; i < number_of_samples; ++i)
    {
    Buff_Out[i]= Buff_In[i]>>16;
    printk("%d\n",Buff_Out[i]);
    }
    }.I am using this logic each data of 32 bit is shifted to 16 bit and it prints,I am logging continuous data coming from i2s_buf_read function of buffer 244.
  • 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

  • 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?

Related