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

Issue with serial DFU on NRF52

Hi All,

I am trying to get the serial DFU working with nRF52832 development kit with SDK 13. I am able to get the bootloader flashed and have installed the nrfUtil tool. I followed the exact sequence of the steps mentioned here and got it right until the final step where I am trying to sent the application image to the device. The image transfer doesn't progress from 0% and it finally fails with the below logs: image description

I did some debugging and found that in the "on_packet_received" function, the device is getting an invalid opcode and so its responding with an error. I also tried disabling the HFC in device and the nrfutil tool as mentioned in this thread with no success. Finally I also tried changing the UART Tx/Rx pins to to P[0].3 and P[0].4 with no improvements.

Please let me know if you have some pointers which would help me in debugging this.

  • Updating few more observation from the debugging done after this post:- When I put a break point on on_rx_complete in the uart_event_handler, I see that the number of bytes received is 1 and its value is 'C0' which as per Serial (HCI) should be SLIP start/stop. But I dont see the remaining bytes of the Start packet coming. I am sure DFU serial works for other so could this be an issue with the nrfUtil tool? I followed the steps in this link [link text] (infocenter.nordicsemi.com/index.jsp for its installation.

  • Hi Siva,

    Could you check which nrfutil version do you have make sure you have version 3.x.

    You can download the latest nrfutil.exe here.

    Have you modified anything on the bootloader ? If you simply test UART with a normal application does it work ?

  • Hi Hung,

    I have tried with the latest version of the nrfutil-3.2 . But still its the same result. I have not done any code changes in the bootloader. I just compiled the micro-ecc and created a new publickey.c file. I am able to flash and the bootloader is waiting in the wait_for_event function. As I have mentioned, it doesn't seem to sent the full dfu packet from the host.

    I am able to get the UART logs and I got most of the example applications working in my setup except this serial bootloader. Please let me know if you need any further information.

  • Hi Hung, I have some interesting observations. Before coming to that, the good news is I am able to get the serial boot loader working. Until now I was using the keil to flash my serial bootloader binaries. In the "Flash Download" settings in Keil, I had opted for a full flash erase before the programming operation to simulate a bare flash scenario coming out of production. I was struggling to get the serial boot loader work with this setup.

    Now I switched to nRFGo for the first time. I did the exact same procedure of "erase all" and then program the bootloader. Even this didn't seem to work. Then just my the stroke of luck I happened to program the SD after an "erase all" and then program the bootloader. Bingo, It started working now and I was able to perform serial DFU. Until then or even now I dont understand the need of the SD for bootloader to work? Continuing below..

  • So now I did a "erase all" in nRFGO, programmed the SD from it (nRFGo) and then did a full flash erase in keil and programmed the bootloader (from keil) to check the behavior. Surprisingly that too worked. In the keil debugger the address range set for the flash is 0x0 - 0x7FFFF which is the entire flash memory range of nrf52. So clearly there is something which the keil is not able to do in a full flash erase but the nrfGo can do. Because if the keil did a full flash erase like the nrfGo tool does the "erase all" then I wouldn't have got that working. In other words there is something which the nrfGo tool writes which is required by the bootloader and can't be deleted by an IDE like keil even if you try to erase the entire flash. Is there some kind of vector table which is required an inaccessible to keil? Sorry for the long comments. Let me know if you need more clarification.

Related