This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Programming the nRF52840-DK

I am new to the NRF52840-DK. To burn the program into the kit, I have lots of tries to install nrfGo studio but it gives me the "no board detected readback protection" error. So, I installed nRF Connect v3.0.0 PC tool and add programmer app.

By using this app, I am able to load the program into the board.

Here, my concern is that when I am loading the pre-compiled .hex file given by Nodic, it has included three memory region- MBR or Application, SoftDevice, and Application.

Now, I have made little change in the code and compiled my project which is generated .hex file. When I tried to load this file, it has shown me only the Application region and When I am loading this by doing "Erase and Write" option in the tool it is not working.

There is one option in the tool for only "Write" but it is not enabled.

What should I do here? If we only want to load application image what we do here? Like we have the option in nRFgo studio for selection Application, Boot-loader, and SofDevice.

Parents
  • Hi,

    I am new to the NRF52840-DK. To burn the program into the kit, I have lots of tries to install nrfGo studio but it gives me the "no board detected readback protection" error. So, I installed nRF Connect v3.0.0 PC tool and add programmer app.

    nRFgo Studio is legacy software that does not support nRF52840. Going with nRF Connect Programmer is the most sense if you want a stand-alone GUI programming interface.

    Here, my concern is that when I am loading the pre-compiled .hex file given by Nodic, it has included three memory region- MBR or Application, SoftDevice, and Application.

    Now, I have made little change in the code and compiled my project which is generated .hex file. When I tried to load this file, it has shown me only the Application region and When I am loading this by doing "Erase and Write" option in the tool it is not working.

    The .hex file generated by your toolchain when you build the application will always only contain the application only (or the bootloader only if you compiled the bootloader project). The reason the example .hex files contain both SoftDevice (including MBR) and application is that the SoftDevice .hex file and application hex files have been merged using the mergehex tool before being shipped. So in this case you have to program both the SoftDevice and application .hex. This can be done in several ways, for example by adding both hex files before programming using the nRF Connect Programmer app.

    Now, I have made little change in the code and compiled my project which is generated .hex file. When I tried to load this file, it has shown me only the Application region and When I am loading this by doing "Erase and Write" option in the tool it is not working.

    This is expected. The .hex file contains only the application, and the "Erase &write" option will erase all flash in the chip before programming the selected .hex file(s). Since you only have selected the application it is the only thing that will be programmed. This will not work since it depends on the SoftDevice.

    There is one option in the tool for only "Write" but it is not enabled.

    The "Write" button is enabled if you have read the device flash content and the current content does not overlap with the selected .hex file(s). If they overlap, the only option is to erase before writing.

    What should I do here? If we only want to load application image what we do here? Like we have the option in nRFgo studio for selection Application, Boot-loader, and SofDevice.

    Fron nRF Connect the only option is to add both the SoftDevice and the application .hex files (either at the same time or program them one after the other, since they do not overlap). Alternatively, you can merge the hex files, but that is just a waste of time in my opinion. A simpler approach is to use the IDE as suggests, or just use nrfjprog on the command line together with the --sectorerase option. This will make the tool erase only the sectors that you are writing to, keeping the SoftDevice pages etc. untouched.

  • The "Write" button is enabled if you have read the device flash content and the current content does not overlap with the selected .hex file(s). If they overlap, the only option is to erase before writing.

    I tried this but not working. How it does not overlap the section?

    If I want to merge the bootloader and softdevice where I can get those .hex files?

    A simpler approach is to use the IDE as suggests,

    I am using the IAR Workbench. How I did the programming into the NRF52840? Can you give step by step guidance?

  • I am using the IAR Workbench

    Not so many people here use IAR.

    Have you checked the documentation, and/or contacted IAR for support?

    Most IDEs have the facility to run some custom  stuff at the end of the build - you could use this to merge your hex files ...

    https://infocenter.nordicsemi.com/topic/ug_nrf5x_cltools/UG/cltools/nrf5x_mergehex.html

  • Thanks for the information about the mergehex files. But, How I am getting the Bootloader and softdevice file to merge with the application?

  • It is simpler to just program them separately most of the time. But if you want to merge the hex files for some reason, then mergehex is a good tool. It is part of nRF Command Line Tools.

    One additional point: you mention the bootloader, but since you are clearly just starting to get familiar with the nRF ecosystem I suggest you wait a few days with DFU and bootloader, as that tends to complicate things a bit. It is better to keep the number of unknowns as low as possible in the beginning.

  • AP040 said:
    I tried this but not working. How it does not overlap the section?

    If you try to program something to a flash page that already has some content (anything other than ff's), that means it overlaps. Similarly, if you try to merge two hex files that have data in the same region there is an overlap. This will not work.

    AP040 said:
    If I want to merge the bootloader and softdevice where I can get those .hex files?

    The S140 SoftDevice .hex file can be found under <SDK>\components\softdevice\s140\hex\. The application .hex file is produced by your toolchain/IDE and the location depends on the IDE and how it is configured, but it will typically be in a subfolder relative to the project file(s).

    AP040 said:
    I am using the IAR Workbench. How I did the programming into the NRF52840? Can you give step by step guidance?

    If you use an example IAR project you can choose to download the file to the target directly in IAR, or chose to debug it. In that case, it will be programmed first. However, you also need to remember to program the SoftDevice, as this is not done automatically. You can do this using nrfjprog, nRF Connect Programmer or any other method you prefer. Alternatively, you can use SES as suggested by , as this will program the SoftDevice for you automatically.

Reply
  • AP040 said:
    I tried this but not working. How it does not overlap the section?

    If you try to program something to a flash page that already has some content (anything other than ff's), that means it overlaps. Similarly, if you try to merge two hex files that have data in the same region there is an overlap. This will not work.

    AP040 said:
    If I want to merge the bootloader and softdevice where I can get those .hex files?

    The S140 SoftDevice .hex file can be found under <SDK>\components\softdevice\s140\hex\. The application .hex file is produced by your toolchain/IDE and the location depends on the IDE and how it is configured, but it will typically be in a subfolder relative to the project file(s).

    AP040 said:
    I am using the IAR Workbench. How I did the programming into the NRF52840? Can you give step by step guidance?

    If you use an example IAR project you can choose to download the file to the target directly in IAR, or chose to debug it. In that case, it will be programmed first. However, you also need to remember to program the SoftDevice, as this is not done automatically. You can do this using nrfjprog, nRF Connect Programmer or any other method you prefer. Alternatively, you can use SES as suggested by , as this will program the SoftDevice for you automatically.

Children
No Data
Related