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

DFU OTA issue on NRF51822AA

I'm trying to implement DFU-OTA (Bluetooth transport) for our custom board and currently i'm facing problems in flashing the different elements (softdevice, bootloader, application). I think It's mostly a setup problem.

configuration:

  1. Hardware: NRF51822QFAA (256KB flash)
  2. Softdevice version: s110, v7.1.0
  3. nRFGo studio for flashing: v1.18.0.9
  4. Bootloader sample code: From SDK v6.1.0 (nrf51_sdk_v6_1_0_b2ec2e6)
  5. Custom application: total size of application (around 30kB)
  6. IDE: Keil uVision 5.14

To build bootloader, I've used the sample bootloader (without any modification at the moment, except some include path changes for linking). The bootloader builds fine and I use nRFGo Studio to flash the three elements (softdevice, bootloader and the application). I'm able to successfully flash all the three but when i do the verification of our application using "verify" tab in nRFGo studio, it says "Verification failed". Our custom board also has a LED that turns "ON", when there is some issue with the NRF51822QFAA. I do not know the workings of this feature yet, but the point is that i'm very much sure that there is some problem (maybe one being overwritten or being only written only partially).while flashing these three components

I'm attaching the memory ranges snapshot below, which I see in the Keil uVision for bootloader and our application. Please suggest.

memory layout for bootloder: image description

memory layout for our application: image description

Thank you for your help.

  • If you're flashing all three parts using Jlink, it won't work as is. When starts, bootloader checks BANK_VALID_APP variable that is not set in your case. You have few options:

    1. Flash SD and bootloader, and write your app over DFU - bootloader will handle BANK_VALID_APP for you.

    2. After flashing SD, bootloader and the app, manually program BANK_VALID_APP to 0x01

    3. Flash SD and your app only. Your app will start, but DFU obviously won't work without the bootloader.

    More details: devzone.nordicsemi.com/.../

  • Thank you Pektusin, While I go through the link that you have mentioned, I'd like to inform you that, meanwhile I also tried to use "nrfjprog.exe" to program the bootloader (In Keil uVision, selected by "Project -> option for Target XYZ -> Utilities -> Use External tool for flash programming"), SD using nRFGo Studio and the application again using KEIL uVision but, without using any external tool for flashing, but the result was same :(

  • I tried option 2:

    • Flash SD using nRFGo Studio (v1.18.0.9)

    • Flash Bootloader using nrfjprog.exe

    • Flash the application using KEIL uVision (no external flash utility)

    • Program BANK_VALID_APP(nrfjprog.exe --memwr 0x0003fc00 --val 0x1) to 0x01

    • Restarted our custom board

    Now the application is running fine. So far so good. Now when I tried to use nRF Toolbox Application for Android cellphones for DFU-OTA (there is a DFU profile in nRF toolbox application), It asked for .hex and .dat file. I selected "No" for .dat file and the Firmware upgrade failed with Error code (2). According to this thread, .dat file is compulsory for SDK version v7.0 or v7.1, but I'm using SDK v6.1.0 (nrf51_sdk_v6_1_0_b2ec2e6) and Soft device version s110, v7.1.0. Do I still need to use the .dat file.

  • @Pektusin: What stated in nRFToolbox was correct. You don't need init packet for bootloader in SDK v6.1.

    I am testing here with no problem. Which hex file did you use ?

    Could you try with the hex file comes with the nRFToolbox located in NordicSemiconductor\board folder on your phone ?

    Could you install nRFLogger and find the log file of the update process (DEBUG log) and post here ?

  • @Hung Bui: Init packet wtih SDK V6.1 is compulsory (as mentioned in the video here @4:03). In my phone(Android version 4.3), when I try to add the file, I am given only two options; either to use my google drive or Dropbox to locate the file. Probably it's because, I do not have Android version 4.4 on my phone as mentioned in this external link. Meanwhile, I've also installed nRFLogger on my phone, but I'm not sure, how to use it. I also tried to supply a init file to nRFToolbox during application upload (.dat file by following the link I posted before), but I still get the same "DFU File Error (2)" error message. What does this error stands for? This same error I'm getting in nRFToolbox (with or without .dat file).

Related