BLE/UART OTA DFU on RAK4631

I see that BLE OTA DFU mechanism is available for RAK4631. Instead of using the BLE layer, I am developing a process to do the DFU using UART.

My approach would be to store the new image file on my modem’s (RAK2011 - BG96) storage and then to mimic whatever process BLE layer is doing to write to the memory of NRF chip (RAK4631).

However, in the the Bluefruit52Lib library, I don’t see the chip memory being exposed directly to the incoming BLE packets for DFU. All I see are supervisor calls that are using data fetched from BLE GATTS and in turn , maybe writing to the memory banks of the chip.

Therefore, I wanted to ask if I can directly write my image file to the memory banks and is my approach possible while remaining within the constraints of PlatformIO (and not involving the NRF SDK).

Hello @rommel
The BLE OTA DFU functions are handled directly in the bootloader and softdevice of the nRF52 and there is little possibility to change anything there.

If you want to do the DFU over UART, a better solution could be to look into the nrfutil source codes. The sources for the nrfutil app are available on Github

Thanks. I see that the source code is handling the firmware update on serial layer. Similar source code (image attached) is also part of the NRF SDK.

image

Which again takes me to the question whether I can integrate those SDK modules in my PlatformIO development environment.(which is using arduino as a framework)

As far as I know:
The Adafruit BSP is not using the full SDK, instead they are using something called nrfx which seems to be a kind of wrapper around the SDK functions.
Everything related to the SDK is in the nordic folder inside the BSP package : .platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5

I never went down that deep into the SDK because usually it is not necessary.

Yeah, that’s correct. That modified part of SDK (nrfx) mainly contains peripheral drivers and not the whole SDK. Issues have been posted to make the full SDK available as a framework on platformIO. No progress yet.

@beegee. In general, how are your customers managing their OTA updates ? Isn’t BLE update mechanism a little inconvenient for field devices ?

Does WisBlock plan on developing truly wireless OTA in the near future ?
Thanks.

I do not have much feedback about it.

Commercial customers often do not want OTA DFU because of the risks (fake firmware downloaded to remote devices).

Otherwise BLE OTA DFU is what I use most, specially if the device is in an IP65 enclosure and I do not want to open it for the update. It is very convenient for me.

What do you mean with truly wireless OTA? I do not understand that. BLE DFU is as wireless as it can get.

Does WisBlock plan on developing truly wireless OTA in the near future ?

You may ignore this question. I asked it out of my naivety.

Earlier you said that :

The BLE OTA DFU functions are handled directly in the bootloader and softdevice of the nRF52 and there is little possibility to change anything there.

Is this the limitation of adafruit nrf core’s handling of the bootloader part or is it the way it was developed by NRF ?

You might get an answer from Adafruit about this. We are just using their BSP and make it matching to our RAK4631.

@beegee
Could you point out which one of these bootloader binaries provided by Adafruit nRF52 core is being used for RAK-4631 ? I am assuming it’s “pca10056” or is it a further modified form of it ?

None of them.

Our bootloader is slightly changed to match with RAK4631. You can find the binaries and the sources in our WisBlock repo WisBlock/bootloader/RAK4630 at master · RAKWireless/WisBlock · GitHub

Is the source code of the original bootloader, the one that you modified for RAK4631, available ?

It is right there in the repo: WisBlock/bootloader/RAK4630/V0.4.2/WisCore_RAK4631_Bootloader at master · RAKWireless/WisBlock · GitHub

Yes, that I am able to see. But it’s the one modified for RAK4631, I was asking for the original source (Adafruit bootloader) of this modified RAK bootloader.

Somewhere in Github, try searching in Adafruits repos.

Here is the Adafruit nRF52 core repository , but it only contains the binaries in the bootloader section and not the source code :

Though I’ll look for other sources as well.

Found it here :