This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

App does not work via DFU

I have a nRF51822 device which has softdevice and bootloader. And I'm trying upload my app with following steps:

  1. make .bin file with gcc
  2. Push the DFU button, and entering DFU mode. (Seen as DfuTarg)
  3. Upload bin file via iOS nRF Loader.
  4. The upload completed successfully.
  5. My app does not run.

Therefore, I have a question. Are there any special code or special settings for DFU on the app code side? Thanks in advance.

  • Hi Joe,

    I was able to connect to the custom board with JLink LITE. And, I'm trying to rewrite soft device/bootloader built with pure-gcc (following your tutorial, thank you)

    But the bootloader code did not locate in the flash sector "3A000h". > J-Link>mem 10001000 20 > 10001000 = 00 40 01 00 FF FF FF FF FF FF FF FF FF FF FF FF > 10001010 = 49 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF

    I'm using your makefile and "LINKER_SCRIPT := ../gcc_nrf51_s110_bootloader.ld" from BleblGcc-V2. I'd appreciate it if you could give some advice for flashing bootloader with pure-gcc. Thanks in advance.

  • The flash.jlink script seems trying to flash correct address, though.

    r loadbin _build/ble_bootloader_s110.bin 0003a000 r g exit

  • Your 10001000 memory dump just shows you the Uicr register. You sould

    After "make erase-all" it should be all FF. After "make flash-softdevice" we see the "00 40 01 00" and the "49 00". > mem 10001000 20 > 10001000 = 00 40 01 00 FF FF FF FF FF FF FF FF FF FF FF FF > 10001010 = 49 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF

    Now, you have to write the address of your bootloader code to 10001014, so that you got e.g.: > mem 10001000 20 > 10001000 = 00 40 01 00 FF FF FF FF FF FF FF FF FF FF FF FF > 10001010 = 49 00 FF FF 00 A0 03 00 FF FF FF FF FF FF FF FF

    My workaround to set up UICR for my needs is a patch in pure-gcc Makefile.posix where I add the following to the target flash-softdevice.jlink: printf "\x00\xA0\x03\x00" >$(OUTPUT_PATH)uicr_bl.bin loadbin "$(OUTPUT_PATH)uicr_bl.bin" 0x10001014\n The "loadbin..." part has to be inserted into the printf line, e.g before "r\ng\nexit\n".

    Finally it looks like this:

    flash-softdevice.jlink: # UICR of our bootloader located at 0003A000 printf "\x00\xA0\x03\x00" >$(OUTPUT_PATH)uicr_bl.bin # Write to NVMC to enable write. Write mainpart, write UICR. Assumes device is erased. printf "w4 4001e504 1\n loadbin "$(SOFTDEVICE_OUTPUT:.hex=_mainpart.bin)" 0\n loadbin "$(SOFTDEVICE_OUTPUT:.hex=_uicr.bin)" 0x10001000\n loadbin "$(OUTPUT_PATH)uicr_bl.bin" 0x10001014\n r\n g\n exit\n" > flash-softdevice.jlink

    Well I know, that it is a little hacky to write the bootloader related UICR part during "make flash-softdevice". This should be better performed when flashing the bootloader itself and should automatically choose the bootloaders address. But that needs a bit more work inside the makefiles.

  • Thank you so much for your detail comment, Joe. I understood your workaround to setup UICR.

    Actually, I could flash and run my bootloader and app with Nordic Windows tools. So, I will try it with pure-gcc environment in MacOSX.

    Thank you.

Related