Any instructions or link I can follow to do this instead of having to use an iOS or Android mobile device with the nRF Connect mobile app?
Any instructions or link I can follow to do this instead of having to use an iOS or Android mobile device with the nRF Connect mobile app?
Hi,
Are you using the nRF5 SDK or the nRF connect SDK? In either case, we do not provide any libraries intended to perform DFU from a PC to integrate in your (potential) custom application, but we do provide some tools intended for development and testing.
If using the nRF5 SDK, you can perform DFU from a computer using nRF Connect Bluetooth LE. You can also use nrfutil for a command line tool. Note that you will need to have a DK or dongle connected to the PC (this does not use any native BLE support or device in the computer).
If using the nRF Connect SDK, you can use mcumgr.
Hi Einar,
I am using nRF5 SDK. I tried nRF Connect BLE to no avail. I connect my J-Link EDU device to the SWD i/f of my nRF52832 custom board and click on SELECT DEVICE in nRF Connect for Desktop Bluetooth Low Energy Standalone v4.0.4. The app shows J-Link + S/N. When I click on it, I get the following output in the log:
Hi Einar,
I may not have been clear in explaining, my apologies for that. So let me try again.
The custom board has SWD support. I can use the iOS or Android nRF Connect mobile app to do DFU over BLE. But that is not desirable for the manufacturer. They require a PC based solution.
The only way I can connect the board to a PC is via a J-Link device, connecting to the board via the SWD i/f and to the PC via USB. The manufacturer can use nRFutil to flash the merged bootloader + softdevice hex file to the board in this setup. But the has to flash the application via nRF Connect for iOS or Android, because using nRFutil to flash a merged bootloader + softdevice + application hex file doesn't work. What am I doing wrong?
Hi,
OK, so in production programming you first flash the bootloader + SoftDevice hex via SWD, then you use DFU via BLE to program the application. Is that correct? May I ask why don ton't also flash the application + bootloader settings page, so that you do all the programming in one go?
Though it seems odd, if you really want to DFU in the application via DFU over BLE from a PC, you need to do as I attempted to describe in my previous post (after first have programmed the bootloader + SoftDevice via SWD). That is to use either nRF Connect Bluetooth Low Energy as described in the documentation DFU over Bluetooth Low Energy, or use nrfutil as described under Updating firmware over the air. Note that in both cases you will need an nRF DK or dongle.
Yes, that's correct. I followed the instructions in the link provided for the bootloader settings page, but can't seem to find the bootloader version in the nrf_dfu_type.h file. See below. A search in the bootloader project itself also turned up nothing.
As for using an nRF DK or dongle, that's not an option as the custom board has only a SWD i/f.
C:\nRF5_SDK_15.3.0_59ac345\components\libraries\bootloader\dfu\nrf_dfu_types.h (9 hits)
Line 70: #define INIT_COMMAND_MAX_SIZE_v1 256 /**< Maximum size of the init command in settings version 1. */
Line 230: #define NRF_DFU_PEER_DATA_LEN 64 /**< The length in bytes of nrf_dfu_peer_data_t expected by tools manipulating the settings page. Do not change without changing the settings page version. */
Line 231: #define NRF_DFU_ADV_NAME_LEN 28 /**< The length in bytes of nrf_dfu_adv_name_t expected by tools manipulating the settings page. Do not change without changing the settings page version. */
Line 306: uint32_t settings_version; /**< Version of the current DFU settings struct layout. */
Line 306: uint32_t settings_version; /**< Version of the current DFU settings struct layout. */
Line 307: uint32_t app_version; /**< Version of the last stored application. */
Line 307: uint32_t app_version; /**< Version of the last stored application. */
Line 308: uint32_t bootloader_version; /**< Version of the last stored bootloader. */
Line 308: uint32_t bootloader_version; /**< Version of the last stored bootloader. */
kishanjsing said:Yes, that's correct. I followed the instructions in the link provided for the bootloader settings page, but can't seem to find the bootloader version in the nrf_dfu_type.h file. See below. A search in the bootloader project itself also turned up nothing.
The bootloader version is a number you pick, versioning your bootloader, and you provide it when you make the bootloader settings page and when you make a DFU oackage (if that contains a new bootloader). So you could start with 1, then 2 if you update it, etc. (That is used primarily for down-grade prevention.)
kishanjsing said:As for using an nRF DK or dongle, that's not an option as the custom board has only a SWD i/f.
Then DFU from a desktop computer is not an option unless you make the DFU master software yourself. I anyway does not seem to make much sense here, as doing production programming over SWD (and programming the whole firmware, not just the bootloader and SoftDevice) makes a lot more sense in production programming in general, where time and reliability is typically essential.
Thanks. Conclusion is then combo of mergehex and nrfutil to program over SWD. I haven't had time yet to investigate if this path works as indicated.
Thanks. Conclusion is then combo of mergehex and nrfutil to program over SWD. I haven't had time yet to investigate if this path works as indicated.
Yes,
You need 4 hex files to begin with:
All these 4 can be combined into a single hex file using mergehex. Then you have a single hex file that you program via SWD in your production programming, and that is it.
Hi Einar,
I was able to successfully follow the steps in the links you pointed to. Thanks for all your help. One suggestion: it will help other novices like myself, tremendously if it is all contained in a single document, such as the one attached here that I wrote up for my reference. Feel free to share it in the blog. This support ticket can be closed.
Hi,
I am glad you got it working. Also, thank you for the feedback and sharing your guide. That is much appreciated.
Einar