最近几日学习了蓝牙mesh SDK相关资料,尝试基于Bluetooth Mesh - SoC Light CTL demo来调试验证蓝牙mesh灯控应用的基本功能和使用。

使用原厂的Bluetooth Mesh手机APP来进行mesh组网和控制。
直接烧录运行Bluetooth Mesh - SoC Light CTL 程序,调试串口无反应,手机APP上也搜不到设备。
查看相关文档,有说mesh应用程序需要专用的boot程序:

先编译并烧录Bootloader - SoC Internal Storage (single image on 1536kB device) demo程序,然后再烧录mesh程序,可以正常运行,调试串口有调试信息输出了:


APP上可以扫码到设备了:

点击配网后,配网过程的调试信息如下:
[21:26:10.921]收←◆==>app init
BT mesh Light initialized
[21:26:11.083]收←◆Device name: 'Light CTL node 9031'
BT mesh node is unprovisioned, started unprovisioned beaconing...
[21:26:15.822]收←◆Connected
[21:26:16.536]收←◆BT mesh node provisioning is started (result: 0x0000)
[21:26:17.002]收←◆BT mesh node is provisioned (address: 0x2002, iv_index: 0x0)
[E] Status: sc = 0x002d (?) Lighting server lightbulb state load from PS failed or nvm is empty, use defaults.
[I] On power up state is OFF
BT mesh Lightness: 0%
[D] Status: sc = 0x0514 (?) Lighting server state publish failed (mdl=0x1006,elem=0,state=0x0001)
[D] Status: sc = 0x0514 (?) Lighting server state publish failed (mdl=0x1000,elem=0,state=0x0000)
[D] Status: sc = 0x0514 (?) Lighting server state publish failed (mdl=0x1300,elem=0,state=0x0080)
[E] Status: sc = 0x002d (?) CTL server lightbulb state load from PS failed or nvm is empty, use defaults.
BT mesh CTL Color Temperature: 6500K
BT mesh CTL Delta UV: 0.00
[D] Status: sc = 0x0514 (?) CTL server state publish failed (mdl=0x1306,elem=1,state=0x0086)
[I] Friend mode initialization
[I] lightness_change, kind 131, value 0
[I] Primary level update: from 0 to -32768
[I] Dummy ON/OFF change - same state as before
[I] ctl_change, kind 134
[I] Secondary level update: from 0 to -13312
配网后,如视频中,可以使用APP来控制LED的开关,亮度调节等操作。
配网后,按住BTN0然后上电,芯片会恢复出厂设置,即恢复未配网状态,可以进行重新配网:

mesh应用相关代码sl_btmesh_lighting_server.c

mesh相关配置


尝试了使用nRF Mesh和ST的mesh测试APP,能搜索到设备,但配网失败,后续在继续调试研究具体原因,以及作为输入传感器应用的开发调试。
实测视频
|