No output to UART console when CONFIG_BT=y

There is no output to UART console when I set CONFIG_BT=y in prj.conf

peripheral_lbs sample project in ncs V2.0.2 can't printk anything.  

Parents
  • This reply is written as the summary of the long discussion between JC, Q&A initiator, and me, the support guy; just so future reader can quickly know what we found out and what fixed things.

    In this answer, UART peripherals are referred to using the label they defined in nrf5340_cpuapp_peripherals.dtsi.

    The issue is that JC, starting from the peripheral_lbs, reconfigure an AppCore UART TX to P1.01 using .overlay file.
    The reason there was no UART output is not related to CONFIG_BT=y, but rather the pin P1.01 was used.

    By default, nrf5340_cpuapp_common.dts files and its related .dts/.dtsi give the P1.01 pin to NetCore to use with another UART peripheral.

    P1.00, P0.11, P0.10 are affected similarly.

    Therefore in the .overlay file, the nrf-gpio-forwarder also has to be disabled.

    Note that this also disable the UART peripheral in the NetCore.
    If UART is also necessary in the NetCore, then NetCore also need its own overlay/custom dts setup, and AppCore nrf-gpio-forwarder should not be disabled but update accordingly.

    The complete .overlay solution is below:

    / {
    	gpio_fwd: nrf-gpio-forwarder {
    		compatible = "nordic,nrf-gpio-forwarder";
    		status = "disabled";
    		uart {
    			gpios = <&gpio1 1 0>, <&gpio1 0 0>, <&gpio0 11 0>, <&gpio0 10 0>;
    		};
    	};
    };
    
    &pinctrl {
    	custom_default: c {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 1, 1)>;
    		};
    		group2 {
    			psels = <NRF_PSEL(UART_RX, 0, 29)>;
    			bias-pull-up;
    		};
    	};
    
    	custom_sleep: custom_sleep {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 1, 1)>,
    				<NRF_PSEL(UART_RX, 0, 29)>;
    			low-power-enable;
    		};
    	};
    };
    
    &uart0 {
    	status = "okay";
    	current-speed = <115200>;
    	pinctrl-0 = <&custom_default>;
    	pinctrl-1 = <&custom_sleep>;
    	pinctrl-names = "default", "sleep";
    };

  • Hello Hieu,

    Found the following code in nrf5340_cpunet_reset.c of ncs v1.9.1.  Does disabling gpio forwarder in overlay file work with v1.9.1. ??  Thanks,

    JC

    static void remoteproc_mgr_config(void)
    {
    #if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(CONFIG_BUILD_WITH_TFM)
    	/* UARTE */
    	/* Assign specific GPIOs that will be used to get UARTE from
    	 * nRF5340 Network MCU.
    	 */
    
    	soc_secure_gpio_pin_mcu_select(CPUNET_UARTE_PIN_TX, NRF_GPIO_PIN_MCUSEL_NETWORK);
    	soc_secure_gpio_pin_mcu_select(CPUNET_UARTE_PIN_RX, NRF_GPIO_PIN_MCUSEL_NETWORK);
    	soc_secure_gpio_pin_mcu_select(CPUNET_UARTE_PIN_RTS, NRF_GPIO_PIN_MCUSEL_NETWORK);
    	soc_secure_gpio_pin_mcu_select(CPUNET_UARTE_PIN_CTS, NRF_GPIO_PIN_MCUSEL_NETWORK);
    
    	/* Route Bluetooth Controller Debug Pins */
    	DEBUG_SETUP();
    #endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(CONFIG_BUILD_WITH_TFM) */
    

  • Hi JC,

    No, GPIO Forwarder is not available in NCS v1.9.1. For that SDK version, the forwarding of pins is done in the nrf5340_cpunet_reset.c file as you have discovered.

    To take back the P1.01 pin that you need, in main() just call the same function but set the pin back to AppCore.
    You won't have the CPUNET_UARTE_PIN_TX macro, so you can just use its explicit value of 33 or something like this.

    #define GPIO_1_PIN_NUM_OFFSET 32
    #define PIN_1_01              (GPIO_1_PIN_NUM_OFFSET + 1)
    
    soc_secure_gpio_pin_mcu_select(PIN_1_01, NRF_GPIO_PIN_MCUSEL_APP);
    Best regards,
    Hieu
  • H JC,

    Just want to let you know that I have verified the answer on this ticket and won't be informed of new reply. If you have further questions, please remember to open a new ticket.

    Happy coding.

    Hieu

Reply Children
Related