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
  • Hi,

    Unfortunately I cannot reproduce your issue.
    I just now tried a brand new application based on the NCS v2.0.2 peripheral_lbs example on both the nRF52DK and the nRF5340DK, and for both printk() worked and I got data on a Serial Port.
    I really don't think CONFIG_BT=y would break UART console, that would really not make sense.

    Are you developing on a Development Kit or on your custom board?

    By the way, as you requested, the prj.conf used to test:

    #
    # Copyright (c) 2018 Nordic Semiconductor
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    CONFIG_NCS_SAMPLES_DEFAULTS=y
    
    CONFIG_BT=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DEVICE_NAME="Nordic_LBS"
    
    # Enable the LBS service
    CONFIG_BT_LBS=y
    CONFIG_BT_LBS_POLL_BUTTON=y
    CONFIG_DK_LIBRARY=y
    
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
    

    Best regards,
    Hieu

  • Hello Hieu, 

    Thanks for your quick response.  I have one more request.  Would you use the nrf5340dk_nrf5340_cpuapp.overlay    file to disable to UART console and see if you can still receive output.?  My problem seems to be complicated.  The UART on nRF5340DK always work even if I intentionally disable the UART or assign different TX and RX pins.   I am trying to make sure the overlay file can change the behavior first, then I will make correct adjustment on my own custom board. 

    I have more problem on my custom board, but one thing at a time.  I want to get the UART working in different configuration/overlay first.

    Thanks again.

    My own. nrf5340dk_nrf5340_cpuapp.overlay. for a different custom board, but nRF5340DK is unexpectly working fine with it, so something is wrong

    I may have mistakes in the overlay file


    &uart0 {
        //status = "okay";
        status = "disabled";
    	label = "UART_0";
    	current-speed = <115200>;		// 115200
        pinctrl-0 = <&uart0_default_alt>;
        pinctrl-1 = <&uart0_sleep_alt>;
        pinctrl-names = "default", "sleep";
    };
    
    
    &pinctrl {
        uart0_default_alt: uart0_default_alt {
            group1 {
                psels = <NRF_PSEL(UART_TX, 1, 1)>;		// P1.1 is TX
            };
            group2 {
                psels = <NRF_PSEL(UART_RX, 0, 29)>;		// P0.29 is RX
                bias-pull-up;
            };
        };
        uart0_sleep_alt: uart0_sleep_alt {
            group1 {
                psels = <NRF_PSEL(UART_TX, 1, 1)>,		// P1.1 is TX
                        <NRF_PSEL(UART_RX, 0, 29)>;		// P0.29 is RX
                low-power-enable;
            };
        };
    };
    

  • You read my mind and I was exactly in that situation.  Thanks for your info which helps directing my thought on the debugging process.  Let me regroup with your suggestions first before moving forward

  • The message *** Booting Zephyr OS build v3.1.99-ncs1 *** coming out at 

    • TX at P1.01
    • RX at P0.29

    may be from the NetCore and I am looking for the output from AppCore.  Let me try your suggestion to disable the UART at NetCore first.

  • The message *** Booting Zephyr OS build v3.1.99-ncs1 *** coming out at 

    • TX at P1.01
    • RX at P0.29

    is actually from the NetCore.   I got the output of AppCore using RTT, so my application is running fine.  It is just somehow the UART pins of NetCore  are connected as specified in the overlay file for AppCore!!!!

    I will need your guidance to re-route the AppCore UART to 

    • TX at P1.01
    • RX at P0.29

    so I don't need to use RTT for it.

    Anyway, it is interesting that the UART of NetCore is actually mapped to that for the NetCore.   However, it is better to document it and print messages from AppCore and NetCore.   Both print the same message*** Booting Zephyr OS build v3.1.99-ncs1 ***  at the beginning.  Hard to tell if it has been re routed.

    Thanks for your great help!!!

  • Let me clarify.  I am able to use my custom board RTT for the AppCore with 

    CONFIG_SERIAL=n
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_RTT_CONSOLE=y
    CONFIG_UART_CONSOLE=n
    in prj.conf
    and I got some blue tooth messages from the AppCore
    Starting Zombie Bluetooth Peripheral LBS example
    I: 2 Sectors of 4096 bytes
    I: alloc wra: 0, fd0
    I: data wra: 0, 1c
    I: No ID address. App must call settings_load()
    Bluetooth initialized
    Advertising successfully started
    and I got *** Booting Zephyr OS build v3.1.99-ncs1  *** from UART with 
    • TX at P1.01
    • RX at P0.29

    What I need is to flip the RTT and  UART.   With AppCore messages come out from UART and NetCore messages come out from RTT.

    My custom board has only one UART, so I use it for the AppCore with shell commands.

    Need to re-route with different configuration.

    Thanks for helping.

    JC

  • By setting 

    CONFIG_SERIAL=y or n in child_image/hci_rpmsg.conf 
    I can see or not see *** Booting Zephyr OS build v3.1.99-ncs1 ***. on the UART console connected to my custom board running application built with overlay file nrf5340dk_nrf5340_cuppapp.overlay setting 
    • TX at P1.01
    • RX at P0.29

    The important point is I am using overlay file for AppCore to configure the UART pins but turning on/off tx/rx data with CONFIG_SERIAL for child image which is running in the NetCore!!!!

    This is the reason that I think the message *** Booting Zephyr OS build v3.1.99-ncs1 *** on my console connected to the AppCore UART is actually the bootup message from the NetCore.

    Now, I can disable the NetCore UART

    The next step is to configure AppCore UART to

    • TX at P1.01
    • RX at P0.29

    Do you have any suggestion.   Thanks for your help.

     
Reply
  • By setting 

    CONFIG_SERIAL=y or n in child_image/hci_rpmsg.conf 
    I can see or not see *** Booting Zephyr OS build v3.1.99-ncs1 ***. on the UART console connected to my custom board running application built with overlay file nrf5340dk_nrf5340_cuppapp.overlay setting 
    • TX at P1.01
    • RX at P0.29

    The important point is I am using overlay file for AppCore to configure the UART pins but turning on/off tx/rx data with CONFIG_SERIAL for child image which is running in the NetCore!!!!

    This is the reason that I think the message *** Booting Zephyr OS build v3.1.99-ncs1 *** on my console connected to the AppCore UART is actually the bootup message from the NetCore.

    Now, I can disable the NetCore UART

    The next step is to configure AppCore UART to

    • TX at P1.01
    • RX at P0.29

    Do you have any suggestion.   Thanks for your help.

     
Children
  • Hello Hieu,

    Just a recap of my debugging status.  Now I am 100% sure the bootup message from the 

    • TX at P1.01
    • RX at P0.29

    specified in the nrf5340dk_nrf5340_cupapp.overlay is actually came from the NetCore!!!!!!

    Notice the overlay file  cupapp for the AppCore.

    I added one line of code in zephyr/samples/bluetooth/hci_rpmsg/src/main.c


    printk("Hello hci_rpmsg child from NetCore\n");    // <<--------------- Added message !!!

    and now I see the message from the NetCore from the UART pins for the AppCore !!??
    *** Booting Zephyr OS build v3.1.99-ncs1 ***
    Hello hci_rpmsg child from NetCore
    *** Booting Zephyr OS build v3.1.99-ncs1 ***
    Hello hci_rpmsg child from NetCore
    *** Booting Zephyr OS build v3.1.99-ncs1 ***
    Hello hci_rpmsg child from NetCore
    It is a little progress, but at least I verified the assumption of the AppCore message is actually came from NetCore !!   The next step is to understand. this rerouting/forwarding configuration, so eventually I can send to AppCore UART message to 
    • TX at P1.01
    • RX at P0.29

    The problem is related to kernel configuration at the very very early beginning in the sw build process, so I will need help to solve.  It is a run time bug that I can use a debugger to step thru the code.

    Thanks for helping.

    void main(void)
    {
    	int err;
    	const struct device *hci_ipc_instance =
    		DEVICE_DT_GET(DT_CHOSEN(zephyr_bt_hci_rpmsg_ipc));
    
    	/* incoming events and data from the controller */
    	static K_FIFO_DEFINE(rx_queue);
    
    	printk("Hello hci_rpmsg child from NetCore\n");
    
    	LOG_DBG("Start");
Related