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?

Reply Children
  • 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.

  • It is simpler to just program them separately most of the time

    Agreed.

    Re-programming the Bootloader and/or SoftDevice every time is just a waste of time.

    It is better to keep the number of unknowns as low as possible in the beginning

    Absolutely!

    And, for that reason, I would suggest starting with the examples which don't even use a SoftDevice (ie, no BLE).

  • Yes, I agreed that it is a waste of time.

    But, for one-time programming, it is necessary. After that only application image, we need to load into the board.

    By the way, at the starting phase, all this stuff is a little bit confusing for me.

    I found a way to burn the program into NRF52840-DK by using SEGGER J-Flash Lite 6.48 and attached screen-shot of it.

    This is a proper way to do it? I think it will be better to have a proper download tool for flashing the images. Because it is a very tricky one for the beginner to understand it. I hope NRF will lunch the new tool for nrf52840-DK like nrfGo studio.

  • AP040 said:
    This is a proper way to do it?

     That is one way of doing it. There is no proper way per se, as there is a number of different tools that all do the job.

    AP040 said:
    I think it will be better to have a proper download tool for flashing the images. Because it is a very tricky one for the beginner to understand it. I hope NRF will lunch the new tool for nrf52840-DK like nrfGo studio.

    We have. That is the nRF Connect Programmer app that you have been trying, In my opinion, nRF Connect Programmer is more userfriendly, especially since it shows you the memory map of the hex files you have added and the target. So you can easily see how everything fits together. There is, of course, a need to understand the memory layout for it to make sense, but that is something you need to understand when you develop for a uC.

  • We have. That is the nRF Connect Programmer app that you have been trying, In my opinion, nRF Connect Programmer is more userfriendly, especially since it shows you the memory map of the hex files you have added and the target. So you can easily see how everything fits together. There is, of course, a need to understand the memory layout for it to make sense, but that is something you need to understand when you develop for a uC.

    Yes, it is a better tool to do it but as you know the problem I am facing to load only application image. Please give me the solution to do it.

Related