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

  • What I would recommend is that you write known values to RTT, and see what is present in the file afterwards.

    For instance sending several values like, val=0x11223344 and val=0x12345678, and see what is present in the stored file on the PC afterwards.

     

    Kind regards,

    Håkon

  • yah thanks Alseth,now I able to convert raw data to wav file but converting to integers and logging leads to data loss.I was not able to solve that.

  • Are you certain that it is the logging function that is corrupting/missing data, and not the I2S DMA process that is overwriting the buffers before you're copying them or in the middle of that sequence? Or creating a minimalistic example with little / no other functions, just sampling of a microphone?

    DMA can be a bit of a struggle to debug, especially if there is a timing skew (caused by ISRs or other threads) in the copy sequence.

     

    Instead of processing each sample individually, then RTT print, could you try to copy it into a larger buffer, then print the whole buffer?

    static void copyBuffer(int32_t *Buff_In,int16_t *Buff_Out,uint16_t number_of_samples)
    {
    	int16_t print_buf[sizeof(MAX_SIZE)];
    	for(int i = 0; .....) { /*copy int and shift -> int16_t */ }
    	my_print_func(print_buf, number_of_samples*sizeof(int16_t));
    }

      

    Kind regards,

    Håkon

Related