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

How to display floating point values with NRF_LOG_INFO?

Hi DevZone members,

I would like to output the elapsed seconds as a floating point value using NRF_LOG_INFO.  However, nothing is generated for the floating point value.

For example, I'd like to print the elapsed time when a timer callback occurs.  Here is a code snippet:

NRF_LOG_INFO("seconds = %f", (float)app_timer_cnt_get() / APP_TIMER_CLOCK_FREQ;

All I see in the Debug Log output is 

<info> app: seconds =

I also tried formatting the float into a string using snprintf(), but the resulting character buffer just had garbage in it.

What do I need to do to output a float value from NRF_LOG_INFO(), or to format a float value using sprintf or snprintf?

I am using the nRF52-DK, Segger Embedded Studio Release 4.12  Build 2018112601.37855 on Windows 10, and nRF SDK 15.2.0.

Many thanks for your help!

Scott

Parents Reply Children
No Data
Related