Unable to get UART log output on nRF9151 DK

This seems like a silly issue, but I cannot get the UART output from the nRF9151 DK. Attached is a project that outputs via both LOG and printk() to a Segger RTT viewer without issue, but does not from UART (USB virtual via the DK). I normally use J-Link RTT but recently opened a DevZone ticket where part of the follow-up was to eliminate RTT from the project and try to reproduce the firmware fault.

The attached zip contains the whole project, I am using SDK v3.0.2. If the CONFIG_RTT_CONSOLE is set to "y" works perfectly. Change RTT to "n", CONFIG_UART_CONSOLE=y and no output. I have tried build for both with/without TFM. 

# to use Segger RTT in any capacity
CONFIG_USE_SEGGER_RTT=y

# setup CONSOLE behavior
CONFIG_CONSOLE=y
CONFIG_RTT_CONSOLE=n
CONFIG_UART_CONSOLE=y

# setup LOG facility behavior
CONFIG_LOG=y
CONFIG_LOG_PRINTK=y
CONFIG_LOG_MODE_IMMEDIATE=y

*** Booting nRF Connect SDK v3.0.2-89ba1294ac9b ***
*** Using Zephyr OS v4.0.99-f791c49f492c ***
Hello World! nrf9151dk/nrf9151/ns
[00:00:00.409,759] <inf> main: LOG can say Hello World too.
It is also possible to use printk... Hello world!
.
,
Hello World! nrf9151dk/nrf9151/ns
[00:00:02.410,644] <inf> main: LOG can say Hello World too.
It is also possible to use printk... Hello world!
*** Booting nRF Connect SDK v3.0.2-89ba1294ac9b ***
*** Using Zephyr OS v4.0.99-f791c49f492c ***
Hello World! nrf9151dk/nrf9151/ns
[00:00:22.811,248] <inf> main: LOG can say Hello World too.
It is also possible to use printk... Hello world!
.
,
Hello World! nrf9151dk/nrf9151/ns
[00:00:24.812,133] <inf> main: LOG can say Hello World too.
It is also possible to use printk... Hello world!
.
,
Hello World! nrf9151dk/nrf9151/ns
[00:00:26.813,018] <inf> main: LOG can say Hello World too.
It is also possible to use printk... Hello world!
.
,
Hello World! nrf9151dk/nrf9151/ns
[.
,
Hello World! nrf9151dk/nrf9151/ns
[00:00:34.835,510] <inf> main: LOG can say Hello World too.
It is also possible to use printk... Hello world!

3666.hello_world.zip

  • gterrell said:

    Have you changed nrf9151dk_nrf9151_common-pinctrl.dtsi? It should look like this

    /*
     * Copyright (c) 2023 Nordic Semiconductor
     * SPDX-License-Identifier: Apache-2.0
     */
    
    &pinctrl {
    	uart0_default: uart0_default {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 27)>,
    				<NRF_PSEL(UART_RTS, 0, 14)>;
    		};
    		group2 {
    			psels = <NRF_PSEL(UART_RX, 0, 26)>,
    				<NRF_PSEL(UART_CTS, 0, 15)>;
    			bias-pull-up;
    		};
    	};
    
    	uart0_sleep: uart0_sleep {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 27)>,
    				<NRF_PSEL(UART_RX, 0, 26)>,
    				<NRF_PSEL(UART_RTS, 0, 14)>,
    				<NRF_PSEL(UART_CTS, 0, 15)>;
    			low-power-enable;
    		};
    	};
    
    	uart1_default: uart1_default {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 29)>,
    				<NRF_PSEL(UART_RTS, 0, 16)>;
    		};
    		group2 {
    			psels = <NRF_PSEL(UART_RX, 0, 28)>,
    				<NRF_PSEL(UART_CTS, 0, 17)>;
    			bias-pull-up;
    		};
    	};
    
    	uart1_sleep: uart1_sleep {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 29)>,
    				<NRF_PSEL(UART_RX, 0, 28)>,
    				<NRF_PSEL(UART_RTS, 0, 16)>,
    				<NRF_PSEL(UART_CTS, 0, 17)>;
    			low-power-enable;
    		};
    	};
    
    	i2c2_default: i2c2_default {
    		group1 {
    			psels = <NRF_PSEL(TWIM_SDA, 0, 30)>,
    				<NRF_PSEL(TWIM_SCL, 0, 31)>;
    		};
    	};
    
    	i2c2_sleep: i2c2_sleep {
    		group1 {
    			psels = <NRF_PSEL(TWIM_SDA, 0, 30)>,
    				<NRF_PSEL(TWIM_SCL, 0, 31)>;
    			low-power-enable;
    		};
    	};
    
    	pwm0_default: pwm0_default {
    		group1 {
    			psels = <NRF_PSEL(PWM_OUT0, 0, 0)>;
    		};
    	};
    
    	pwm0_sleep: pwm0_sleep {
    		group1 {
    			psels = <NRF_PSEL(PWM_OUT0, 0, 0)>;
    			low-power-enable;
    		};
    	};
    
    	spi3_default: spi3_default {
    		group1 {
    			psels = <NRF_PSEL(SPIM_SCK, 0, 13)>,
    				<NRF_PSEL(SPIM_MISO, 0, 12)>,
    				<NRF_PSEL(SPIM_MOSI, 0, 11)>;
    			nordic,drive-mode = <NRF_DRIVE_H0H1>;
    		};
    	};
    
    	spi3_sleep: spi3_sleep {
    		group1 {
    			psels = <NRF_PSEL(SPIM_SCK, 0, 13)>,
    				<NRF_PSEL(SPIM_MISO, 0, 12)>,
    				<NRF_PSEL(SPIM_MOSI, 0, 11)>;
    			low-power-enable;
    		};
    	};
    };
    

  • My nrf9151dk_nrf9151_common-pinctrl.dtsi does not match yours, it is likely that the file on my system was inadvertently changed. I have pasted your content in and will test UART log functionality today.

  • Big thanks Hakon, the correct nrf9151dk_nrf9151_common-pinctrl.dtsi did the trick. I must have accidently changed the file while creating the board definitions for our custom board.

Related