主控平台是stm157 linux5.4, 目前加载系统自带的hci_uart.ko 加载固件的时候超时 wifi功能正常,但是有蓝牙设备出来。模组是cyw43438的模组。帮忙看下 .
谢谢。
[root@100:~]# cp -r bcm43438a1.hcd /lib/firmware/brcm/BCM43430A1.hcd
[root@100:~]# ls -l /lib/firmware/brcm/BCM43430A1.hcd
-rw------- 1 root root 33664 Feb 7 15:54 /lib/firmware/brcm/BCM43430A1.hcd
[root@100:~]#
[root@100:~]#
[root@100:~]# echo 0 > /sys/class/rfkill/rfkill1/state
[root@100:~]#
[root@100:~]#
[root@100:~]# echo 1 > /sys/class/rfkill/rfkill1/state
[root@100:~]#
[root@100:~]#
[root@100:~]#
[root@100:~]# insmod hci_uart.ko
[ 242.383223] Bluetooth: HCI UART driver ver 2.3
[ 242.386241] Bluetooth: HCI UART protocol H4 registered
[ 242.392495] Bluetooth: HCI UART protocol BCSP registered
[ 242.396903] Bluetooth: HCI UART protocol LL registered
[ 242.402009] Bluetooth: HCI UART protocol ATH3K registered
[ 242.407350] Bluetooth: HCI UART protocol Three-wire (H5) registered
[ 242.419884] Bluetooth: HCI UART protocol Intel registered
[ 242.431427] hci_uart_bcm serial0-0: serial0-0 supply vbat not found, using dummy regulator
[ 242.434557] Bluetooth: HCI UART protocol Broadcom registered
[ 242.448011] Bluetooth: HCI UART protocol QCA registered
[ 242.451981] Bluetooth: HCI UART protocol AG6XX registered
[ 242.459467] hci_uart_bcm serial0-0: serial0-0 supply vddio not found, using dummy regulator
[ 242.461506] Bluetooth: HCI UART protocol Marvell registered
[root@100ask:~]# [ 242.859958] Bluetooth: hci0: BCM: chip id 94
[ 242.863263] Bluetooth: hci0: BCM: features 0x2e
[ 242.868568] Bluetooth: hci0: BCM43430A1
[ 242.871312] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0000
[ 245.129207] Bluetooth: hci0: command 0x1a1a tx timeout
[ 253.289132] Bluetooth: hci0: BCM: Patch command 1a1a failed (-110)
[ 253.293861] Bluetooth: hci0: BCM: Patch failed (-110)
[ 255.369133] Bluetooth: hci0: command 0x0c03 tx timeout
[ 263.529199] Bluetooth: hci0: BCM: Reset failed (-110)
[root@100ask:~]#
[root@100ask:~]# hciconfig
hci0: Type: Primary Bus: UART
BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0
DOWN
RX bytes:1411 acl:0 sco:0 events:163 errors:0
TX bytes:33820 acl:0 sco:0 commands:165 errors:0
已解决! 转到解答。
请检查一下rfkill是否对应的是蓝牙的上电指令?
另外,请量一下BT_REG_ON上的信号有没有起来。
您好 感谢支持。
BT_REG_ON一直是3.3v 。这两个好像没起到什么作用echo 0 > /sys/class/rfkill/rfkill1/state echo 1 > /sys/class/rfkill/rfkill1/state。
请检查一下linux设备里是否能看到响应的串口,类似ttyS0,ttyS1这样的串口。
BT_REG_ON一直是高也是有问题的,这个脚应该是主控去拉的。
您好
这个串口接口是有的 [root@100:~]# ls /dev/ttySTM1
/dev/ttySTM1
请把你的工具链发过来,我们这边编译一个mbt的工具,试试看通过mbt发送指令是否可以。
您好
工具链下面链接下载一下 gcc是这个arm-buildroot-linux-gnueabihf-gcc
链接:https://pan.baidu.com/s/1VHVVl46tmdfgYEaxa8mm6A
提取码:wqaf
--来自百度网盘超级会员V6的分享
BT_REG_ON也不是一直高 加载hci_uart.ko才变高
类似于这样:
Usage: mbt reset /dev/ttyUSBx
The example below sends HCI_Reset command to the device and processes the HCI
Command Complete event (BLUETOOTH SPECIFICATION Version 4.1 [Vol 2], Section
7.3.2 for details).
/home/test/test$ ./mbt reset /dev/ttyUSB1
Opened port /dev/ttyUSB1
writing
01 03 0c 00
received 7
04 0e 04 01 03 0c 00
exiting.
您好 用你提供的工具测试了 没回复成功,但是用./brcm_patchram_plus --enable_hci --no2bytes --tosleep 200000 --baudrate 115200 --patchram bcm43438a1.hcd /dev/ttySTM2 &有跑起来 但是蓝牙hci设备没出来,再帮忙看看。附件是完整日志。现在有控制BT_REG_ON拉低拉高复位 设备节点也确定是这个/dev/ttySTM2
谢谢
[root@100:~]# ./mbt_test reset /dev/ttySTM2
Opened port /dev/ttySTM2
writing
01 03 0c 00
writing
01 03 0c 00
writing
01 03 0c 00
writing
01 03 0c 00
writing
01 03 0c 00
writing
01 03 0c 00
[22:47:47:091][root@100ask:~]#
[22:47:56:406][root@100ask:~]# ./brcm_patchram_plus --enable_hci --no2bytes --tosleep 200000 --baudrate 115200 --patchram bcm43438a1.hcd /dev/ttySTM2 &
[22:48:00:135][1] 521
[22:48:00:147][root@100ask:~]# option enable_hci
[22:48:00:147]option no2bytes
[22:48:00:147]option tosleep with arg 200000
[22:48:00:148]option baudrate with arg 115200
[22:48:00:167]option patchram with arg bcm43438a1.hcd
[22:48:00:167]/dev/ttySTM2
[22:48:00:167]writing
[22:48:00:168]01 03 0c 00
[22:48:04:160]writing
[22:48:04:160]01 03 0c 00
[22:48:04:160]received 7
[22:48:04:161]04 0e 04 01 03 0c 00
[22:48:04:161]writing
[22:48:04:161]01 2e fc 00
[22:48:04:161]received 7
[22:48:04:161]04 0e 04 01 2e fc 00
[22:48:04:352]writing
[22:48:04:352]01 4c fc 46 00 17 21 00 42 52 43 4d 63 66 67 53
[22:48:04:353]00 00 00 00 32 00 00 00 01 01 04 90 65 00 00 00
[22:48:04:364]03 06 ac 1f 12 a1 43 43 00 01 1c 42 17 21 00 00
[22:48:04:368]00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[22:48:04:368]00 00 00 00 00 00 00 fe 00 00
[22:48:04:369]received 7
[22:48:04:369]04 0e 04 01 4c fc 00
[22:48:04:369]writing
hello:
brcm_patchram 和mbt功能是接近的,现在看上去download firmware成功了, 需要再确认的是你的firmware是否是从module maker那边拿到的匹配版本,如果firmware错误也会有问题。 而且个人觉得download firmware这些动作不会影响到hciconfig interface的创建,这个需要中间层自己去运行,比如create一个interface和目前的controller匹配这样。
换言之,hci0的创建时在驱动insmod的时候创建的,需要将这部分patch download的工作在hciuart的startup的时候调试ok,应该就可以了。
[ 242.461506] Bluetooth: HCI UART protocol Marvell registered
[root@100ask:~]# [ 242.859958] Bluetooth: hci0: BCM: chip id 94
[ 242.863263] Bluetooth: hci0: BCM: features 0x2e
[ 242.868568] Bluetooth: hci0: BCM43430A1
[ 242.871312] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0000
[ 245.129207] Bluetooth: hci0: command 0x1a1a tx timeout
[ 253.289132] Bluetooth: hci0: BCM: Patch command 1a1a failed (-110)
[ 253.293861] Bluetooth: hci0: BCM: Patch failed (-110)
[ 255.369133] Bluetooth: hci0: command 0x0c03 tx timeout
[ 263.529199] Bluetooth: hci0: BCM: Reset failed (-110)
建议的模式时这样:
我觉着在download firmware的时候我们需要115200 的baud rate, 这个时候如果使用hci的default的代码,可能会存在rate不匹配的情况。 所以可以这样做,建议先上电后,用:
./brcm_patchram_plus --enable_hci --no2bytes --tosleep 200000 --baudrate 115200 --patchram bcm43438a1.hcd /dev/ttySTM2 &
这部分的动作就是指定--baudrate 115200 波特率,指定uart dev。
这个download成功。
在hci的代码中,将这部分直接return success,看是否可以跑起来。
[ 242.868568] Bluetooth: hci0: BCM43430A1
[ 242.871312] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0000
[ 245.129207] Bluetooth: hci0: command 0x1a1a tx timeout
[ 253.289132] Bluetooth: hci0: BCM: Patch command 1a1a failed (-110)
[ 253.293861] Bluetooth: hci0: BCM: Patch failed (-110)
可以看下:
brcm_patchram_plus --help 里面是否有log level设置。
版本信息可以通过vendor specific 的一些command 读取出来, 比如read_version.
可以要求支持你们的vendor帮忙用cytool 测试下。
Hello:
看下你的brcmpatchram里面有没有 --use_baudrate_for_download, 我看log里面没有update baud rate 的command, 虽然设置了rate,但是没有update。
没有问题的, 必须同时修改为3M才会生效,brcmpatchram 这个工具不在我们这边维护了,所以不知道内部逻辑怎么修改了。
好的 谢谢。brcmpatchram 这个工具不在我们这边维护了,一般英飞凌这边是给客户提供什么工具
Linux 的话一般是给mbt 工具, windows 可以用我们的cybluetool。
brcmpatchram会有更多的params的设置接口, mbt主要用于测试。
好的 谢谢。