nRF Connect SDK 2.3.0 with nRF5340 -- I'm loading a BLE example on Network core. What do I need to load on Application Core?

Hi all,

I have plenty of experience with the Old SDK, IAR/Keil/SES, nRF51, nRF52, Soft Device, etc. However, I'm new to the nRF Connect SDK, VS Code and nRF5340. I've successfully set the environment up and succesfully played with the "blinky" example application.

Now I'm moving on to BLE ...

I'm loading a BLE example on Network core (nrf/samples/bluetooth/peripheral_uart). I read that I need to load a "bare bones" example application on the Application core that only turns on the Network core. What is it called? I don't seem to find that example.

Also, do I still have to load the Soft Device on the Network core too? Like we used to do with the Old SDK, nRF52, etc? If so, how do you suggest I do that? With the nRFConnect Windows App? And where are the Soft Devices in this SDK folder structure?

Please help! Slight smile

Thanks!

Gil

Parents
  • Hi Gil,

    Thank you for your patience.

    7002DK features a nrf5340 SoC, so, ideally, the samples/projects for 5340 SoC should work for the same target on the 7002DK. However, as for as the DK is concerned (nrf5340DK vs nrf7002DK), we know that 7002DK has a wifi companion chip that too connected via the qspi interface to the 5340, and also some other layout/configuration on the DK might be different (see the details of DKs: 5340DK   7002DK).

    So a sample which state nrf5340DK as the supported board might not always work for the nrf7002DK (even though the targets are same). Nonetheless, for the basic sample (like you have mentioned) no changes are required. I have tested the configuration you have asked for both DKs, and it is working as expected.

    I am just attaching snapshots to show the DK setup, the device name, and the successful advertising.

    DK_setup

    nrfconnectapp

    namechange

    Regards,

    Naeem

  • Hi Naeem,

    Here's the 2 things what I've found out.

    1. If I individually program the Application core with "nrf/samples/nrf5340/empty_app_core" and the Network core with "nrf/samples/bluetooth/peripheral_uart" it does not work for me. The reason is because each time that I program one or the other, BOTH cores are erased and then ONE core is programmed. So I always end up with only one core programmed. See the flashing messages below:

    BOTH CORES ERASED:

    -- west flash: using runner nrfjprog
    -- runners.nrfjprog: Recovering and erasing flash memory for both the network and application cores.
    Recovering device. This operation might take 30s.
    Erasing user code and UICR flash areas.
    Writing image to disable ap protect.
    Recovering device. This operation might take 30s.
    Erasing user code and UICR flash areas.
    Writing image to disable ap protect.

    ONLY ONE CORE PROGRAMMED:

    -- runners.nrfjprog: Flashing file: c:\ncs\myapps\peripheral_uart\peripheral_uart\build_peripheral_uart\zephyr\zephyr.hex
    [ #################### ] 16.637s | Erase file - Done erasing
    [ #################### ] 1.612s | Program file - Done programming
    [ #################### ] 1.652s | Verify file - Done verifying
    Applying pin reset.
    -- runners.nrfjprog: Board with serial number 1050727688 flashed successfully.

    2. However, if I add this line to prj.conf of the "periphral_uart" code:

    CONFIG_NCS_SAMPLE_EMPTY_APP_CORE_CHILD_IMAGE=y
    And program only the Network core with "nrf/samples/bluetooth/peripheral_uart" ... IT WORKS !!!! The reason is because both the .hex files are built together (main image, subimage, then merged), then at programming time they are split up, then individually programmed to each core. See messages below:
    BUILD:
    ...
    [131/132] Generating zephyr/app.hex
    [132/132] Generating zephyr/merged_CPUAPP.hex
    [236/251] Linking C executable zephyr\zephyr_pre0.elf

    [238/251] No install step for 'empty_app_core_subimage'
    [239/251] Completed 'empty_app_core_subimage'
    ...
    [250/251] Generating zephyr/merged.hex
    [251/251] Generating zephyr/merged_domains.hex
    BOTH CORES ERASED:
    ...
    -- west flash: using runner nrfjprog
    -- runners.nrfjprog: Recovering and erasing flash memory for both the network and application cores.
    Recovering device. This operation might take 30s.
    Erasing user code and UICR flash areas.
    Writing image to disable ap protect.
    Recovering device. This operation might take 30s.
    Erasing user code and UICR flash areas.
    Writing image to disable ap protect.
    THE .HEX FILE IS SPLIT AND BOTH CORES ARE PROGRAMMED:

    -- runners.nrfjprog: Flashing file: C:\ncs\myapps\peripheral_uart\peripheral_uart\build_peripheral_uart\zephyr\merged_domains.hex
    -- runners.nrfjprog: C:\ncs\myapps\peripheral_uart\peripheral_uart\build_peripheral_uart\zephyr\merged_domains.hex targets both nRF53 coprocessors; splitting it into: C:\ncs\myapps\peripheral_uart\peripheral_uart\build_peripheral_uart\zephyr\GENERATED_CP_NETWORK_merged_domains.hex and C:\ncs\myapps\peripheral_uart\peripheral_uart\build_peripheral_uart\zephyr\GENERATED_CP_APPLICATION_merged_domains.hex
    [ #################### ] 16.651s | Erase file - Done erasing
    [ #################### ] 1.616s | Program file - Done programming
    [ #################### ] 1.649s | Verify file - Done verifying
    [ #################### ] 0.257s | Erase file - Done erasing
    [ #################### ] 0.046s | Program file - Done programming
    [ #################### ] 0.029s | Verify file - Done verifying
    Applying pin reset.
    -- runners.nrfjprog: Board with serial number 1050727688 flashed successfully.
    THE BOTTOM LINE QUESTIONS ARE:
    A. Why does the method in (1.) above erase both cores? Is there any way to only erase the core that I want to program/update?
    B. I can get it to work with a BLE app on the Network core and the "empty_app" on the Application Core. However, in the future I will have a full blow app running on the Application core (with SPI and QSPI, etc), and I will need to erase and program the two cores separately and individually. How will I be able to do that?
    Please let me know. Thank you.
    Cheers,
    Gil
Reply
  • Hi Naeem,

    Here's the 2 things what I've found out.

    1. If I individually program the Application core with "nrf/samples/nrf5340/empty_app_core" and the Network core with "nrf/samples/bluetooth/peripheral_uart" it does not work for me. The reason is because each time that I program one or the other, BOTH cores are erased and then ONE core is programmed. So I always end up with only one core programmed. See the flashing messages below:

    BOTH CORES ERASED:

    -- west flash: using runner nrfjprog
    -- runners.nrfjprog: Recovering and erasing flash memory for both the network and application cores.
    Recovering device. This operation might take 30s.
    Erasing user code and UICR flash areas.
    Writing image to disable ap protect.
    Recovering device. This operation might take 30s.
    Erasing user code and UICR flash areas.
    Writing image to disable ap protect.

    ONLY ONE CORE PROGRAMMED:

    -- runners.nrfjprog: Flashing file: c:\ncs\myapps\peripheral_uart\peripheral_uart\build_peripheral_uart\zephyr\zephyr.hex
    [ #################### ] 16.637s | Erase file - Done erasing
    [ #################### ] 1.612s | Program file - Done programming
    [ #################### ] 1.652s | Verify file - Done verifying
    Applying pin reset.
    -- runners.nrfjprog: Board with serial number 1050727688 flashed successfully.

    2. However, if I add this line to prj.conf of the "periphral_uart" code:

    CONFIG_NCS_SAMPLE_EMPTY_APP_CORE_CHILD_IMAGE=y
    And program only the Network core with "nrf/samples/bluetooth/peripheral_uart" ... IT WORKS !!!! The reason is because both the .hex files are built together (main image, subimage, then merged), then at programming time they are split up, then individually programmed to each core. See messages below:
    BUILD:
    ...
    [131/132] Generating zephyr/app.hex
    [132/132] Generating zephyr/merged_CPUAPP.hex
    [236/251] Linking C executable zephyr\zephyr_pre0.elf

    [238/251] No install step for 'empty_app_core_subimage'
    [239/251] Completed 'empty_app_core_subimage'
    ...
    [250/251] Generating zephyr/merged.hex
    [251/251] Generating zephyr/merged_domains.hex
    BOTH CORES ERASED:
    ...
    -- west flash: using runner nrfjprog
    -- runners.nrfjprog: Recovering and erasing flash memory for both the network and application cores.
    Recovering device. This operation might take 30s.
    Erasing user code and UICR flash areas.
    Writing image to disable ap protect.
    Recovering device. This operation might take 30s.
    Erasing user code and UICR flash areas.
    Writing image to disable ap protect.
    THE .HEX FILE IS SPLIT AND BOTH CORES ARE PROGRAMMED:

    -- runners.nrfjprog: Flashing file: C:\ncs\myapps\peripheral_uart\peripheral_uart\build_peripheral_uart\zephyr\merged_domains.hex
    -- runners.nrfjprog: C:\ncs\myapps\peripheral_uart\peripheral_uart\build_peripheral_uart\zephyr\merged_domains.hex targets both nRF53 coprocessors; splitting it into: C:\ncs\myapps\peripheral_uart\peripheral_uart\build_peripheral_uart\zephyr\GENERATED_CP_NETWORK_merged_domains.hex and C:\ncs\myapps\peripheral_uart\peripheral_uart\build_peripheral_uart\zephyr\GENERATED_CP_APPLICATION_merged_domains.hex
    [ #################### ] 16.651s | Erase file - Done erasing
    [ #################### ] 1.616s | Program file - Done programming
    [ #################### ] 1.649s | Verify file - Done verifying
    [ #################### ] 0.257s | Erase file - Done erasing
    [ #################### ] 0.046s | Program file - Done programming
    [ #################### ] 0.029s | Verify file - Done verifying
    Applying pin reset.
    -- runners.nrfjprog: Board with serial number 1050727688 flashed successfully.
    THE BOTTOM LINE QUESTIONS ARE:
    A. Why does the method in (1.) above erase both cores? Is there any way to only erase the core that I want to program/update?
    B. I can get it to work with a BLE app on the Network core and the "empty_app" on the Application Core. However, in the future I will have a full blow app running on the Application core (with SPI and QSPI, etc), and I will need to erase and program the two cores separately and individually. How will I be able to do that?
    Please let me know. Thank you.
    Cheers,
    Gil
Children
  • Hi Gil,

    I am using VSCode and nCS v2.3.0.

    I tested it again by flashing just one core at a time. You can see below I am not getting that problem.

    Are you recovering your DK using --recover? In such a case I guess both cores are erased.

    I also tested with Programmer from nRF Connect for Desktop.

    I am able to select both hex files and program at the same time.

  • Hi Naeem,

    Ok. Good progress.

    1) Yes, the command line has a "--recover" switch but it's the default for the project. I haven't changed or added anything. Where do I edit that command line to remove the "--recover"?

    Flashing build_peripheral_uart to 1050727688
    west flash -d c:\ncs\myapps\peripheral_uart\peripheral_uart\build_peripheral_uart --skip-rebuild -r nrfjprog --dev-id 1050727688 --recover

    2) Great. I will also try the Programmer from nRF Connect for Desktop. I'm sure that will work. Slight smile

    Thanks.

    Gil

  • You can directly run the west command in the nrf terminal as well.

    Also, I think tasks could be binded with actions but I am not sure how.

  • Hi Gil, I am trying also to get a complete bluetooth example, peripheral_uart preferred, running on the net core only, leaving the app core for my own application with no bluetooth stack. In this post you said "B. I can get it to work with a BLE app on the Network core and the "empty_app" on the Application Core.". How did you get it to work? I have tried to build the peripheral_uart example with the nRF5340 network mcu as the target, and while it does advertise, I cannot connect (testing with lightblue). The default configuration for the peripheral_uart example is to put half of it in the network core, but still run half the bluetooth part in the application core. How did you get it to run both controller and host in the net core? Any help from support much appreciated!

Related