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

How to correctly use FreeRTOS and the NRF logger module

Hi,

When running FreeRTOS I'm not able to use the NRF logger module once the task scheduler has started.

I have a low priority task that flushes the logs but whenever the logger tries to perform a transfer it gets stuck on line 86 of nrf_log_backend_uart.c. From what I can see once the transmission ahs started m_xfer_done is never changed to true even though I can clearly see on the console that ti has received what is in the buffer. By using the debugger i can break out of this and this works but after a few logs performed like this it crashes with a hard fault.

What is the recommended method for logging within tasks when using FreeRTOS on a nordic semiconductor?

Thanks in advance

Parents
  • Hello,

    I think you should check out the SDK\examples\ble_peripheral\ble_app_hrs_freertos example. As you can see, it has a separate thread to handle the log processing. You need to keep the log processing to one thread only, and not have NRF_LOG_PROCESS() or NRF_LOG_FLUSH() running from anywhere else. The reason for this is that if you risk the log processing to be interrupted by another thread also processing logs, then the application will fail. It is not designed to do that. Perhaps that is what you are seeing?

    Best regards,

    Edvin

Reply
  • Hello,

    I think you should check out the SDK\examples\ble_peripheral\ble_app_hrs_freertos example. As you can see, it has a separate thread to handle the log processing. You need to keep the log processing to one thread only, and not have NRF_LOG_PROCESS() or NRF_LOG_FLUSH() running from anywhere else. The reason for this is that if you risk the log processing to be interrupted by another thread also processing logs, then the application will fail. It is not designed to do that. Perhaps that is what you are seeing?

    Best regards,

    Edvin

Children
No Data
Related