cyw43438 蓝牙加载固件失败

公告

大中华汽车电子生态圈社区并入开发者社区- 更多资讯点击此

Tip / 登入 to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
WIFI-01
Level 4
Level 4
100 sign-ins First like given 50 replies posted

主控平台是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

 

0 点赞
1 解答
Zhengbao_Zhang
Moderator
Moderator
Moderator
250 sign-ins First comment on KBA 10 questions asked

没有问题的, 必须同时修改为3M才会生效,brcmpatchram 这个工具不在我们这边维护了,所以不知道内部逻辑怎么修改了。

在原帖中查看解决方案

0 点赞
25 回复数
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

请检查一下rfkill是否对应的是蓝牙的上电指令?

另外,请量一下BT_REG_ON上的信号有没有起来。

0 点赞
WIFI-01
Level 4
Level 4
100 sign-ins First like given 50 replies posted

您好 感谢支持。

    BT_REG_ON一直是3.3v 。这两个好像没起到什么作用echo 0 > /sys/class/rfkill/rfkill1/state echo 1 > /sys/class/rfkill/rfkill1/state。

0 点赞
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

请检查一下linux设备里是否能看到响应的串口,类似ttyS0,ttyS1这样的串口。

BT_REG_ON一直是高也是有问题的,这个脚应该是主控去拉的。

0 点赞
WIFI-01
Level 4
Level 4
100 sign-ins First like given 50 replies posted

您好

这个串口接口是有的  [root@100:~]# ls /dev/ttySTM1
/dev/ttySTM1

0 点赞
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

请把你的工具链发过来,我们这边编译一个mbt的工具,试试看通过mbt发送指令是否可以。

0 点赞
WIFI-01
Level 4
Level 4
100 sign-ins First like given 50 replies posted

您好

工具链下面链接下载一下  gcc是这个arm-buildroot-linux-gnueabihf-gcc

链接:https://pan.baidu.com/s/1VHVVl46tmdfgYEaxa8mm6A
提取码:wqaf
--来自百度网盘超级会员V6的分享

0 点赞
lock attach
Attachments are accessible only for community members.
WIFI-01
Level 4
Level 4
100 sign-ins First like given 50 replies posted

您好

这个是系统用的蓝牙源码

0 点赞
WIFI-01
Level 4
Level 4
100 sign-ins First like given 50 replies posted

BT_REG_ON也不是一直高 加载hci_uart.ko才变高

0 点赞
lock attach
Attachments are accessible only for community members.
Zhengbao_Zhang
Moderator
Moderator
Moderator
250 sign-ins First comment on KBA 10 questions asked

hello:

  可以做一个测试, 我提供一个工具,chip的reg on上电后,其他和蓝牙相关的任何程序都不跑。

然后用我们这个工具做一下reset看是否可以正常返回, 用于测试uart口是否可以正常通信。

rename to mbt, 执行下面的操作, 我们平常测试,只是上电reset会有正常返回值:

Usage: mbt reset

Command: ./mbt reset
tx:
01 03 0c 00
rx: (7 bytes)
04 0e 04 01 03 0c 00

0 点赞
Zhengbao_Zhang
Moderator
Moderator
Moderator
250 sign-ins First comment on KBA 10 questions asked

类似于这样:

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.

0 点赞
lock attach
Attachments are accessible only for community members.
WIFI-01
Level 4
Level 4
100 sign-ins First like given 50 replies posted

您好 感谢支持。

我再确认下串口是tty几再用mbt 工具验证一下,发现系统不加载hcd固件 蓝牙也是正常  不知道有没有什么风险 不加载可以吗,附件是完整的日志,如果替换43438的hcd到相应的目录则会加载固件超时就是开始问的问题。

谢谢。

 

0 点赞
lock attach
Attachments are accessible only for community members.
WIFI-01
Level 4
Level 4
100 sign-ins First like given 50 replies posted

您好  用你提供的工具测试了 没回复成功,但是用./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

0 点赞
Zhengbao_Zhang
Moderator
Moderator
Moderator
250 sign-ins First comment on KBA 10 questions asked

hello:

      brcm_patchram 和mbt功能是接近的,现在看上去download firmware成功了, 需要再确认的是你的firmware是否是从module maker那边拿到的匹配版本,如果firmware错误也会有问题。 而且个人觉得download firmware这些动作不会影响到hciconfig interface的创建,这个需要中间层自己去运行,比如create一个interface和目前的controller匹配这样。

0 点赞
lock attach
Attachments are accessible only for community members.
WIFI-01
Level 4
Level 4
100 sign-ins First like given 50 replies posted

您好 

固件是没问题的,是原厂提供的,其他平台上用过没问题,download firmware是成功了吗  但是没有hci设备出来接下来需要如何移植 如果用brcm_patchram。

谢谢。

0 点赞
Zhengbao_Zhang
Moderator
Moderator
Moderator
250 sign-ins First comment on KBA 10 questions asked

换言之,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)

0 点赞
Zhengbao_Zhang
Moderator
Moderator
Moderator
250 sign-ins First comment on KBA 10 questions asked

建议的模式时这样:

我觉着在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)

0 点赞
lock attach
Attachments are accessible only for community members.
WIFI-01
Level 4
Level 4
100 sign-ins First like given 50 replies posted

您好  目前蓝牙起来了,完整日志见附件。另外想请教下

1、现在brcm_patchram_plus 没加-d参数但是日志打印非常多的十六进制hci cmd,可以不显示这些打印吗, 打印log有点太多

2、有什么命令可以看hcd固件版本号吗

谢谢。

0 点赞
Zhengbao_Zhang
Moderator
Moderator
Moderator
250 sign-ins First comment on KBA 10 questions asked

可以看下:

brcm_patchram_plus  --help 里面是否有log level设置。

版本信息可以通过vendor specific 的一些command 读取出来, 比如read_version.

可以要求支持你们的vendor帮忙用cytool 测试下。

0 点赞
lock attach
Attachments are accessible only for community members.
WIFI-01
Level 4
Level 4
100 sign-ins First like given 50 replies posted

您好

      请教下  brcm_patchram_plus执行完成需要十三秒左右 这个时间太长了  波特率已经设置到3M了,这个时间还可以优化短点吗

0 点赞
Zhengbao_Zhang
Moderator
Moderator
Moderator
250 sign-ins First comment on KBA 10 questions asked

Hello:

   看下你的brcmpatchram里面有没有 --use_baudrate_for_download,  我看log里面没有update baud rate 的command, 虽然设置了rate,但是没有update。

0 点赞
lock attach
Attachments are accessible only for community members.
WIFI-01
Level 4
Level 4
100 sign-ins First like given 50 replies posted

您好 感谢。加了--use_baudrate_for_download也不会update baud rate ,Mac地址也变的不对,附件是日志。现在系统的dbug串口是115200,如果改成3M,download固件才会以3M的速率,这样有问题吗,一定要同时更新系统串口的波特率吗。

0 点赞
Zhengbao_Zhang
Moderator
Moderator
Moderator
250 sign-ins First comment on KBA 10 questions asked

没有问题的, 必须同时修改为3M才会生效,brcmpatchram 这个工具不在我们这边维护了,所以不知道内部逻辑怎么修改了。

0 点赞
WIFI-01
Level 4
Level 4
100 sign-ins First like given 50 replies posted

好的 谢谢。brcmpatchram 这个工具不在我们这边维护了,一般英飞凌这边是给客户提供什么工具

0 点赞
Zhengbao_Zhang
Moderator
Moderator
Moderator
250 sign-ins First comment on KBA 10 questions asked

Linux 的话一般是给mbt 工具, windows 可以用我们的cybluetool。

brcmpatchram会有更多的params的设置接口, mbt主要用于测试。

0 点赞
WIFI-01
Level 4
Level 4
100 sign-ins First like given 50 replies posted

好的 谢谢。

0 点赞