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

NRF_LOG_INFO issues when formatting strings

Hi, I'm using nRF52840PDK and SDK 14.2.0. I started from the SAADC example and tried to use NRF_LOG_INFO to print some strings through the UART. I have this:

char test[5] = "test";
char data[8] = "data";

...

NRF_LOG_INFO("%c*%X*%X*%s*%s", test[0], test[0], test, test, data);

And the output in the UART is:

<info> app: t*74*2003FF14*DU*Y1Z

The first 3 values are ok because the first character is 't', which hex code is 0x74 and is stored at 0x2003FF14 in memory, but when I try to print the whole string, those weird characters appears. This also happened when I tried to form a string using sprintf and using it in NRF_LOG_INFO.

Parents Reply Children
Related