Please include the following information, in order for us to help you as effectively as possible.
RAK4631
platformio with arduinoadafruitnrf52-framework
MacOS latest ventura
actual google chrome web-bluetooth api
permanent problem
Here is the link to the article:
https://github.com/WebBluetoothCG/registries/blob/master/gatt_blocklist.txt
UUID blocked: 00001530-1212-efde-1523-785feabcd123
Which is the legacy DFU service without signed firmware packages
You can try it yourself with a simple javascript:
const DFUServiceUUID = "00001530-1212-efde-1523-785feabcd123";
const DFUCharacteristicUUID = {
ControlPoint: "00001531-1212-efde-1523-785feabcd123",
PacketPoint: "00001532-1212-efde-1523-785feabcd123"
};
const button = document.getElementById('btn');
button.addEventListener('click', async () => {
navigator.bluetooth.requestDevice({
filters: [{ services: [DFUServiceUUID] }]
}).then(device => {
console.log('Got device', device.name);
return device.gatt.connect();
}).catch(error => {
console.log('Argh! ' + error);
});
});
So i tried to do a test and implemented basic advertising of the SecureDFU service and characteristics, which then showed up as SecureDFU on the nordic connect app. Question is how to handle the firmware update process on the device if needed then and if there could please be a bootloader available which supports that - or is it already supported?. Would it be possible to have legacy and secure dfu be supported by the bootloader same time? Could you please provide a library, like with the legacy one:
/** OTA DFU service */
BLEDfu ble_dfu;
The Nordic Apps connect and dfu still support legacy mode, so that is fine.
Basic secure dfu ble advertising:
/** Security DFU Service*/
BLEService sec_dfu_service = BLEService(0xFE59);
BLECharacteristic sec_dfu_control_point = BLECharacteristic("0x8EC90001-F315-4F60-9FB8-838830DAEA50", 0x0001);
BLECharacteristic sec_dfu_packet = BLECharacteristic("0x8EC90002-F315-4F60-9FB8-838830DAEA50", 0x0002);
void ble_dfu_control_point_callback(uint16_t conn_hdl, BLECharacteristic *chr, uint8_t *data, uint16_t len);
sec_dfu_packet.setProperties(CHR_PROPS_WRITE_WO_RESP | CHR_PROPS_NOTIFY);
sec_dfu_service.begin();
sec_dfu_control_point.begin();
sec_dfu_packet.begin();
sec_dfu_control_point.setWriteCallback(ble_dfu_control_point_callback);
// must be primary service. advertise first
Bluefruit.Advertising.addService(sett_service);
// callback
void ble_dfu_control_point_callback(uint16_t conn_hdl, BLECharacteristic *chr, uint8_t *data, uint16_t len)
{
(void)conn_hdl;
(void)chr;
(void)data;
(void)len;
Serial.println("ble_dfu_control_point_callback");
// put device in dfu mode and reset
NRF_POWER->GPREGRET = 0xA8;
sd_nvic_SystemReset();
// should be now in dfu mode -> Reconnect ble and write to control and packet point...??
}
My goal is to make a dfu via web-bluetooth and would also like to implement the web-usb version.
Regarding webusb dfu there seems to be problem with the protocolclass on the devices. Interface 0 has class 2 (interrupt) and if1 has class 10. None of the examples out there find a suiteable interface for dfu. If I read the deviceDescriptor I indeed get the right one.
Example from Zephyr: Zephyr
Any guidance here would also be much appreciated.
Thx a lot for feedback!
BR
Rainer