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 Reply Children
  • I don't think I have a SPM folder. I only have one prj.conf within my source folder.

  • Ah yes sorry. I am looking at a different project from when I first had this issue. 

    Looks like you already found it, but you  nrf9160dk_nrf9160ns_defconfig can be edited for your board folder. 

    For reference mine now looks like this. It will probably get rid of the error you have above.

    # SPDX-License-Identifier: Apache-2.0
    
    CONFIG_SOC_SERIES_NRF91X=y
    CONFIG_SOC_NRF9160_SICA=y
    CONFIG_BOARD_NRF9160DK_NRF9160NS=y
    
    # Enable MPU
    CONFIG_ARM_MPU=y
    
    # Enable hardware stack protection
    CONFIG_HW_STACK_PROTECTION=y
    
    # Enable TrustZone-M
    CONFIG_ARM_TRUSTZONE_M=y
    
    # This Board implies building Non-Secure firmware
    CONFIG_TRUSTED_EXECUTION_NONSECURE=y
    
    # enable GPIO
    CONFIG_GPIO=y
    
    # # Enable uart driver            #COMMENT THIS OUT
    # CONFIG_SERIAL=y                 #COMMENT THIS OUT
    #                                 #COMMENT THIS OUT
    # # enable console                #COMMENT THIS OUT
    # CONFIG_CONSOLE=y                #COMMENT THIS OUT
    # CONFIG_UART_CONSOLE=y           #COMMENT THIS OUT

  • I did try to comment out those lines as you mentioned. But I found I have to at least keep the line "CONFIG_CONSOLE=y" to have RTT working. Otherwise the RTT viewer shows nothing.

    Strange. There's definitely some complicated relationship between those CONFIGs.

Related