很多小伙伴拿到一颗芯片,或许想用做简单的方法去验证下芯片是否可用,而不是在特定的平台去写程序验证,当然我也是这样,所以就想了一个懒办法和大家分享下,以下文章是针对CSR8811 蓝牙芯片在PC端验证是否可用的文章,本文章分两种办法来进行介绍
一.本例通过HCI raw data的方式去验证,Transport为H4
需要接的线是:uart TX,RX,GND,3.3V,CTS,RTS,然后就可以在PC串口发送数据了
HCI raw data如下:
send:HCI reset
01 03 0C 00
receive:
04 0E 04 01 03 0C 00
send:PSKEY PSKEY_ANA_FREQ
01 00 FC 13 C2 02 00 09 00 1E 00 03 70 00 00 FE 01 01 00 00 00 90 65
receive
04 FF 13 C2 01 00 09 00 1E 00 03 70 00 00 FE 01 01 00 00 00 90 65
send:PSKEY_HOST_INTERFACE H4
01 00 FC 13 C2 02 00 09 00 04 00 03 70 00 00 F9 01 01 00 00 00 03 00
receive:
04 FF 13 C2 01 00 09 00 04 00 03 70 00 00 F9 01 01 00 00 00 03 00
send:PSKEY PSKEY_UART_CONFIG_H4
01 00 FC 13 C2 02 00 09 00 05 00 03 70 00 00 C0 01 01 00 00 00 A8 08
receive:
04 FF 13 C2 01 00 09 00 05 00 03 70 00 00 C0 01 01 00 00 00 A8 08
send:PSKEY_BDADDR
01 00 FC 19 C2 02 00 0C 00 08 00 03 70 00 00 01 00 04 00 00 00 45 00 46 4F B8 00 64 DC
receive:
04 FF 19 C2 01 00 0C 00 08 00 03 70 00 00 01 00 04 00 00 00 45 00 46 4F B8 00 64 DC
send:PSKEY_UART_BITRATE
01 00 FC 15 C2 02 00 0A 00 09 00 03 70 00 00 EA 01 02 00 00 00 01 00 00 C2
receive
04 FF 15 C2 01 00 0A 00 09 00 03 70 00 00 EA 01 02 00 00 00 01 00 00 C2
send:warm reset
01 00 FC 13 C2 02 00 09 00 4D 0E 02 40 00 00 00 00 00 00 00 00 00 00
receive:
04 0F 04 00 01 00 00
send:Radio test
01 00 FC 13 C2 02 00 09 00 A0 00 04 50 00 00 1D 00 3A 00 00 00 00 00
receive
04 FF 13 C2 01 00 09 00 A0 00 04 50 00 00 1D 00 3A 00 00 00 00 00
send:HCI read bt address
01 09 10 00
receive:刚刚设定的
04 0E 0A 01 09 10 00 46 4F 45 B8 64 DC
send:HCI read buffer size
01 05 10 00
receive:
04 0E 0B 01 05 10 00 36 01 40 0A 00 08 00
send:HCI read locol feature
01 03 10 00
receive:
04 0E 0C 01 03 10 00 FF FF 8F FE DB FF 5B 87
send:HCI set event mask
01 01 0C 08 FF FF FF FF FF FF FF 3F
receive:
04 0E 04 01 01 0C 00
send:HCI weite page timeout
01 18 0C 02 00 20
receive
04 0E 04 01 18 0C 00
send:HCI write cod
01 24 0C 03 04 04 24
receive:
04 0E 04 01 24 0C 00
send:HCI write auth enable
01 20 0C 01 00
receive:
04 0E 04 01 20 0C 00
send:HCI write inquiry active
01 1E 0C 04 00 02 12 00
receive:
04 0E 04 01 1E 0C 00
send:HCI write page scan active
01 1C 0C 04 90 00 12 00
receive:
04 0E 04 01 1C 0C 00
send:HCI write inquiry mode
01 45 0C 01 02
receive:
04 0E 04 01 45 0C 00
send:HCI write scan enable
01 1A 0C 01 03
receive:
04 0E 04 01 1A 0C 00
以上需要每条每条的在串口工具去敲,然后发送,运行行完以上Raw data,就会发现手机能搜寻到蓝牙
需要注意的几点是:
1.由于H4的pskey是默认开了流控的,所以在接线的时候务必要接CTS,RTS
2.单纯的接线有CTS,RTS还不行,如果选择走H4的话,那么驱动也应该开启流控,PC串口有勾选可以选择开启流控,如图
3.发送和接收都已16进制显示
对于比较急迫验证模块是否可用的朋友这应该是一个不错的办法,但是还有一个比较好的办法是用CSR的BTCli工具要验证
二.本例通过CSR工具BTCLI来验证
打开BTCLI,打开BCSP,因为直接打开H4,没有开流控,所以无法成功,所以想了一个办法,先打开BCSP,然后再去下pskey,然后改用走H4
打开BCSP如下图:command_status pending nhcp:0x01 nop,
出来这个就代表BCSP通了,可能有的看客比较好奇中间发生了什么事情,我也比较好奇
所以就拿来串口监测工具来监测一下,结果发现数据如下:
如果懂BCSP协议的可能一眼就能看懂,就是一个BCSP link的过程
然后再BTCLI运行提前写好的txt文件,主要作用是下一些pskey到芯片中,运行结果如下
txt文档格式内容如下:
psset 0x01ea 0x0001 0xc200
sleep 100
sleep 300
psset 0x01fe 0x6590
sleep 300
#psset 0x01f6 0x0036
psset 0x01f6 0x002d
#psset 0x01f6 0x001f
psset 0x01f9 0x0003
sleep 300
bcset warm_reset
sleep 300
主要是打一些pskey给芯片,做完这一步就可以重新启动BTCLI来看看H4了,运行如图
发现是通了,但是做到这一步仅仅代表板子芯片没有问题,此例不像raw data那样可以直接被搜索到
如果各位还有什么好的验证方法,可以一起交流下