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

How to fix UART behavior in segger?

Still playing with my app. Since RTT (or whatever it was, when printf was printing info to segger debug console) was ruining the debug process, I just switched off RTT and disabled uart module. But now I need some way to print out some debug info. So, I connected an rx pin of my usb-serial interface to pin9 of 51822. However, printf still prints out to segger debug console, not to my usb-uart, and probably still causing crashes when run not in debug mode. Is there a way to check what could be wrong?

  • please share more information about the SDK version you use. What did you do to disable RTT ? I would suggest you to play with our example in the SDK to make sure you can switch between UART and RTT logging.

  • It's nRF5_SDK_11.0.0_89a8197. To disable RTT, I did righ-click on my project in the project tree, then Edit Options (for some reason it's different than when I do Project-Edit Options from the main menu). Debug-Debugger, RTT Enabled - No. However, even without uart_config() and with RTT disabled, I still can see printf to segger console - how could that be? And that was your example - custom characteristic. It's not that I need UART - the task is completed, the project seems to be working just fine (though, I'll have to look at power consumption and to check if an attacker can drain the battery somehow). I just got curios, how to track that uart issue. It seems it keeps restarting on uart_config(); all I did I remapped the CTS pin first to pin0, then to pin7, no effect. By the way, what are the minimum pins needed for uart (i connected just tx pin and ground to my uart->usb converter) could it be that what I see in segger debug console is actually the nrf_logs or something different? I just commented out the include app_uart and uart_config(), and it still recompiles and displays printf - weird.

  • It's just the configuration on Segger embedded Studio, it wouldn't affect the code of the application. If you want to disable RTT log you need to edit the sdk_config.h.

    There is a GUI tool to edit sdk_config, please have a look at this tutorial. NRF_LOG_BACKEND_SERIAL_USES_RTT should be disabled and NRF_LOG_BACKEND_SERIAL_USES_UART should be enabled if you want to send the log via UART.

    To turn off LOGing you change NRF_LOG_ENABLED to 0.

  • That's really nice video! Thank you! Now I see what debug messages are, and what I get in debug console there is definitely not nrf log messages. Speaking of what's suggested in that video, I can't find any sdk-config.h files or any occurances of such but for in /components/libraries/mem_manager/mem_manager.c and /components/libraries/mem_manager/mem_manager.h and in email messages. Moreover, I don't have that 'open in a wizard' menu on my macos version of segger.

    Now I tried using the same aproach to debug what causes it restart, and got the following result: in debug mode, even without uart_config(), I can see printf messages in segger debug console, everything works fine, it doesn't reach the breakpoint in app_error file. When in normal run, it works okay even with uart_config, but when I do printf - it hangs.

    There are several build configurations in segger - could it be caused by some mess there? I have public/private, with common and internal in private, and there are some differences between them.

  • Which example are you testing with ? Could you simply test with any example in the SDK ? ble_app_uart for example.

    Which SDK your application based on ?

    Have you try a full search in your project for NRF_LOG_BACKEND_SERIAL_USES_RTT ?

Related