板载FR3068可以通过ISP更新程序,如PB10:SWCLK/PB11:SWDIO跳帽插上为DAP方式,拔掉为JLINK方式。但在现场进行程序维护很重要尤其OTA无线升级,FR3068E同样也有自己的一种私有升级协议,具体见examples\common\ota,前面说过components\tools\post_process.py会在flash前8K插入升级信息,AB双备份区升级方式,APP放在8K后,A区信息在0000~1000,B区信息在1000~2000各4K,
升级协议如下:
attribute | UUID | property |
OTA | 02f00000-0000-0000-0000-00000000fe00 | |
TX | 02f00000-0000-0000-0000-00000000ff00 | read |
RX | 02f00000-0000-0000-0000-00000000ff01 | write/write |
Notify | 02f00000-0000-0000-0000-00000000ff02 | notify/read |
Version | 02f00000-0000-0000-0000-00000000ff03 | read |
其中前8K的信息头定义在ota.c:
比如imge_length=0x03a970=234.36K,和电脑文件一致,还可以看出app放在0x2000后,一次可搬移16K等。用官方BLE OTA手机APP就能启动升级了,一次600B一帧:
下面可以修改一些蓝牙属性和版本信息以便进行版本管理。蓝牙名称归GAP定义,蓝牙ATT是以结构体长度-类型-值的形式来存放的,打开app_ble.c同时修改广播和扫描回应数据就能修改未连接时设备名称、连接后的蓝牙名称如均改为“FR3068_Ble_V2”(上图就是改过效果)如下:
static uint8_t adv_data[] = {
/* gatt service information */
0x03, //length of
this AD
GAP_ADVTYPE_16BIT_MORE, //16bit service uuid AD type
0xff, 0xf0, //value.service
uuid:0xFFF0
/* local device name information */
0x0e, //length of this AD
GAP_ADVTYPE_LOCAL_NAME_COMPLETE, //complete name AD type
'F','R','3','0','6','8','_','B','l','e','_','V','2', //value.local device name
};
/*
* Advertising scan response data, max size is 31 bytes
*/
static uint8_t
adv_scan_rsp_data[] = {
/* local device name information */
0x0e, //length
of this AD
GAP_ADVTYPE_LOCAL_NAME_COMPLETE, //complete name AD type
'F','R','3','0','6','8','_','B','l','e','_','V','2', //value.local device name
};