Flashing a nRF52840 dongle with a modified nRF52840 MDK


#1

Hi,

I managed to make one of my nRF52840 dongles unresponsive, by flashing some (probably corrupt) hex file onto it. I assume that the bootloader was overwritten. I used Nordic’s ‘connect’ to program it. It simply does not turn up as a /dev/ttyACM0 when plugging it in, while holding the reset button. BTW, I’m on Linux, and have no access to OSX or Windows.

I also own a nRF52840 MDK. After carefully studying the MDK, and the dongle’s schematics, I thought that it would be quite possible to program the dongle with the MDK, after making a very small modification to the MDK. The modification is to simply remove R9 (the 1 Ohm resister), though which the MDK’s nrf chip gets its 3V3 (VDD_NRF). I then connected the dongle to the MDK, as follows:

MDK          -> Dongle
J4, pin1 -> con10, pin1 (VDD_3V3A)
J4, pin2 -> con10, pin2 (GND)
J4, pin3 -> con10, pin3 (TGT_NRESET)
J4, pin4 -> con10, pin4 (TGT_WSCLK_TK)
J4, pin5 -> con10, pin5 (TGT_WSDIO_TMS)
J4, pin8 -> con10, pin20 (TGT_TXD)
J4, pin9 -> con10, pin19 (TGT_RXD)

Before the mod I could flash the non-SD, pre-compiled blinky_nrf52840_mdk.hex, directly from the git repo to the MDK. Here’s the command:

pyocd flash -d debug -t nrf52 -e sector ./examples/nrf5-sdk/blinky/hex/blinky_nrf52840_mdk.hex

After the R9 removal mod, I made connected the MDK and the dongle, as described above and used the exact same command to try and program it. Obviously it did not work. I noticed that the RED led (P0.23) was blinking very faintly on the MDK. This is very strange, as according to the schematic, the nrf should not have power.

I then disconnected TGT_TXD and TGT_RXD, as it should be possible to program it without these two. Again, the RED (P0.23) was blinking very faintly. So I assume that the nrf chip on the MDK gets power from somewhere to run… I also kept the MDK’s reset button down, while programming it, but this also made no difference.

Is there someone with a great idea, or some way to re-program a corrupt dongle’s bootloader?

I forgot to mention that I could undo the mod on the MDK and it worked as expected, so at least no damage to the MDK.

A radical idea would be to short VDD_NRF on the MDK to ground, but I fear that this might cause some smoke from my MDK, given the fact that its RED led shows signs of power. Any ideas?

Any help or hint will be much appreciated.


#2

Hi,
There is an ESD shottky diode on the IO pin of nRF52840. Hence if you remove the R9(VDD_NRF = GND), the internal diode will start to conduct when setting the IO pin to HIGH. Because nRF52840 is very low power, it will be powered up again.

There is another way you can program another nRF52 chip using nRF52840-MDK without any hardware modifications.
It needs to change the DAPLink firmware on MDK. The following steps will show you how to do that:

  1. Update the custom DAPLink firmware: lpc11u35_nrf52840_mdk_custom_if_crc_0251.bin. Here is the tutorial showing how to update the DAPLink firmware: https://wiki.makerdiary.com/nrf52840-mdk/daplink/#how-to-update-the-daplink-firmware

  2. Connect the dongle to nRF52840-MDK . Adapt to the following connections:

    nRF52840-MDK nRF52840 Dongle
    3V3 3V3
    GND GND
    RST RST
    TDO(J4, pin6) SWDCLK (con10, pin4)
    TDI(J4, pin7) SWDIO (con10, pin5)

Now you can program the dongle using MDK. If you want to program the nRF52840-MDK again, you NEED to recovery the origin DAPLink firmware.
The origin DAPLink firmware is located at GitHub: https://github.com/makerdiary/nrf52840-mdk/tree/master/firmware/daplink
That’s it! If you have any questions, feel free to reach out any time.

Best,
Zelin


#3

Hi Zelin,

Thanks for your quick and thorough response.

I am still surprised that the NRF chip ran with the power coming through the shotkeys. This is amazing. Any way, at least the mystery on why TDO and TDI was broken out is now solved for me.

I’ll let you know when and if I get everything programmed again.

Thanks again for the help.
Regards
wingunder


#4

Hi Zelin,

Thank you very much, your advice was spot on and I could flash the custom bin to my mdk and recovered my dongle. I could also get my mdk back to programming itself again.

I would like to do a small write-up on this procedure, but I’d rather stick it into a pull request for the mdk git repo. This way the developer community can read and correct it. Will you be interested in something like this?

One last thing: Would it be possible for you to add the lpc11u35_nrf52840_mdk_custom_if_crc_0251.bin file to the mdk git repo as well? This way all the firmware will be in one place.

Regards
wingunder


#5

Well done! :tada:
Pull requests are always welcome. We will appreciate it.
BTW, I will add the custom bin to the github repo soon. Thanks for your advice.