Hi all,
Edit 25 Dec '15: Rewrote post for better readability:
I am trying to modify the dual bank DFU bootloader example to work on our custom board that uses a nRF51822QFAA chip. So far it has not worked at all. Could someone please help giving me an idea on what I am missing/doing wrong?
I am using Keil uVision5 and nRF51 SDK v10.0.0
I will update this post with the fixing progress below.
Many thanks.
At the point I started this question, I had tried the following:
-
Removing/Modifying all codes that work with buttons and LEDs because our board does not use the same buttons and LEDs.
-
Modify SOFTDEVICE_HANDLER_INIT from using NRF_CLOCK_LFCLKSRC_XTAL_20_PPM to using NRF_CLOCK_LFCLKSRC_RC_250_PPM_4000MS_CALIBRATION because our board does not support external oscillator to the chip
-
Change target to nRF51822xxAA and restore memory settings to the same as the original dual bank DFU example
With these changes, the project compiled. However once flashed, the chip doesn't work. It does not show up on Bluetooth scan and debugging shows that it is stuck in HARDFAULT_HANDLER from reset.
Edit 24 Dec '15:
Upon suggestion by Lalit Kumar in the comments and this Q&A, I changed the memory settings to:
- IRAM1: Start 0x20002000 OR 0x20002C00 - Size 0x1380
- IRAM2: Start 0x20003F80 - Size 0x80 - NoInit
The project now fails to compile with the following two errors:
- ._build\nrf51422_xxac.axf: Error: L6406E: No space in execution regions with .ANY selector matching arm_startup_nrf51.o(STACK).
- ._build\nrf51422_xxac.axf: Error: L6407E: Sections of aggregate size 0x800 bytes could not fit into .ANY selector(s).
** - The project attachment is at this state -
Edit 24 Dec '15 #2:
I found this Q&A and attempted to follow Mathias's solution but with Stack_Size of 256 instead. The project now compiled and the bootloader firmware run in debug mode. However, the chip still doesn't show up on Bluetooth scan, and debugging shows that firmware flow is stuck in an infinite loop between a ble_stack_init() call and a bootloader_dfu_start() call.
Edit 25 Dec '15:
Lalit Kumar, in the comments below, has found that keeping the project target as nRF51422xxAC but modify the memory settings help with compiling the DFU bootloader without having to use Mathias's stack size hack. However, with this settings, the firmware runs when flashed on Lalit's custom board but it doesn't run on ours.
Attachments:
24/12 - Original main.c attachment upon requested by shubham: main.c
24/12 - Screenshot of memory settings and compile error: dfu_compile_error_151224.PNG
25/12 - Entire Keil project without trying Mathias's solution: dfu_bootloader_51822.zip