自己制作了一个N32WB452的开发板,使用的是24M晶振和32M的BLE晶振。按照手册的DCDC的BLE电路连接。
烧录完官方的ble slave例程之后串口输出会有err。
由于官方例程的代码按照8M晶振预定义,我在keil的项目设置里面加上了HSE_VALUE=24000000,这样系统时钟和串口看起来是没有问题的,串口助手可以正常收到数据。但是蓝牙没有起来。
调了一下代码发现是ble_initdata_down()这个函数中调用的send_vendor_array和send_vendor_bypass_command会向串口报err,同时send_vendor_array中的eif_spi_recv_bytes函数返回总是E_WAIT。
以下是完整串口输出,其中receive re那行输出是我自己加的log_debug输出的:
system start...
err
receive re:-15,receive event:10,0,0,0,15.
err
err
receive re:-15,receive event:0,0,0,0,0.
err
receive re:-15,receive event:0,0,0,0,0.
err
receive re:-15,receive event:0,0,0,0,0.
err
bt init ok.
ble driver version V4.2_1127
err
receive re:-15,receive event:28,0,0,0,6.
err
err
receive re:-15,receive event:0,0,0,0,0.
err
receive re:-15,receive event:0,0,0,0,0.
err
receive re:-15,receive event:0,0,0,0,0.
err
err
receive re:-15,receive event:4,0,0,0,24.
err
err
receive re:-15,receive event:0,0,0,0,0.
err
receive re:-15,receive event:0,0,0,0,0.
err
receive re:-15,receive event:0,0,0,0,0.
err
err
这时候DCDC的输出是3.3V,BLE_DVDD的电容上电压是0.8V,总电源上的电流大概17mA,用示波器看过两个晶振都已经起振了。 |