This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF_LOG_RAW_INFO prints older logs even after reset

1. NRF52840 with devkit PCA10056 
2. SDK 16
3. Segger studio 4.40
4. No RTOS, Softdevice disabled

Issue faced: NRF_Log doesn;t print something like NRF_LOG_RAW_INFO("\nNectar skyy started with accel LIS2DH12"); in it's entirety  and many a times, it prints prints previous prints.. If I reset the board, instead of printing the first welcome print , it prints logs from previous execution and keeps repeating that in subsequent resets as well.. It almost looks like buffer is never cleared or  queue never gets updated.

I have an application that

1. intializes two GPIOs as interrupts from an external device (accel)
2. uses SPI to talk to accel
3. Uses NRF log to print into a serial port 
4. GPIO, SPI and UART interrupt priorities are same.

Config is as follows:

#define NRF_LOG_ENABLED 1
#define NRF_LOG_MSGPOOL_ELEMENT_SIZE 20
#define NRF_LOG_MSGPOOL_ELEMENT_COUNT 8
#define NRF_LOG_ALLOW_OVERFLOW 1
#define NRF_LOG_BUFSIZE 128 (I have played with it by increasing the size with no success)
#define NRF_LOG_DEFAULT_LEVEL 3
#define NRF_LOG_DEFERRED 0 (I tried enabling this and using NRF_LOG_PROCESS until it returns 0, NRF_FINAL_FLUSH and NRF_LOG_FLUSH with no success)
#define NRF_LOG_FILTERS_ENABLED 0
#define NRF_LOG_NON_DEFFERED_CRITICAL_REGION_ENABLED 0 (tried 1 with no success)
#define NRF_LOG_USES_TIMESTAMP 0
#define NRF_FPRINTF_ENABLED 1
#define NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED 1  (tried 0 as well with no success)
#define NRF_LOG_BACKEND_RTT_ENABLED 0
#define NRF_LOG_BACKEND_UART_ENABLED 1
#define NRF_LOG_BACKEND_UART_TX_PIN 6
#define NRF_LOG_BACKEND_UART_BAUDRATE 30801920 //115200 baud)
#define NRF_LOG_BACKEND_UART_TEMP_BUFFER_SIZE 512 (have  increased and decreased it with no success)
DID NOT change push buffer config since I do not use NRF_LOG_PUSH


System starts - enables NRF_LOG, gpio, interrupts, spi and initializes accel.  Prints a welcome message and goes to main loop. and  in main loop, we process any events (interrupt handlers set a bool that is checked by main loop - standard stuff). We do access the accel via spi for status checking etc (and device can move at the time triggering an interrupt). I DO NOT use NRF_LOG from any handlers.. only in main loop and in functions called by main loop.

What am I missing ? is interrupt priority an issue ? I don't see any errors, crashes to look at., Prints older log for whatever reason .. it's almost like log is at elast one print behind where it should be.

Any help will be greatly appreciated

Parents
  • Hi,

    I don’t see this issue with the project you uploaded when I test it here. I always get this printed when I press the reset button:

    adc init
    
    ADC channel 0
    
    Max adc period 5
    
    Max adc samples 1000
    
    ADC gain 3
    
    ADC acquisition time 0
    
    ADC mode 0
    
    Nectar skyy started with accel LIS2DH12
    
    Nectar skyy started
    
    Nectar GPIO interrupt enabled
     

    I tested with Termite. What software are you using to view the log?

Reply
  • Hi,

    I don’t see this issue with the project you uploaded when I test it here. I always get this printed when I press the reset button:

    adc init
    
    ADC channel 0
    
    Max adc period 5
    
    Max adc samples 1000
    
    ADC gain 3
    
    ADC acquisition time 0
    
    ADC mode 0
    
    Nectar skyy started with accel LIS2DH12
    
    Nectar skyy started
    
    Nectar GPIO interrupt enabled
     

    I tested with Termite. What software are you using to view the log?

Children
  • I tried multiple terminals.. and found that I need to configure how terminal software interprets the new line character.. for example, in Teraterm VT, i need to Setup->Terminal and configure New Line Recieve to be "Auto" (TX doesn't matter).. Cool Term does not even after doing this. 

    Looks like there is some issue there w.r.t "\r" vs "\r\n" vs "\n"..  I also played with NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED  but didn't help

    Not sure what might be happening.. 

Related