NRF5340 Audio net core app update

Hi,

I developing an Hearing aid accessory with nrf5340 audio and STM32.

I do not have external flash so I need to use the nrf5340 internal flash.

I'm using the 2.5.0 SDK and I succeeded to update the application image with the mcumgr over the USB CDC ACM connected to the nrf5340.

Is it possible to update the network image without external flash and by the serial port?

If yes, Do you have any example for it?

Parents
  • Hi, 

    Yes, it is possible to update the network core without external flash in single-image DFU. 

    To change the upload for the network core, use

    mcumgr --conntype=serial --connstring="dev=/dev/ttyACM3,baud=115200" image upload build/zephyr/net_core_app_update.bin
    

    Regards,
    Amanda H.

  • Thanks for the fast reply.

    I did it but the nrf5340 was not booted after upload the network and restart the device (the RTT log was empty)

    Could you please check if the following prj.conf is correct?

    CONFIG_NCS_SAMPLE_EMPTY_NET_CORE_CHILD_IMAGE=y
    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
    CONFIG_THREAD_NAME=y
    CONFIG_ZCBOR=y
    CONFIG_USB_DEVICE_STACK=y
    CONFIG_USB_DEVICE_PRODUCT="Nuance CDC ACM"
    CONFIG_USB_DEVICE_PID=0x530A
    CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y
    CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y
    CONFIG_UART_LINE_CTRL=y
    CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n
    CONFIG_B0N_MINIMAL=y
    CONFIG_AUDIO_DFU=1
    CONFIG_MCUMGR=y
    CONFIG_MCUMGR_GRP_OS=y
    CONFIG_MCUMGR_GRP_OS_TASKSTAT=y
    CONFIG_MCUMGR_GRP_STAT=y
    CONFIG_MCUMGR_GRP_IMG=y
    CONFIG_MCUMGR_TRANSPORT_NETBUF_SIZE=1024
    CONFIG_IMG_MANAGER=y
    CONFIG_FLASH=y
    CONFIG_FLASH_MAP=y
    CONFIG_STREAM_FLASH=y

     

    # nRF5340 Audio
    CONFIG_NRF5340_AUDIO=y
    CONFIG_AUDIO_DEV=2
    CONFIG_BT_DEVICE_NAME_DYNAMIC=y
    #CONFIG_BT_DEVICE_NAME="NRF5340_AUDIO"
    CONFIG_AUDIO_SOURCE_I2S=y
    CONFIG_AUDIO_SAMPLE_RATE_16000_HZ=y
    CONFIG_BT_CSIP_SET_COORDINATOR=y
    CONFIG_BT_BONDABLE=y
    CONFIG_BT_BAP_UNICAST_CLIENT_LOG_LEVEL_DBG=n
    CONFIG_BT_L2CAP_TX_MTU=300
    CONFIG_BT_AUDIO_BITRATE_UNICAST_SINK=32000
    CONFIG_BT_AUDIO_RETRANSMITS=3
    CONFIG_BT_AUDIO_MAX_TRANSPORT_LATENCY_MS=10
    CONFIG_WDT_CTLR=n
    # General
    CONFIG_DEBUG=n
    CONFIG_ASSERT=n
    CONFIG_STACK_USAGE=n
    CONFIG_THREAD_MONITOR=n
    CONFIG_PRINTK=n
    CONFIG_BOOT_BANNER=n

     

    CONFIG_SHELL=y
    CONFIG_KERNEL_SHELL=y
    CONFIG_USE_SEGGER_RTT=y
    ## Disable logs on RTT
    CONFIG_SHELL_RTT_INIT_LOG_LEVEL_NONE=n
    CONFIG_SHELL_BACKEND_RTT=n
    CONFIG_SHELL_BACKEND_SERIAL=n

    # Uart driver
    CONFIG_SERIAL=y
    CONFIG_UART_INTERRUPT_DRIVEN=y
    CONFIG_CONSOLE=y
    CONFIG_RTT_CONSOLE=n
    CONFIG_UART_CONSOLE=y
  • Hi Amanda,

    I updated my application to NCS v2.7.0.

    I see that the serial recovery was changed from v2.5.0.

    Can you guide me how to add the serial recovery over CDC USB?

    Do I need to do it via Sysbuild?

  • Hi, 

    Omri said:
    Can you guide me how to add the serial recovery over CDC USB?

    You can take a look at this course

    For v2.7.0, you can use the overlay-serial-USB.conf to include the relevant configs; add these lines to mcuboot.overlay and mcuboot.conf. It will get into USB recovery mode by holding BTN3 (PLAY/PAUSE) while resetting the Audio DK. 

    Omri said:
    Do I need to do it via Sysbuild?

    All samples and applications in the SDK are built with sysbuild by default. Applications that are outside the SDK are not built with sysbuild by default.

    Please also be aware that Updating the SoftDevice in NCS v2.7.0:

    Both FOTA upgrade methods support updating the SoftDevice on the network core. However, the current default build options for the SoftDevice create a binary that is too large to run on the network core together with a bootloader. To reduce the size of the SoftDevice binary, you can disable unused features in the SoftDevice. See SoftDevice Controller documentation for more information. 

    -Amanda H.

  • Hi Amanda,

    I add the USB CDC Serial Recovery to the nrf5340 audio application based on sysbuild config on NCS v2.7.0

     However, I get the following partition error:

    FAILED: zephyr/CMakeFiles/zephyr.dir/C_/ncs/v2.7.0/bootloader/mcuboot/boot/boot_serial/src/boot_serial.c.obj 
    C:\ncs\toolchains\ce3b5ff664\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -DKERNEL -DK_HEAP_MEM_POOL_SIZE=0 -DMBEDTLS_CONFIG_FILE=\"mcuboot-mbedtls-cfg.h\" -DNCS_APPLICATION_BOOT_BANNER_GIT_REPO -DNRF5340_XXAA_APPLICATION -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DUSE_PARTITION_MANAGER=1 -D__PROGRAM_START -D__ZEPHYR__=1 -IC:/ncs/v2.7.0/zephyr/kernel/include -IC:/ncs/v2.7.0/zephyr/arch/arm/include -IC:/ncs/v2.7.0/zephyr/include -IC:/nuance/leaudio_pod/ble/platform/nordic5340/build/mcuboot/zephyr/include/generated -IC:/ncs/v2.7.0/zephyr/soc/nordic -IC:/ncs/v2.7.0/zephyr/soc/nordic/nrf53/. -IC:/ncs/v2.7.0/zephyr/soc/nordic/common/. -IC:/ncs/v2.7.0/nrf/include -IC:/ncs/v2.7.0/nrf/tests/include -IC:/ncs/v2.7.0/modules/hal/cmsis/CMSIS/Core/Include -IC:/ncs/v2.7.0/zephyr/modules/cmsis/. -IC:/ncs/v2.7.0/modules/hal/nordic/nrfx -IC:/ncs/v2.7.0/modules/hal/nordic/nrfx/drivers/include -IC:/ncs/v2.7.0/modules/hal/nordic/nrfx/mdk -IC:/ncs/v2.7.0/zephyr/modules/hal_nordic/nrfx/. -IC:/ncs/v2.7.0/modules/lib/zcbor/include -IC:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr/include -IC:/ncs/v2.7.0/bootloader/mcuboot/boot/bootutil/include -IC:/ncs/v2.7.0/bootloader/mcuboot/boot/boot_serial/include -IC:/ncs/v2.7.0/bootloader/mcuboot/boot/bootutil/src -IC:/ncs/v2.7.0/modules/crypto/mbedtls/include -IC:/ncs/v2.7.0/modules/crypto/mbedtls/include/library -IC:/ncs/v2.7.0/modules/crypto/mbedtls/library -IC:/ncs/v2.7.0/zephyr/modules/mbedtls/configs -IC:/ncs/v2.7.0/zephyr/modules/mbedtls/include -IC:/ncs/v2.7.0/bootloader/mcuboot/boot/bootutil/zephyr/.. -IC:/ncs/v2.7.0/bootloader/mcuboot/boot/bootutil/zephyr/../include -IC:/ncs/v2.7.0/bootloader/mcuboot/boot/bootutil/zephyr/../../zephyr/include -isystem C:/ncs/v2.7.0/zephyr/lib/libc/minimal/include -isystem C:/ncs/v2.7.0/zephyr/lib/libc/common/include -isystem c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/include -isystem c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/include-fixed -isystem C:/ncs/v2.7.0/nrfxlib/crypto/nrf_cc312_platform/include -fno-strict-aliasing -Os -imacros C:/nuance/leaudio_pod/ble/platform/nordic5340/build/mcuboot/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfp16-format=ieee --sysroot=C:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros C:/ncs/v2.7.0/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=C:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/ncs/v2.7.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/ncs/v2.7.0=WEST_TOPDIR -ffunction-sections -fdata-sections -std=c99 -nostdinc -MD -MT zephyr/CMakeFiles/zephyr.dir/C_/ncs/v2.7.0/bootloader/mcuboot/boot/boot_serial/src/boot_serial.c.obj -MF zephyr\CMakeFiles\zephyr.dir\C_\ncs\v2.7.0\bootloader\mcuboot\boot\boot_serial\src\boot_serial.c.obj.d -o zephyr/CMakeFiles/zephyr.dir/C_/ncs/v2.7.0/bootloader/mcuboot/boot/boot_serial/src/boot_serial.c.obj -c C:/ncs/v2.7.0/bootloader/mcuboot/boot/boot_serial/src/boot_serial.c
    In file included from C:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr/include/sysflash/sysflash.h:10,
                     from C:/ncs/v2.7.0/bootloader/mcuboot/boot/boot_serial/src/boot_serial.c:27:
    C:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h: In function '__flash_area_ids_for_slot':
    C:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:48:62: error: 'PM_MCUBOOT_SECONDARY_1_ID' undeclared (first use in this function); did you mean 'PM_MCUBOOT_SECONDARY_ID'?
       48 | #define FLASH_AREA_IMAGE_1_SLOTS    PM_MCUBOOT_PRIMARY_1_ID, PM_MCUBOOT_SECONDARY_1_ID
          |                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:55:29: note: in expansion of macro 'FLASH_AREA_IMAGE_1_SLOTS'
       55 |                             FLASH_AREA_IMAGE_1_SLOTS
          |                             ^~~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:67:9: note: in expansion of macro 'ALL_AVAILABLE_SLOTS'
       67 |         ALL_AVAILABLE_SLOTS
          |         ^~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:48:62: note: each undeclared identifier is reported only once for each function it appears in
       48 | #define FLASH_AREA_IMAGE_1_SLOTS    PM_MCUBOOT_PRIMARY_1_ID, PM_MCUBOOT_SECONDARY_1_ID
          |                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:55:29: note: in expansion of macro 'FLASH_AREA_IMAGE_1_SLOTS'
       55 |                             FLASH_AREA_IMAGE_1_SLOTS
          |                             ^~~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:67:9: note: in expansion of macro 'ALL_AVAILABLE_SLOTS'
       67 |         ALL_AVAILABLE_SLOTS

    Are you familiar with that error? do you have solution for this?

    Omri.

  • No. the post was regarding DFU over BT with external flash while I use DFU over USB CDC without external flash.

    Is it possible to build my project or the ipc radio without the Sysbuild? 

Reply Children
Related