Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

NCS/9160: do I have to have uart0 as console?

I'm moving from NRF9160DK to a custom board, where it has no UART. I plan to just use RTT for debugging messages.

However, I found if I delete the section which defines uart0 in the nrf9160dk_nrf9160_common.dts file, I won't be able to see RTT output in the JLinkRTTViewer. Nor can I set the uart0 to "disabled", or comment out "chosen{ zephyr,console=&uart0}" at the top of the file. (I'm creating my own DTS file but so far it's just a copy of the nrf9160dk_nrf9160_common.dts)

In my prj.comf, I already has these:

CONFIG_LOG=y
CONFIG_LOG_MODE_MINIMAL=n
CONFIG_LOG_MODE_IMMEDIATE=n
CONFIG_LOG_MODE_DEFERRED=y
CONFIG_LOG_PROCESS_THREAD=y
CONFIG_LOG_BUFFER_SIZE=8192
CONFIG_LOG_FRONTEND=n
CONFIG_LOG_BACKEND_UART=n
# Segger RTT
CONFIG_USE_SEGGER_RTT=y
CONFIG_RTT_CONSOLE=y
CONFIG_UART_CONSOLE=n
CONFIG_LOG_BACKEND_RTT=y

It appears that setting the LOG_BACKENG to UART or RTT doesn't affect anything.

So currently I just set uart0 to use two spare pin as tx/rx so the project can compile. And I can see messages in the RTT viewer. I'm not sure what is wrong, or it has to be this way.

I'm using NCS 1.7.1.

Thanks for any help!

Parents
  • Nor can I set the uart0 to "disabled"

    This should work, but can you also set CONFIG_SERIAL=n?

    Kenneth

  • Setting CONFIG_SERIAL=n alone doesn't work either. But I got a warning saying the value has been set in my copy of nrf9160dk_nrf9160_ns_defconfig. So I went there and comment out the line. But that still doesn't work. Finally I comment out the line "CONFIG_SERIAL=y" in  nrf9160dk_nrf9160_defconfig (the non NS version) and that works. Now I don't need to have a unused uart0 in my nrf9160dk_nrf9160_common.dts file and I still have RTT working as expected.

    It's strange why it has to be the non-NS version but not the NS version of defconfig. I'm building my application as the NS version. I don't see how the defconfig file was referenced by any of the DTS or DTSI files.

    Is there any guide explaining the relationship and dependencies among these CONFIG_SERIAL/CONFIG_CONSOLE/CONFIG_LOG/CONFIG_UART...etc. It's very confusing.

Reply
  • Setting CONFIG_SERIAL=n alone doesn't work either. But I got a warning saying the value has been set in my copy of nrf9160dk_nrf9160_ns_defconfig. So I went there and comment out the line. But that still doesn't work. Finally I comment out the line "CONFIG_SERIAL=y" in  nrf9160dk_nrf9160_defconfig (the non NS version) and that works. Now I don't need to have a unused uart0 in my nrf9160dk_nrf9160_common.dts file and I still have RTT working as expected.

    It's strange why it has to be the non-NS version but not the NS version of defconfig. I'm building my application as the NS version. I don't see how the defconfig file was referenced by any of the DTS or DTSI files.

    Is there any guide explaining the relationship and dependencies among these CONFIG_SERIAL/CONFIG_CONSOLE/CONFIG_LOG/CONFIG_UART...etc. It's very confusing.

Children
Related