Hi there,
I am working with an application that uses the NRF51 chip (through the Taiyo Yuden EYSGCNZWY BLE module) and am trying to implement buttonless DFU. I am having issues starting DFU when enabling through the Legacy DFU Service from the application. The application thus far is functional without the DFU feature using SDK9.
Setup details:
- S110 softdevice
- BLE module EYSGCNZWY using NRF51822_xxAC
- SDK 9.0.0
- Bootloader in Keil
- Application in Segger Embedded Studio v5.44
Application was modified to include DFU features from example project ble_app_hrs_s110_with_dfu_pca10028 from Keil. When simply using the ble_app_hrs_s110_with_dfu_pca10028 project the buttonless DFU works without an issue. The Legacy DFU Service comes up correctly on nrf Connect and The application is based on the HID desktop_keyboard example, and requires the central to pair with the device upon connection. The function 'bootloader_start' in 'dfu_app_handler' is used to re-enter bootloader upon receiving a BLE_DFU_START event from the DFU service. What I have noticed is the GPREGRET register (which is set to 0xB1 before jumping to bootloader) is not set to 0xB1 when the bootloader starts (found by debugging the bootloader). It shows 0x04 as its value, and thus tries to jump back into the application. At that point the application does not start up correctly (and the DFU times out). See attached for the DFU log messages as well.
The application was likely imported to SES from a Keil project (before my time) and includes the "Internal Files" 'flash_placement.xml', 'ses_nrf51_startup.s', 'thumb_crt0.s' and 'system_nrf51.c'. I have attached these files. I also tried replacing them with what I could find from SDK 12 (this link) but there was a build error: 'undefined reference to __SRAM_segment_end__'.
The application Linker relevant settings are:
Memory Segments: FLASH RX 0x00000000 0x00040000; RAM RWX 0x200000000 0x00008000
Section Placement File: flash_placement.xml
Section Placement Macros: FLASH_START=0x18000; FLASH_SIZE=0x24000; SRAM_START=0x20002000; SRAM_SIZE=0x2000
The sequence of events is as follows:
- After erasing chip, the S110 softdevice and bootloader are loaded to the device successfully. The bootloader is a slightly modified version of the dual_bank_ble_s110 project from SDK 9. The minor changes to the bootloader include changing clock frequency for compatibility with the EYSGCNZWY module, replacing dfu_dual_bank.c with dfu_single_bank.c and removal of button for entering DFU. The bootloader is built in Keil. Memory map is as follows:
IROM1: Start->0x3C000, Size->0x3C00
IRAM1: Start->0x20002000, Size->0x3F80
IRAM2 (NoInit): Start->0x20005F80, Size->0x80 - Once S110 and bootloader are loaded to device, it starts advertising as DfuTarg. Using nRF Connect I am able to connect to DfuTarg and upload the application successfully.
- From nRF connect I re-connect to the device (now advertising with the application specific device name), and the device asks to pair the device. Once device pairing is confirmed, the application runs normally (if DFU is not used). If a DFU upload is initiated from nRF connect the process starts, jumps to the bootloader, then restarts the DFU, jumps to bootloader again, and eventually the connection times out. The nRF connect logs are also attached.
My gut tells me the issue is with the memory placements of the application and bootloader and their interaction, but I'm really not sure about the solution or what to try next. Any debugging support would be greatly appreciated!




