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

Printf is not working but app_uart_put does

Hi there,

I was using app_uart_put to print out data from a nRF52, but now I need use printf to use AT commands more easily(more readable) instead the working around app_uart_put.

I found this post https://devzone.nordicsemi.com/f/nordic-q-a/18483/sdk-12-app_uart_put-is-working-but-printf-does-not a guy with a similar issue and he solved it enablig RETARGET_ENABLED 1 on sdk_config.h I did the same with no luck

what I have done:

added the header #include <stdio.h> on my file

included retarget.c to my project

enabled RETARGET_ENABLED 1 on sdk_config.h

 printf("\r\ test: \r\n");    // <--- not working on my end

 

details: 

SDK14

GCC compiler

##UPDATE 

I solved it removing ##UPDATE NRF_LOG_USES_RTT =1 from processor definitions. is it still safe?

Parents Reply
  • Hello, if you are using the SDK instead of NCS, you can go to sdk_config.h and edit it to enable peripherals and some features.
    For example for the nRF52DK you can go ble_peripheral\ble_app_uart\pca10040\s132\config\sdk_config.h and set RETARGET_ENABLED 1, NRF_LOG_USES_RTT =1, enabling the UART peripheral and should work for printing on UART using printf, alternatively you can enable NRF_LOG to use NRF_LOG_xxx which is better from my point of view than using printf

Children
No Data
Related