I need a bootloader that I can use for my application that doesn't use a soft device and allows the firmware to be transferred through uart. Going through the forums, I found a reference to a bootloader that does what I needed. That package is nrf51822_v4.4 - Bootloader_Without_SD.zip. I downloaded and installed that package and with a little effort, I was able to get the bootloader to work. That same package included the following executable:
<path>/nrf51822_v4.4_Bootloader_Without_SD/Board/nrf6310/device_firmware_updates/experimental/hci_dfu_send_hex/hci_dfu_send_hex.exe
This executable is built to be ran on a Windows machine. When using this executable on a Windows machine, it is a very simple mater to set up the bootloader to load the application and then run this program to transfer the file. Everything works as it should. Very nice job!
Now for my problem. I will need to be able to load the new firmware from an embedded system and therefore, hci_dfu_send_hex.exe is not an option. I tried downloading and running nrfutil version 0.5.2 as directed in multiple documents on this site, but it is a very different program than hci_dfu_send_hex.exe. It is also not directly compatible with the bootloader and fails if you try to use it with this bootloader. I tracked down the first issue to being a different enumerated value for the Packet Identifiers. Here is how they are defined in dfu_types.h that's being used by the bootloader:
#define INVALID_PACKET 0x00 /**< Invalid packet identifies. */ #define INIT_PACKET 0x01 /**< Packet identifies for initialization packet. */ #define START_DATA_PACKET 0x02 /**< Packet identifies for the Data Start Packet. */ #define DATA_PACKET 0x03 /**< Packet identifies for a Data Packet. */ #define STOP_DATA_PACKET 0x04 /**< Packet identifies for the Data Stop Packet. */
But according to the information that I found in the Serial (HCI) packet format document on this site, they should be defined as:
#define INVALID_PACKET 0x00 /**< Invalid packet identifies. */
#define INIT_PACKET 0x01 /**< Packet identifies for initialization packet. */
#define START_DATA_PACKET 0x03 /**< Packet identifies for the Data Start Packet. */
#define DATA_PACKET 0x04 /**< Packet identifies for a Data Packet. */
#define STOP_DATA_PACKET 0x05 /**< Packet identifies for the Data Stop Packet. */
After making this change to my bootloader, nrfutil now runs through, but fails at the end with the following error:
<path>\nrfutil\pc-nrfutil>python .\nordicsemi\__main__.py dfu serial --package <path>\examples\peripheral\blinky\pca10031\blank\arm5_no_packs\_build\nrf51422_xxac.zip --port COM4 --baudrate 38400
Upgrading target on COM4 with DFU package <path>\examples\peripheral\blinky\pca10031\blank\arm5_no_packs\_build\nrf51422_xxac.zip. Flow control is disabled.
[####################################] 100% Timed out waiting for acknowledgement from device.
Failed to upgrade target. Error is: No data received on serial port. Not able to proceed.
Possible causes:
- bootloader, SoftDevice or application on target does not match the requirements in the DFU package.
- baud rate or flow control is not the same as in the target bootloader.
- target is not in DFU mode. If using the SDK examples, press Button 4 and RESET and release both to enter DFU mode.
So this tells me that there's something that nrfutil is expecting the bootloader to return but the bootloader is failing to do so given that is wasn't written to be compatible with nrftutil.
So what I would like to know is, is the source code for hci_dfu_send_hex.exe available? Having that source code which is compatible with the SDK v4.4 bootloader will make my porting task much simpler.
Thanks in advance...