Sysbuild example nRF5340DK UART output

Hi Community,

I'm learning the sysbuild stuffs, try to upgrade my code to sdk v2.9.0.

Exercise 2 - Adding custom image - Nordic Developer Academy

I'm using nRF5340DK to run this exercise code, but I can't find the so called "UART30 " for output.

Could you please give me more instructions? thanks!

Regards

Danny

  • Hi @ 

    after changing the code in thingy53_nrf5340_common.dtsi to this:

        chosen {
            //zephyr,bt-hci-ipc = &ipc0;
            zephyr,bt-hci = &bt_hci_ipc0;
            //nordic,802154-spinel-ipc = &ipc0;
            //zephyr,ieee802154 = &ieee802154;
            //nordic,pm-ext-flash = &mx25r64;
        };
    changing the code in thingy53_nrf5340_cpunet.dts to this:
        chosen {
            //zephyr,console = &uart0;
            //zephyr,shell-uart = &uart0;
            //zephyr,uart-mcumgr = &uart0;
            //zephyr,bt-mon-uart = &uart0;
            //zephyr,bt-c2h-uart = &uart0;
            zephyr,bt-hci-ipc = &ipc0;
            //nordic,802154-spinel-ipc = &ipc0;
            zephyr,sram = &sram1;
            zephyr,flash = &flash1;
            zephyr,code-partition = &slot0_partition;
            zephyr,ieee802154 = &ieee802154;
        };
    the FOTA code for both cores is running, the HCI error is gone, but I'm not sure if it's a reliable solution, please double check it.
    **********************************************************************************
    Additionally, since I only have USB on my board, for debugging I want to redirect the logging and output of printk to USB, so I add following code in app.overlay 
    /* Step 1.1  - Add external flash to applciation */
    / {
        chosen {
            nordic,pm-ext-flash = &mx25r64;
            zephyr,console = &cdc_acm_uart0; //for printk in app
        };
    };
     
    &usbd {
        cdc_acm_uart0: cdc_acm_uart0 {
            compatible = "zephyr,cdc-acm-uart";
            status = "okay";
        };
    };
    and this in prj.conf:
    # Enable USB subsystem
    CONFIG_USB_DEVICE_STACK=y
    CONFIG_UART_LINE_CTRL=y
    CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=y
    CONFIG_USB_DEVICE_PRODUCT="TEST_USB"
    CONFIG_STDOUT_CONSOLE=y
    CONFIG_LOG=y
     
    but this crashes the system often, the chip get rebooted very often, how can I make a reliable USB logging? 
    Regards
    Danny
  • danny0007 said:
    the FOTA code for both cores is running, the HCI error is gone, but I'm not sure if it's a reliable solution, please double check it.

    Good job!

    Looks like you just had to make sure hci matches. So yes, in that case, the changes seem reasonable to me.

    danny0007 said:
    but this crashes the system often, the chip get rebooted very often, how can I make a reliable USB logging? 

    For USB:

    How often do you log?
    Does it improve if you log a bit less?

    Try to set CONFIG_USB_CDC_ACM_RINGBUF_SIZE=16384

  • Regardless of the USB issue.

    the HCI issue happens again, it seems not a stable solution, it happens randomly.

    Actually during the debugging, I also found it's working only sometimes, even the same code doesn't work after another flash.

  • Hi  

    I finally fixed it and it's stable.

    1. first of all, the board files of thingy53 has no issue.

    2. the configuration in ipc_radio.conf causes the issue, because here the UART is enabled, but in the  *_cpunet.dts of boards file uart0 is disabled. this causes conflict and HCI issue. So I just commented these out:

    #CONFIG_SERIAL=y
    #CONFIG_UART_CONSOLE=y
    #CONFIG_LOG=y
    no HCI issue happens again.
    please verify it and update the code for thingy53.
    3. last but lease, in the sdk v3.0.0/bootloader/mcuboot/boot/zephyr/boards these is a file named "thingy53_nrf5340_cpuapp.conf", which is also called during the building:

    if the code is compiled for a custom board, a similar file shall be added also, otherwise there will be lots of usb related "k_work* " errors.
    my question here is: how can I put this file under my project and make the building call it from my project? since it's a custom board related file, I dont want to put it into sdk source code.
    Regards
    Danny
  • danny0007 said:
    I finally fixed it and it's stable.

    Good job!

    danny0007 said:
    my question here is: how can I put this file under my project and make the building call it from my project? since it's a custom board related file, I dont want to put it into sdk source code.

    You can use sysbuild to add it.
    For example as project/sysbuild/mcuboot/boards/board_name.conf or as project/sysbuild/ipc_radio/boards/board_name.conf.

    See Lesson 8 – Sysbuild to learn more about Sysbuild.

Related