Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Scheduler + UART. Function getting optimized out?

Hey All,

I'm using the nrf_drv_uart UARTE driver (NRF52832) communicating with an external device. The UART init code is executed using a function (call all_main in this instance) that is called by the scheduler to update the state of the app, initialize and de-init peripherals etc. I get to the point of initializing the UART in my code, compile, run it I get logs and it responds to reset requests (using jlinkexe). But, if I add a write and then a read the program compiles, the bootloader boots but the app does not launch. When using GDB in this state, it doesn't stop at the breakpoint at main. I don't see any GPIOs changing state.

So my fears are that the SD is asserting for some reason or that the particular function I'm calling is getting optimized out. 

I'm going to look into it more but I figure I would post my issue here to see if anyone else has had something similar.

Thanks

Jared

  • The log buffer is typically processed in the main loop if you have deferred logging enabled:

    // Enter main loop.
    for (;;)
    {
          if (NRF_LOG_PROCESS() == false)
         {
                power_manage();
          }
    }

    Is it possible that the changes you made caused the process function to be called more often, or reduced the amount of log messages? Wondering if this issue could be attributed to buffer overrun. You could try to increase the log buffer size in sdk_config to see if that helps. 

    Buffer configuration:

    NRF_LOG_MSGPOOL_ELEMENT_SIZE

    NRF_LOG_MSGPOOL_ELEMENT_COUNT

Related