I am attempting to enable DFU over BLE on RAK4630, allowing OTA firmware upgrades without the need to plug in USB cable. I also need BLE UART to communicate with the module remotely.
I have enabled both characteristics in the sketch:
At the beginning of the sketch, I declare the DFU and UART:
#include <arduino.h>
#include <bluefruit.h>
BLEUart bleuart;
BLEDfu bledfu;
// ... [other initialization stuff here ]
void setup()
{
// Configure Bluefruit per DFU and UART examples:
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16,16);
Bluefruit.begin(1, 0);
Bluefruit.setTxPower(4);
Bluefruit.setName("RAKTEST1");
Serial.println("Setting BLE pin to 123456");
Bluefruit.Security.setPIN("123456");
Bluefruit.Periph.setConnectCallback(connect_callback);
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
// Start up both DFU and UART:
bledfu.begin();
bleuart.begin();
// Advertise BLE:
Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
Bluefruit.Advertising.addTxPower();
Bluefruit.Advertising.addName();
Bluefruit.Advertising.restartOnDisconnect(true);
Bluefruit.Advertising.setInterval(32,244);
Bluefruit.Advertising.setFastTimeout(30);
Bluefruit.Advertising.start(0);
//... more setup()...
}
After uploading the sketch via USB port, I remove and re-pair the device on Android smartphone. Then I use Nordic DFU app (latest version) to find the appropriate .ZIP file and begin update.
I get the following:
Bootloader Enabled
DFU initialized
Uploading… 100% (4.9 kB/s)
Completed
It gets stuck at 100% uploading, but never gets to the “Completed” line, and the RAK baseboard has the following lights:
GREEN: flashing fast (not throbbing)
BLUE: slow throbbing (fade in/out)
After removing power to the RAK4630 and re-connecting, it is in DFU mode (different device recognized by Windows, and opens File Explorer to browse immediately).
Update: I tested using the DFU example from Github but it does the same thing. It stops at 100% but never goes to “ Firmware Upload”. If I try to reset the board (press button or pull USB cable) after progress reaches 100%, it boots in DFU mode (Green LED pulsing slow), requiring flash of firmware via USB again.
I have left it for at least 10 minutes after 100% is reached, with no success.
Any ideas on what I did wrong?
Thanks!