您尚未登录。

楼主 #1 2018-05-04 17:28:06

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

参考链接: http://www.ti.com/lit/ds/swrs121e/swrs121e.pdf
参考链接: https://whycan.cn/t_637.html

修改 hciattach.c

在 printf("Device setup complete\n"); 后添加:

close(n);
return 0;

删除:

if (ioctl(fd, HCIUARTSETPROTO, u->proto) < 0) {
        perror("Can't set device");
        return -1;
    }

删除:

/* Restore TTY line discipline */
    ld = N_TTY;
    if (ioctl(n, TIOCSETD, &ld) < 0) {
        perror("Can't restore line discipline");
        exit(1);
    }

让rtl8723bs 更新固件, 运行命令:

sudo ./rtk_hciattach -n -s 115200 /dev/ttyUSB1 rtk_h5

输出log:

xxx@ubuntu:/opt/ap6210$ sudo ./brcm_patchram_plus -d  --patchram bcm20710a1.hcd --bd_addr 11:22:33:44:55:66 --no2bytes --tosleep 1000 /dev/ttyUSB1 
Realtek Bluetooth init uart with init speed:115200, final_speed:115200, type:HCI UART H5
Realtek Bluetooth :Realtek hciattach version 2.5 

Realtek Bluetooth :3-wire sync pattern resend : 1, len: 8

Realtek Bluetooth :Get SYNC Resp Pkt

Realtek Bluetooth :Get SYNC pkt-active mode

Realtek Bluetooth :3-wire config pattern resend : 1 , len: 10
Realtek Bluetooth :Get CONFG pkt-active mode

Realtek Bluetooth :Get CONFG resp pkt-active mode

Realtek Bluetooth :H5 init finished

Realtek Bluetooth :config offset(f4),length(8)
Realtek Bluetooth :config baud rate to :4928002, hwflowcontrol:5f, 1
Realtek Bluetooth :config offset(27),length(1)
Realtek Bluetooth :config offset(fe),length(1)
Realtek Bluetooth :config offset(15b),length(4)
Realtek Bluetooth :config offset(1e3),length(1)
Realtek Bluetooth :Get config baud rate from config file:4928002
Realtek Bluetooth :Load FW OK
Realtek Bluetooth :RTK send HCI_VENDOR_READ_RTK_ROM_VERISION_Command

Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :receive hci command complete event with command:1001

Realtek Bluetooth :Read RTK LMP version with Status:0
Realtek Bluetooth :gLmpVersion = 0x8723
Realtek Bluetooth :RTK send HCI_VENDOR_READ_RTK_ROM_VERISION_Command

Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :receive hci command complete event with command:fc6d

Realtek Bluetooth :Read RTK rom version with Status:0
Realtek Bluetooth :rtk_hw_cfg.eversion = 1
Realtek Bluetooth :rtk_get_fw_project_id: opcode 0, len 1, data 1
Realtek Bluetooth :fw_ver 0x1e3ee40e, patch_num 2
Realtek Bluetooth :patch length is 0x5e90
Realtek Bluetooth :start offset is 0x4f00
Realtek Bluetooth :fw: exists, config file: exists
Realtek Bluetooth :baudrate in change speed command: 0x2 0x80 0x92 0x4 

Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :receive hci command complete event with command:fc17

Realtek Bluetooth :Change BD Rate with status:0
Realtek Bluetooth :final_speed 1500000

Realtek Bluetooth :hw flow control enable
Realtek Bluetooth :iEndIndex:96  iLastPacketLen:71 iAdditionpkt:4

Realtek Bluetooth :hci_download_patch tx_index:0 rx_index: -1

Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 0

Realtek Bluetooth :hci_download_patch tx_index:1 rx_index: 0

Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 1

Realtek Bluetooth :hci_download_patch tx_index:2 rx_index: 1

Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 2

Realtek Bluetooth :hci_download_patch tx_index:3 rx_index: 2

Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 3

Realtek Bluetooth :hci_download_patch tx_index:4 rx_index: 3

Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 4

Realtek Bluetooth :hci_download_patch tx_index:5 rx_index: 4

Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 5

Realtek Bluetooth :hci_download_patch tx_index:6 rx_index: 5

Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 6

Realtek Bluetooth :hci_download_patch tx_index:7 rx_index: 6

Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 7

Realtek Bluetooth :hci_download_patch tx_index:8 rx_index: 7

Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 8

Realtek Bluetooth :hci_download_patch tx_index:9 rx_index: 8

Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 9

Realtek Bluetooth :hci_download_patch tx_index:10 rx_index: 9

Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 10

Realtek Bluetooth :hci_download_patch tx_index:11 rx_index: 10

Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 11

Realtek Bluetooth :hci_download_patch tx_index:12 rx_index: 11

Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 12

Realtek Bluetooth :hci_download_patch tx_index:13 rx_index: 12

Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 13

Realtek Bluetooth :hci_download_patch tx_index:14 rx_index: 13

Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 14

Realtek Bluetooth :hci_download_patch tx_index:15 rx_index: 14

Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 15

Realtek Bluetooth :hci_download_patch tx_index:16 rx_index: 15

Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 16

Realtek Bluetooth :hci_download_patch tx_index:17 rx_index: 16

Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 17

Realtek Bluetooth :hci_download_patch tx_index:18 rx_index: 17

Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 18

Realtek Bluetooth :hci_download_patch tx_index:19 rx_index: 18

Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 19

Realtek Bluetooth :hci_download_patch tx_index:20 rx_index: 19

Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 20

Realtek Bluetooth :hci_download_patch tx_index:21 rx_index: 20

Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 21

Realtek Bluetooth :hci_download_patch tx_index:22 rx_index: 21

Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 22

Realtek Bluetooth :hci_download_patch tx_index:23 rx_index: 22

Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 23

Realtek Bluetooth :hci_download_patch tx_index:24 rx_index: 23

Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 24

Realtek Bluetooth :hci_download_patch tx_index:25 rx_index: 24

Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 25

Realtek Bluetooth :hci_download_patch tx_index:26 rx_index: 25

Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 26

Realtek Bluetooth :hci_download_patch tx_index:27 rx_index: 26

Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 27

Realtek Bluetooth :hci_download_patch tx_index:28 rx_index: 27

Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 28

Realtek Bluetooth :hci_download_patch tx_index:29 rx_index: 28

Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 29

Realtek Bluetooth :hci_download_patch tx_index:30 rx_index: 29

Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 30

Realtek Bluetooth :hci_download_patch tx_index:31 rx_index: 30

Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 31

Realtek Bluetooth :hci_download_patch tx_index:32 rx_index: 31

Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 32

Realtek Bluetooth :hci_download_patch tx_index:33 rx_index: 32

Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 33

Realtek Bluetooth :hci_download_patch tx_index:34 rx_index: 33

Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 34

Realtek Bluetooth :hci_download_patch tx_index:35 rx_index: 34

Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 35

Realtek Bluetooth :hci_download_patch tx_index:36 rx_index: 35

Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 36

Realtek Bluetooth :hci_download_patch tx_index:37 rx_index: 36

Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 37

Realtek Bluetooth :hci_download_patch tx_index:38 rx_index: 37

Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 38

Realtek Bluetooth :hci_download_patch tx_index:39 rx_index: 38

Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 39

Realtek Bluetooth :hci_download_patch tx_index:40 rx_index: 39

Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 40

Realtek Bluetooth :hci_download_patch tx_index:41 rx_index: 40

Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 41

Realtek Bluetooth :hci_download_patch tx_index:42 rx_index: 41

Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 42

Realtek Bluetooth :hci_download_patch tx_index:43 rx_index: 42

Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 43

Realtek Bluetooth :hci_download_patch tx_index:44 rx_index: 43

Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 44

Realtek Bluetooth :hci_download_patch tx_index:45 rx_index: 44

Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 45

Realtek Bluetooth :hci_download_patch tx_index:46 rx_index: 45

Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 46

Realtek Bluetooth :hci_download_patch tx_index:47 rx_index: 46

Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 47

Realtek Bluetooth :hci_download_patch tx_index:48 rx_index: 47

Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 48

Realtek Bluetooth :hci_download_patch tx_index:49 rx_index: 48

Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 49

Realtek Bluetooth :hci_download_patch tx_index:50 rx_index: 49

Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 50

Realtek Bluetooth :hci_download_patch tx_index:51 rx_index: 50

Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 51

Realtek Bluetooth :hci_download_patch tx_index:52 rx_index: 51

Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 52

Realtek Bluetooth :hci_download_patch tx_index:53 rx_index: 52

Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 53

Realtek Bluetooth :hci_download_patch tx_index:54 rx_index: 53

Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 54

Realtek Bluetooth :hci_download_patch tx_index:55 rx_index: 54

Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 55

Realtek Bluetooth :hci_download_patch tx_index:56 rx_index: 55

Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 56

Realtek Bluetooth :hci_download_patch tx_index:57 rx_index: 56

Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 57

Realtek Bluetooth :hci_download_patch tx_index:58 rx_index: 57

Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 58

Realtek Bluetooth :hci_download_patch tx_index:59 rx_index: 58

Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 59

Realtek Bluetooth :hci_download_patch tx_index:60 rx_index: 59

Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 60

Realtek Bluetooth :hci_download_patch tx_index:61 rx_index: 60

Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 61

Realtek Bluetooth :hci_download_patch tx_index:62 rx_index: 61

Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 62

Realtek Bluetooth :hci_download_patch tx_index:63 rx_index: 62

Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 63

Realtek Bluetooth :hci_download_patch tx_index:64 rx_index: 63

Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 64

Realtek Bluetooth :hci_download_patch tx_index:65 rx_index: 64

Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 65

Realtek Bluetooth :hci_download_patch tx_index:66 rx_index: 65

Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 66

Realtek Bluetooth :hci_download_patch tx_index:67 rx_index: 66

Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 67

Realtek Bluetooth :hci_download_patch tx_index:68 rx_index: 67

Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 68

Realtek Bluetooth :hci_download_patch tx_index:69 rx_index: 68

Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 69

Realtek Bluetooth :hci_download_patch tx_index:70 rx_index: 69

Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 70

Realtek Bluetooth :hci_download_patch tx_index:71 rx_index: 70

Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 71

Realtek Bluetooth :hci_download_patch tx_index:72 rx_index: 71

Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 72

Realtek Bluetooth :hci_download_patch tx_index:73 rx_index: 72

Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 73

Realtek Bluetooth :hci_download_patch tx_index:74 rx_index: 73

Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 74

Realtek Bluetooth :hci_download_patch tx_index:75 rx_index: 74

Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 75

Realtek Bluetooth :hci_download_patch tx_index:76 rx_index: 75

Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 76

Realtek Bluetooth :hci_download_patch tx_index:77 rx_index: 76

Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 77

Realtek Bluetooth :hci_download_patch tx_index:78 rx_index: 77

Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 78

Realtek Bluetooth :hci_download_patch tx_index:79 rx_index: 78

Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 79

Realtek Bluetooth :hci_download_patch tx_index:80 rx_index: 79

Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 80

Realtek Bluetooth :hci_download_patch tx_index:81 rx_index: 80

Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 81

Realtek Bluetooth :hci_download_patch tx_index:82 rx_index: 81

Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 82

Realtek Bluetooth :hci_download_patch tx_index:83 rx_index: 82

Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 83

Realtek Bluetooth :hci_download_patch tx_index:84 rx_index: 83

Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 84

Realtek Bluetooth :hci_download_patch tx_index:85 rx_index: 84

Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 85

Realtek Bluetooth :hci_download_patch tx_index:86 rx_index: 85

Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 86

Realtek Bluetooth :hci_download_patch tx_index:87 rx_index: 86

Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 87

Realtek Bluetooth :hci_download_patch tx_index:88 rx_index: 87

Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 88

Realtek Bluetooth :hci_download_patch tx_index:89 rx_index: 88

Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 89

Realtek Bluetooth :hci_download_patch tx_index:90 rx_index: 89

Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 90

Realtek Bluetooth :hci_download_patch tx_index:91 rx_index: 90

Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 91

Realtek Bluetooth :hci_download_patch tx_index:92 rx_index: 91

Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 92

Realtek Bluetooth :hci_download_patch tx_index:93 rx_index: 92

Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 93

Realtek Bluetooth :hci_download_patch tx_index:94 rx_index: 93

Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 94

Realtek Bluetooth :hci_download_patch tx_index:95 rx_index: 94

Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 95

Realtek Bluetooth :hci_download_patch tx_index:96 rx_index: 95

Realtek Bluetooth :Received reliable seqno 3 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 96

Realtek Bluetooth :hci_download_patch tx_index:97 rx_index: 96

Realtek Bluetooth :Received reliable seqno 4 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 97

Realtek Bluetooth :hci_download_patch tx_index:98 rx_index: 97

Realtek Bluetooth :Received reliable seqno 5 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 98

Realtek Bluetooth :hci_download_patch tx_index:99 rx_index: 98

Realtek Bluetooth :Received reliable seqno 6 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 99

Realtek Bluetooth :Send FW last command
Realtek Bluetooth :hci_download_patch tx_index:100 rx_index: 99

Realtek Bluetooth :Received reliable seqno 7 from card
Realtek Bluetooth :rtk_hw_cfg.rx_index 100

Realtek Bluetooth :Init Process finished
Realtek Bluetooth post process
Device setup complete
xxx@ubuntu:/opt/ap6210$ 

搜索附近的蓝牙设备:

xxx@ubuntu:/opt/btstack/port/posix-h5$ sudo ./gap_inquiry
Packet Log: /tmp/hci_dump.pklg
[2018-05-05 11:43:31.831] LOG -- hci.c.2800: hci_power_control: 1, current mode 0
[2018-05-05 11:43:33.537] LOG -- btstack_uart_block_posix.c.177: h4_set_baudrate 115200
[2018-05-05 11:43:33.638] LOG -- hci_transport_h5.c.830: UART driver does not provide compatible sleep mode
[2018-05-05 11:43:33.638] LOG -- hci_transport_h5.c.720: resend timeout for 115200 baud: 405 ms
[2018-05-05 11:43:33.638] LOG -- hci.c.3859: BTSTACK_EVENT_STATE 1
[2018-05-05 11:43:33.638] EVT <= 60 01 01





离线

楼主 #2 2018-05-04 17:28:16

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

https://whycan.cn/t_245.html

同样的套路用在 AP6210上面很正常。





离线

楼主 #3 2018-05-04 17:28:18

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

占坑





离线

楼主 #4 2018-05-04 17:28:20

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

占坑





离线

楼主 #5 2018-05-05 20:08:11

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

怎么折腾也不行,不知道哪里不行,
完全按照 AP6210的套路搞的。

实在不行只能用bluez了。





离线

楼主 #6 2018-05-07 09:52:25

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

因为 RTL8723BS 已经画在板子上了,
一直没办法搞定btstack,
那么只能按照Linux的套路bluez 来搞 BLE了.





离线

楼主 #7 2018-05-07 13:49:00

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

QQ20180507134225.png


gatttools 用 AP6201B 和 RTL8723BS 永远都是 connect error: Device or resource busy (16)





离线

楼主 #8 2018-05-07 13:56:00

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

QQ20180507135532.png

这个是苹果 mac air, ubuntu14.04LTS 挂载自带的蓝牙设备, 运行gatttool, 一切正常。





离线

楼主 #9 2018-05-07 17:03:14

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

QQ20180507170147.png

光这三个文件加起来就有 4M, bluez 太重量级了, 只能想办法用轻量级协议栈。





离线

楼主 #11 2018-05-07 20:57:33

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

晕哥 说:

https://whycan.cn/files/members/3/QQ20180507134225.png


gatttools 用 AP6201B 和 RTL8723BS 永远都是 connect error: Device or resource busy (16)

RRRR@ubuntu:/disk5$ sudo gatttool -b C8:0F:10:34:B7:CA -I
[   ][C8:0F:10:34:B7:CA][LE]> connect
[CON][C8:0F:10:34:B7:CA][LE]> primary 
[CON][C8:0F:10:34:B7:CA][LE]> 
attr handle: 0x0001, end grp handle: 0x0009 uuid: 00001800-0000-1000-8000-00805f9b34fb
attr handle: 0x000c, end grp handle: 0x000f uuid: 00001801-0000-1000-8000-00805f9b34fb
attr handle: 0x0010, end grp handle: 0x0039 uuid: 0000fee0-0000-1000-8000-00805f9b34fb
attr handle: 0x003a, end grp handle: 0x0048 uuid: 0000fee1-0000-1000-8000-00805f9b34fb
attr handle: 0x0049, end grp handle: 0x004e uuid: 0000180d-0000-1000-8000-00805f9b34fb
attr handle: 0x004f, end grp handle: 0x0051 uuid: 00001802-0000-1000-8000-00805f9b34fb
[CON][C8:0F:10:34:B7:CA][LE]> characteristics 
[CON][C8:0F:10:34:B7:CA][LE]> 
handle: 0x0002, char properties: 0x02, char value handle: 0x0003, uuid: 00002a00-0000-1000-8000-00805f9b34fb
handle: 0x0004, char properties: 0x02, char value handle: 0x0005, uuid: 00002a01-0000-1000-8000-00805f9b34fb
handle: 0x0006, char properties: 0x0a, char value handle: 0x0007, uuid: 00002a02-0000-1000-8000-00805f9b34fb
handle: 0x0008, char properties: 0x02, char value handle: 0x0009, uuid: 00002a04-0000-1000-8000-00805f9b34fb
handle: 0x000d, char properties: 0x22, char value handle: 0x000e, uuid: 00002a05-0000-1000-8000-00805f9b34fb
handle: 0x0011, char properties: 0x02, char value handle: 0x0012, uuid: 0000ff01-0000-1000-8000-00805f9b34fb
handle: 0x0013, char properties: 0x0a, char value handle: 0x0014, uuid: 0000ff02-0000-1000-8000-00805f9b34fb
handle: 0x0015, char properties: 0x12, char value handle: 0x0016, uuid: 0000ff03-0000-1000-8000-00805f9b34fb
handle: 0x0018, char properties: 0x0a, char value handle: 0x0019, uuid: 0000ff04-0000-1000-8000-00805f9b34fb
handle: 0x001a, char properties: 0x08, char value handle: 0x001b, uuid: 0000ff05-0000-1000-8000-00805f9b34fb
handle: 0x001c, char properties: 0x12, char value handle: 0x001d, uuid: 0000ff06-0000-1000-8000-00805f9b34fb
handle: 0x001f, char properties: 0x12, char value handle: 0x0020, uuid: 0000ff07-0000-1000-8000-00805f9b34fb
handle: 0x0022, char properties: 0x04, char value handle: 0x0023, uuid: 0000ff08-0000-1000-8000-00805f9b34fb
handle: 0x0024, char properties: 0x1a, char value handle: 0x0025, uuid: 0000ff09-0000-1000-8000-00805f9b34fb
handle: 0x0027, char properties: 0x0a, char value handle: 0x0028, uuid: 0000ff0a-0000-1000-8000-00805f9b34fb
handle: 0x0029, char properties: 0x0a, char value handle: 0x002a, uuid: 0000ff0b-0000-1000-8000-00805f9b34fb
handle: 0x002b, char properties: 0x12, char value handle: 0x002c, uuid: 0000ff0c-0000-1000-8000-00805f9b34fb
handle: 0x002e, char properties: 0x0a, char value handle: 0x002f, uuid: 0000ff0d-0000-1000-8000-00805f9b34fb
handle: 0x0030, char properties: 0x1a, char value handle: 0x0031, uuid: 0000ff0e-0000-1000-8000-00805f9b34fb
handle: 0x0033, char properties: 0x0a, char value handle: 0x0034, uuid: 0000ff0f-0000-1000-8000-00805f9b34fb
handle: 0x0035, char properties: 0x10, char value handle: 0x0036, uuid: 0000ff10-0000-1000-8000-00805f9b34fb
handle: 0x0038, char properties: 0x02, char value handle: 0x0039, uuid: 0000fec9-0000-1000-8000-00805f9b34fb
handle: 0x003b, char properties: 0x08, char value handle: 0x003c, uuid: 0000fedd-0000-1000-8000-00805f9b34fb
handle: 0x003d, char properties: 0x02, char value handle: 0x003e, uuid: 0000fede-0000-1000-8000-00805f9b34fb
handle: 0x003f, char properties: 0x02, char value handle: 0x0040, uuid: 0000fedf-0000-1000-8000-00805f9b34fb
handle: 0x0041, char properties: 0x08, char value handle: 0x0042, uuid: 0000fed0-0000-1000-8000-00805f9b34fb
handle: 0x0043, char properties: 0x08, char value handle: 0x0044, uuid: 0000fed1-0000-1000-8000-00805f9b34fb
handle: 0x0045, char properties: 0x02, char value handle: 0x0046, uuid: 0000fed2-0000-1000-8000-00805f9b34fb
handle: 0x0047, char properties: 0x08, char value handle: 0x0048, uuid: 0000fed3-0000-1000-8000-00805f9b34fb
handle: 0x004a, char properties: 0x10, char value handle: 0x004b, uuid: 00002a37-0000-1000-8000-00805f9b34fb
handle: 0x004d, char properties: 0x0a, char value handle: 0x004e, uuid: 00002a39-0000-1000-8000-00805f9b34fb
handle: 0x0050, char properties: 0x04, char value handle: 0x0051, uuid: 00002a06-0000-1000-8000-00805f9b34fb
[   ][C8:0F:10:34:B7:CA][LE]> 

问题已经解决,
原来是手环被 小米运动 app占用了,
把手机蓝牙禁用问题就解决了。





离线

楼主 #12 2018-05-08 08:22:25

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

QQ20180508082403.png

QQ20180508082125.png

sudo ./rtk_hciattach -n -s 115200 /dev/ttyUSB2 rtk_h5

运行上面这个命令, 初始化 115200, 后面提升到 1.5Mbps





离线

楼主 #13 2018-05-08 09:46:48

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

终于找到了设置波特率到 1.5Mbps的地方, 开始我以为和AP6210B那个套路一样,在命令行参数设定,后来发现根本不是。

跟踪 hciattach_rtk.c    rtk_parse_config_file() 函数,
打开这个文件 /lib/firmware/rtl_bt/rtlbt_config

QQ20180508094641.png

改成 14 C0 52 02 即为 115200 波特率,
即对应代码中的

{0x0252C014, 115200}

用逻辑分析仪观察, 全程 115200 了.





离线

楼主 #14 2018-05-08 10:29:51

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

先初始化RTL8723BS:

sudo ./rtk_hciattach -n -s 115200 /dev/ttyUSB1 rtk_h5

运行btstack测试程序:

RRRR@ubuntu:/opt/btstack/port/posix-h5$ sudo ./gap_inquiry -u /dev/ttyUSB1
Packet Log: /tmp/hci_dump.pklg
[2018-05-08 10:24:36.828] LOG -- hci.c.2800: hci_power_control: 1, current mode 0
[2018-05-08 10:24:36.934] LOG -- btstack_uart_block_posix.c.177: h4_set_baudrate 115200
[2018-05-08 10:24:37.035] LOG -- hci_transport_h5.c.830: UART driver does not provide compatible sleep mode
[2018-05-08 10:24:37.035] LOG -- hci_transport_h5.c.720: resend timeout for 115200 baud: 405 ms
[2018-05-08 10:24:37.035] LOG -- hci.c.3859: BTSTACK_EVENT_STATE 1
[2018-05-08 10:24:37.035] EVT <= 60 01 01

还真是一点反应都没有,
然后进入看逻辑分析仪:
QQ20180508102753.png

QQ20180508102849.png

QQ20180508102928.png

立刻想到了 打开 串口的姿势不正确.





离线

楼主 #15 2018-05-08 10:31:27

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

然而并没有找到设置 open /dev/ttySXXX 的地方.
只好放狗搜索了: https://www.google.com/search?q=btstack+even+parity





离线

楼主 #16 2018-05-08 10:32:41

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

找到这个页面:  https://bluekitchen-gmbh.com/btstack/chipsets/

BCSP
The predecessor of H5. The main difference to H5 is that Even Parity is used for BCSP. To use BCSP with BTstack, you use the H5 transport and can call hci_transport_h5_enable_bcsp_mode

看能不能发现一些端倪。





离线

楼主 #17 2018-05-08 16:57:42

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

最新消息:


hid_keyboard_demo.c
hid_mouse_demo.c   
这两个demo 鼠标键盘是OK的,手机配对成功后,在控制台下可以控制手机.

hog_keyboard_demo.c
hog_mouse_demo.c 
但是这两个demo鼠标键盘怎么按,手机都没反应。





离线

楼主 #18 2018-05-09 20:09:01

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

今天用 V3s uart2 驱动 RTL8723BS, 居然发现驱动不支持 RTS/CTS.





离线

楼主 #19 2018-05-16 15:45:07

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

晕哥 说:

今天用 V3s uart2 驱动 RTL8723BS, 居然发现驱动不支持 RTS/CTS.

这个问题搞定,直接下拉 RTL8723BS 的 CTS/RTS 引脚即可。





离线

楼主 #20 2018-05-16 15:49:17

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

QQ20180516154523.jpeg

QQ20180516154927.png

用 btstack 自带的 le_streamer 接收数据, le_streamer_client 发送数据, 正常运行。





离线

楼主 #21 2018-05-16 15:51:43

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

看来应用程序有着落了

直接在 le_streamer.c 基础上改就是了





离线

#22 2018-05-17 19:25:34

pighead
会员
注册时间: 2018-04-29
已发帖子: 13
积分: 13

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

插入问个话,RTL8723BS模块,用V3S的BSP内核里附带的驱动,wifi部分工作正常,用 ./rtk_hciattach -n -s 115200 /dev/ttyS1 rtk_h5,完全没有收到回应。看引脚上的发给模块的UART TX正常,RX始终高电平。检查了模块的BT RESET引脚为高电平。

离线

楼主 #23 2018-05-17 20:18:16

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

pighead 说:

插入问个话,RTL8723BS模块,用V3S的BSP内核里附带的驱动,wifi部分工作正常,用 ./rtk_hciattach -n -s 115200 /dev/ttyS1 rtk_h5,完全没有收到回应。看引脚上的发给模块的UART TX正常,RX始终高电平。检查了模块的BT RESET引脚为高电平。

这个问题的答案应该在 16 楼





离线

#24 2018-05-17 22:17:40

pighead
会员
注册时间: 2018-04-29
已发帖子: 13
积分: 13

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

发现是模块的复位问题,多复位几次就有进展了:

> ./rtk_hciattach -n -s 115200 /dev/ttyS1 rtk_h5
Realtek Bluetooth init uart with init speed:115200, final_speed:115200, type:HCI UART H5
Realtek Bluetooth :Realtek hciattach version 2.5

Realtek Bluetooth :3-wire sync pattern resend : 1, len: 8

Realtek Bluetooth :3-wire sync pattern resend : 2, len: 8

Realtek Bluetooth :Get SYNC Resp Pkt

Realtek Bluetooth :3-wire config pattern resend : 1 , len: 10
Realtek Bluetooth :Get CONFG resp pkt-active mode

Realtek Bluetooth :H5 init finished

Realtek Bluetooth :config offset(f4),length(8)
Realtek Bluetooth :config baud rate to :4928002, hwflowcontrol:5f, 1
Realtek Bluetooth :config offset(27),length(1)
Realtek Bluetooth :config offset(fe),length(1)
Realtek Bluetooth :config offset(15b),length(4)
Realtek Bluetooth :config offset(1e3),length(1)
Realtek Bluetooth :Get config baud rate from config file:4928002
Realtek Bluetooth :Load FW OK
Realtek Bluetooth :RTK send HCI_VENDOR_READ_RTK_ROM_VERISION_Command

Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :RTK get HCI_VENDOR_READ_RTK_LMP_VERISION_Command

Realtek Bluetooth :rtk get lmp version timeout, retry: 0

Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth ERROR: h5 hdr checksum error!!!
Realtek Bluetooth ERROR: h5 hdr checksum error!!!
Realtek Bluetooth ERROR: h5 hdr checksum error!!!
Realtek Bluetooth ERROR: h5 hdr checksum error!!!
Realtek Bluetooth ERROR: h5 hdr checksum error!!!
Realtek Bluetooth ERROR: h5 hdr checksum error!!!
Realtek Bluetooth :RTK get HCI_VENDOR_READ_RTK_LMP_VERISION_Command

Realtek Bluetooth :rtk get lmp version timeout, retry: 1

暂时卡在这个问题上了

最近编辑记录 pighead (2018-05-17 22:18:46)

离线

楼主 #25 2018-05-17 22:25:24

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

取消屏蔽: hci_transport_h5_enable_bcsp_mode()





离线

#26 2018-05-17 22:36:44

pighead
会员
注册时间: 2018-04-29
已发帖子: 13
积分: 13

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

晕哥 说:

取消屏蔽: hci_transport_h5_enable_bcsp_mode()

还没走到btstack这一步呢,在 ./rtk_hciattach 的时候就报错了。

离线

楼主 #27 2018-05-17 22:38:25

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

对哦,加班加到脑糊涂了。





离线

#28 2018-05-17 23:07:11

daydayup
会员
注册时间: 2017-10-09
已发帖子: 343
积分: 343

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

CTS/RTS 那个引脚下拉没?或者接串口对应引脚。

离线

#29 2018-05-20 00:20:42

pighead
会员
注册时间: 2018-04-29
已发帖子: 13
积分: 13

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

daydayup 说:

CTS/RTS 那个引脚下拉没?或者接串口对应引脚。

都正确连接了,需要时也会给出的低电平。在内核里处理了协议栈的驱动加载之后,可以使用。
然而,目前最头大的问题是,经常启动之后,对于rtk_hciattach的输出,蓝牙模块是完全不给回应的。

Realtek Bluetooth init uart with init speed:115200, final_speed:115200, type:HCI UART H5
Realtek Bluetooth :Realtek hciattach version 2.5
Realtek Bluetooth :3-wire sync pattern resend : 1, len: 8
...
Realtek Bluetooth :3-wire sync pattern resend : 40, len: 8
Realtek Bluetooth ERROR: H5 sync timed out

即使对BT_RST引脚手工进行拉低的reset,再去连接,也是不理的。
彻底断电重启也只是偶尔可以回应。一旦回应则蓝牙各种功能都正常。

离线

楼主 #30 2018-05-20 06:20:27

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

现在是可以使用,有时候rtk_hciattach 发命令rtl8723bs没回应?





离线

#31 2018-05-20 11:14:55

pighead
会员
注册时间: 2018-04-29
已发帖子: 13
积分: 13

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

晕哥 说:

现在是可以使用,有时候rtk_hciattach 发命令rtl8723bs没回应?

5%的情况下启动后可以完整的使用。95%情况下完全不给回应(这种情况拉低bt reset也无效,只能)

另外,请教一下btstack,用posix-h5的时候,看起来是直接用btstack来操作rtl8723bs的蓝牙UART口了,有对chipset或者port做一些什么必要的修改吗?那这时候应该就不需要rtk_hciattach了?

离线

楼主 #32 2018-05-20 11:31:39

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

rtk_hciattach 应该只是下载一段配置文件或者程序补丁,
比如里面可以设置通讯波特率等,
btstack跑起来之后就和rtk_hciattach 一点关系都没有了。





离线

#33 2018-05-20 11:39:42

pighead
会员
注册时间: 2018-04-29
已发帖子: 13
积分: 13

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

读了下源码,发现这个文章讲得比较清晰。  https://blog.csdn.net/zjli321/article/details/52122447

uart接口蓝牙驱动框图

hciattach初始化流程 

uart接口蓝牙的fw download及config配置工作也放到了应用层,这些工作都是由hciattach来实现。串口的使用有一个切换的过程,在初始化的时候,由hciattach使用串口,初始化完成后,把串口切换给hci使用,hci负责与串口交互蓝牙数据,中间还经过了h4/h5协议层,驱动层跟移植相关只有h4/h5协议,若h4/h5使用的是内核自带的协议,那驱动层就不需要做任何的工作。 只有uart接口的蓝牙才需要hciattach工具,hciattach的作用为配置串口,下载fw及config文件,把串口切换给hci_ldisc使用。

离线

楼主 #34 2018-05-20 12:16:04

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

不错,这个图确实比较直观。





离线

#35 2018-05-20 13:44:08

pighead
会员
注册时间: 2018-04-29
已发帖子: 13
积分: 13

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

audio_source_demo 跑起来,声音很卡,试过关掉log,或者:

[2018-05-20 05:40:14.238] LOG -- hci.c.2800: hci_power_control: 1, current mode 0
[2018-05-20 05:40:14.239] LOG -- btstack_uart_block_posix.c.177: h4_set_baudrate 1500000
[2018-05-20 05:40:14.339] LOG -- hci_transport_h5.c.816: enable even parity for BCSP mode
[2018-05-20 05:40:14.340] LOG -- hci_transport_h5.c.830: UART driver does not provide compatible sleep mode
[2018-05-20 05:40:14.341] LOG -- hci_transport_h5.c.720: resend timeout for 1500000 baud: 77 ms
[2018-05-20 05:40:14.341] LOG -- hci.c.3859: BTSTACK_EVENT_STATE 1

离线

#36 2018-05-20 14:06:04

pighead
会员
注册时间: 2018-04-29
已发帖子: 13
积分: 13

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

如果 rtlbt_config 用1.5Mb的原始版本,然后在btstatck初始化时,直接用1.5MB的波特率,声音播放就正常了。

static hci_transport_config_uart_t config = {
    HCI_TRANSPORT_CONFIG_UART,
    1500000, //115200,
    0,  // main baudrate
    1,  // flow control
    "UART1",
};

离线

楼主 #37 2018-05-20 15:25:38

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

不错,继续测试。





离线

#38 2018-07-13 17:45:19

hydys
会员
注册时间: 2018-06-19
已发帖子: 30
积分: 30

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

RTL8723BS的蓝牙固件和wifi固件是分开的,还是使用一个固件?wifi固件使用SDIO加载,BT固件是串口加载?

离线

楼主 #39 2018-07-13 18:10:34

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

hydys 说:

RTL8723BS的蓝牙固件和wifi固件是分开的,还是使用一个固件?wifi固件使用SDIO加载,BT固件是串口加载?

对。





离线

#40 2018-07-19 16:01:07

lorawan666
会员
注册时间: 2018-07-19
已发帖子: 9
积分: 9

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

使用a2dp_sink_demo ,手机连接上开发板后,播放音乐,很卡,大家遇到过这个问题吗? 用的AP6212, 播放采用portaudio,波特率已经设置为3M了

离线

楼主 #41 2018-07-19 16:07:46

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

音视频应用都要一定缓冲区,不能收到就马上播放,
你先把数据全部收到内存或者文件,
看数据是否完整,能不能全部收到数据。





离线

#42 2018-07-19 16:38:50

lorawan666
会员
注册时间: 2018-07-19
已发帖子: 9
积分: 9

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

我看代码里是会把数据放到ringbuf里的,然后再播放的

离线

#43 2018-07-19 16:51:28

sindy
会员
注册时间: 2017-09-09
已发帖子: 146
积分: 146

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

贴一部分  btstack 与  portaudio 代码出来分析一下,看看可能是什么问题引起

离线

#44 2018-07-19 17:02:48

lorawan666
会员
注册时间: 2018-07-19
已发帖子: 9
积分: 9

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

sindy 说:

贴一部分  btstack 与  portaudio 代码出来分析一下,看看可能是什么问题引起

     就是用的example/a2dp_sink_demo.c 这个文件

离线

楼主 #45 2018-07-19 17:04:46

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

这个文件不带portaudio 吧,是怎么整合进去的?





离线

#46 2018-07-19 17:19:31

lorawan666
会员
注册时间: 2018-07-19
已发帖子: 9
积分: 9

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

晕哥 说:

这个文件不带portaudio 吧,是怎么整合进去的?

   自己交叉编译portaudio的库

离线

#47 2018-07-19 17:26:41

lorawan666
会员
注册时间: 2018-07-19
已发帖子: 9
积分: 9

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

晕哥 说:

这个文件不带portaudio 吧,是怎么整合进去的?

保存下来的wav文件 都不正确

离线

楼主 #48 2018-07-19 17:41:22

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

对,你应该把音频流保存为文件,电脑上用cooledit或者adaucity打开原始音频流,看接收数据是否完整。





离线

#49 2018-07-19 17:48:33

lorawan666
会员
注册时间: 2018-07-19
已发帖子: 9
积分: 9

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

晕哥 说:

对,你应该把音频流保存为文件,电脑上用cooledit或者adaucity打开原始音频流,看接收数据是否完整。

  有研究过#ifdef HAVE_AUDIO_DMA 这个宏是做什么用的吗?  我看这个是其他平台的

离线

楼主 #50 2018-07-19 18:08:28

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

这个在 linux 应用用不上,底层驱动干的活儿。





离线

#51 2018-07-20 14:54:43

lorawan666
会员
注册时间: 2018-07-19
已发帖子: 9
积分: 9

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

无法上传附件吗?想把修改的a2dp_sink_demo.c上传上去,大家帮忙看下有什么问题,现在还是卡顿

离线

楼主 #52 2018-07-20 18:53:35

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

可以压缩成 zip 文件上传,或者直接用

〔code〕
〔/code〕

包起来上传





离线

#53 2018-07-23 09:24:28

lorawan666
会员
注册时间: 2018-07-19
已发帖子: 9
积分: 9

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

晕哥 说:

可以压缩成 zip 文件上传,或者直接用

〔code〕
〔/code〕

包起来上传

离线

#54 2018-07-23 11:11:00

lorawan666
会员
注册时间: 2018-07-19
已发帖子: 9
积分: 9

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

lorawan666 说:
晕哥 说:

可以压缩成 zip 文件上传,或者直接用

〔code〕
〔/code〕

包起来上传

https://whycan.cn/files/members/1023/a2dp_sink_demo.zip
各位大神帮忙看下

离线

#55 2018-10-09 15:45:50

WM_CH
会员
注册时间: 2018-08-18
已发帖子: 38
积分: 83

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

晕哥,我用开发板运行a2dp_sink_demo,手机连上开发板蓝牙,然后放音乐,为什么接受的音乐文件保存为wav格式文件时,一直有问题,每次手机放音乐停下来之后,都会形成一个44字节的avdtp_sink.wav文件,其内容为:

cat avdtp_sink.wav
RIFF$WAVEfmt D▒▒ data


.

离线

楼主 #56 2018-10-09 15:49:54

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

WM_CH 说:

晕哥,我用开发板运行a2dp_sink_demo,手机连上开发板蓝牙,然后放音乐,为什么接受的音乐文件保存为wav格式文件时,一直有问题,每次手机放音乐停下来之后,都会形成一个44字节的avdtp_sink.wav文件,其内容为:

cat avdtp_sink.wav
RIFF$WAVEfmt D▒▒ data


.

这个是 wav 文件的头吧, 估计是一个bug.





离线

#57 2018-10-09 15:57:33

WM_CH
会员
注册时间: 2018-08-18
已发帖子: 38
积分: 83

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

晕哥 说:
WM_CH 说:

晕哥,我用开发板运行a2dp_sink_demo,手机连上开发板蓝牙,然后放音乐,为什么接受的音乐文件保存为wav格式文件时,一直有问题,每次手机放音乐停下来之后,都会形成一个44字节的avdtp_sink.wav文件,其内容为:

cat avdtp_sink.wav
RIFF$WAVEfmt D▒▒ data


.

这个是 wav 文件的头吧, 估计是一个bug.


果然,WAV文件的头就是44字节,,,只是后边的PCM数据都没写入文件,是不是我操作不对哦

最近编辑记录 WM_CH (2018-10-09 15:57:49)

离线

楼主 #58 2018-10-09 16:02:58

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

WM_CH 说:
晕哥 说:
WM_CH 说:

晕哥,我用开发板运行a2dp_sink_demo,手机连上开发板蓝牙,然后放音乐,为什么接受的音乐文件保存为wav格式文件时,一直有问题,每次手机放音乐停下来之后,都会形成一个44字节的avdtp_sink.wav文件,其内容为:

cat avdtp_sink.wav
RIFF$WAVEfmt D▒▒ data


.

这个是 wav 文件的头吧, 估计是一个bug.


果然,WAV文件的头就是44字节,,,只是后边的PCM数据都没写入文件,是不是我操作不对哦

是不是没收到数据, 本来程序要写一个完成的wav 文件的,是不是因为没有收到数据导致只有头了?
或者 a2dp编码转 wav编码出问题了?





离线

#59 2018-10-09 16:08:31

WM_CH
会员
注册时间: 2018-08-18
已发帖子: 38
积分: 83

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

晕哥 说:
WM_CH 说:
晕哥 说:

这个是 wav 文件的头吧, 估计是一个bug.


果然,WAV文件的头就是44字节,,,只是后边的PCM数据都没写入文件,是不是我操作不对哦

是不是没收到数据, 本来程序要写一个完成的wav 文件的,是不是因为没有收到数据导致只有头了?
或者 a2dp编码转 wav编码出问题了?

我感觉也像是没收到数据,这块有个PCM的回调函数handle_pcm_data才会调用写wav文件的fwrite。
但最开始的初始化会fopen一个wav文件,估计就是这边只简单的打开了(创建了)一个空wav文件,最后fclose掉了。
其实没有数据写进去,因为没有收到PCM数据。即handle_pcm_data没有被调用。

这怎么解决哦,晕哥



.

cat avdtp_sink.wav
RIFF$WAVEfmt D▒▒ data

离线

楼主 #60 2018-10-09 16:13:11

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

这个我也不会了, 有代码可以多加一些调试语句,看问题出在哪里了.





离线

#61 2018-10-09 16:14:37

WM_CH
会员
注册时间: 2018-08-18
已发帖子: 38
积分: 83

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

晕哥 说:

这个我也不会了, 有代码可以多加一些调试语句,看问题出在哪里了.

好的,我撸撸看,谢晕哥

离线

楼主 #62 2018-10-09 16:16:13

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

WM_CH 说:
晕哥 说:

这个我也不会了, 有代码可以多加一些调试语句,看问题出在哪里了.

好的,我撸撸看,谢晕哥

坐挖坑网等你好消息!





离线

#63 2018-10-10 17:44:16

WM_CH
会员
注册时间: 2018-08-18
已发帖子: 38
积分: 83

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

lorawan666 说:
晕哥 说:

这个文件不带portaudio 吧,是怎么整合进去的?

保存下来的wav文件 都不正确

后来怎么搞得哦,同志

离线

#64 2019-03-01 00:12:34

checkout
会员
注册时间: 2018-11-09
已发帖子: 173
积分: 168

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

什么情况??
ubuntu16.04上,cp2102接rtl8723bs,CTS/RTS做了下拉,配置卡在这里。
issue也有人提到这个问题,还没解决
用的固件是这个:https://github.com/lwfinger/rtl8723bs_bt

root@ubuntu:/home/liaoqingmo/licheepi/rtl8723bs_bt# ./rtk_hciattach -n -s 115200 /dev/ttyUSB0 rtk_h5
Realtek Bluetooth init uart with init speed:115200, final_speed:115200, type:HCI UART H5
Realtek Bluetooth :Realtek hciattach version 2.5 

Realtek Bluetooth :3-wire sync pattern resend : 1, len: 8

Realtek Bluetooth :Get SYNC Resp Pkt

Realtek Bluetooth :Get SYNC pkt-active mode

Realtek Bluetooth :3-wire config pattern resend : 1 , len: 10
Realtek Bluetooth :Get CONFG pkt-active mode

Realtek Bluetooth :Get CONFG resp pkt-active mode

Realtek Bluetooth :H5 init finished

Realtek Bluetooth :config offset(f4),length(8)
Realtek Bluetooth :config baud rate to :4928002, hwflowcontrol:5f, 1
Realtek Bluetooth :config offset(27),length(1)
Realtek Bluetooth :config offset(fe),length(1)
Realtek Bluetooth :config offset(15b),length(4)
Realtek Bluetooth :config offset(1e3),length(1)
Realtek Bluetooth :Get config baud rate from config file:4928002
Realtek Bluetooth :Load FW OK
Realtek Bluetooth :RTK send HCI_VENDOR_READ_RTK_ROM_VERISION_Command

Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :receive hci command complete event with command:1001

Realtek Bluetooth :Read RTK LMP version with Status:0
Realtek Bluetooth :gLmpVersion = 0x8723
Realtek Bluetooth :RTK send HCI_VENDOR_READ_RTK_ROM_VERISION_Command

Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :receive hci command complete event with command:fc6d

Realtek Bluetooth :Read RTK rom version with Status:0
Realtek Bluetooth :rtk_hw_cfg.eversion = 1
Realtek Bluetooth :rtk_get_fw_project_id: opcode 0, len 1, data 1
Realtek Bluetooth :fw_ver 0x1e3ee40e, patch_num 2
Realtek Bluetooth :patch length is 0x5e90
Realtek Bluetooth :start offset is 0x4f00
Realtek Bluetooth :fw: exists, config file: exists
Realtek Bluetooth :baudrate in change speed command: 0x2 0x80 0x92 0x4 

Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :receive hci command complete event with command:fc17

Realtek Bluetooth :Change BD Rate with status:0
Realtek Bluetooth :final_speed 1500000

Realtek Bluetooth :hw flow control enable
Realtek Bluetooth :iEndIndex:96  iLastPacketLen:71 iAdditionpkt:4

Realtek Bluetooth :hci_download_patch tx_index:0 rx_index: -1

Realtek Bluetooth ERROR: patch timerout, retry:

Realtek Bluetooth :3-wire download patch re send:0
Realtek Bluetooth ERROR: patch timerout, retry:

Realtek Bluetooth :3-wire download patch re send:1
Realtek Bluetooth ERROR: patch timerout, retry:

Realtek Bluetooth :3-wire download patch re send:2
Realtek Bluetooth ERROR: patch timerout, retry:

Realtek Bluetooth :3-wire download patch re send:3
Realtek Bluetooth ERROR: patch timerout, retry:

Realtek Bluetooth :3-wire download patch re send:4
Realtek Bluetooth ERROR: patch timerout, retry:

Realtek Bluetooth :3-wire download patch re send:5
Realtek Bluetooth ERROR: patch timerout, retry:

Realtek Bluetooth :3-wire download patch re send:6
Realtek Bluetooth ERROR: patch timerout, retry:

Realtek Bluetooth :3-wire download patch re send:7
Realtek Bluetooth ERROR: patch timerout, retry:

Realtek Bluetooth :3-wire download patch re send:8
Realtek Bluetooth ERROR: patch timerout, retry:

Realtek Bluetooth :3-wire download patch re send:9
Realtek Bluetooth ERROR: patch timerout, retry:

Realtek Bluetooth :3-wire download patch re send:10
Realtek Bluetooth ERROR: patch timerout, retry:

Realtek Bluetooth :3-wire download patch re send:11
Realtek Bluetooth ERROR: patch timerout, retry:

Realtek Bluetooth :3-wire download patch re send:12
Realtek Bluetooth ERROR: patch timerout, retry:

Realtek Bluetooth :3-wire download patch re send:13
Realtek Bluetooth ERROR: patch timerout, retry:

Realtek Bluetooth :3-wire download patch re send:14
Realtek Bluetooth ERROR: patch timerout, retry:

Realtek Bluetooth :3-wire download patch re send:15
Realtek Bluetooth ERROR: patch timerout, retry:

Realtek Bluetooth :3-wire download patch re send:16
Realtek Bluetooth ERROR: patch timerout, retry:

离线

楼主 #65 2019-03-01 08:44:07

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

感觉还是有可能是通讯问题, 用逻辑分析仪抓一下?





离线

#66 2019-03-02 20:47:03

checkout
会员
注册时间: 2018-11-09
已发帖子: 173
积分: 168

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

原来是下拉电阻太大了,换了个470的,结果出现了24楼类似的问题

root@ubuntu:/home/liaoqingmo/licheepi/rtl8723bs_bt# ./rtk_hciattach -n -s 115200 /dev/ttyUSB0 rtk_h5
Realtek Bluetooth init uart with init speed:115200, final_speed:115200, type:HCI UART H5
Realtek Bluetooth :Realtek hciattach version 2.5 

Realtek Bluetooth :3-wire sync pattern resend : 1, len: 8

Realtek Bluetooth :Get SYNC Resp Pkt

Realtek Bluetooth :3-wire config pattern resend : 1 , len: 10
Realtek Bluetooth :Get CONFG resp pkt-active mode

Realtek Bluetooth :H5 init finished

Realtek Bluetooth :config offset(f4),length(8)
Realtek Bluetooth :config baud rate to :4928002, hwflowcontrol:5f, 1
Realtek Bluetooth :config offset(27),length(1)
Realtek Bluetooth :config offset(fe),length(1)
Realtek Bluetooth :config offset(15b),length(4)
Realtek Bluetooth :config offset(1e3),length(1)
Realtek Bluetooth :Get config baud rate from config file:4928002
Realtek Bluetooth :Load FW OK
Realtek Bluetooth :RTK send HCI_VENDOR_READ_RTK_ROM_VERISION_Command

Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :RTK get HCI_VENDOR_READ_RTK_LMP_VERISION_Command

Realtek Bluetooth :rtk get lmp version timeout, retry: 0

Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :RTK get HCI_VENDOR_READ_RTK_LMP_VERISION_Command

Realtek Bluetooth :rtk get lmp version timeout, retry: 1

Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :RTK get HCI_VENDOR_READ_RTK_LMP_VERISION_Command

Realtek Bluetooth :rtk get lmp version timeout, retry: 2

Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :RTK get HCI_VENDOR_READ_RTK_LMP_VERISION_Command

Realtek Bluetooth :rtk get lmp version timeout, retry: 3

Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
^C

离线

#67 2019-03-02 20:48:24

checkout
会员
注册时间: 2018-11-09
已发帖子: 173
积分: 168

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

请问这个问题当时怎么解决的??

pighead 说:

发现是模块的复位问题,多复位几次就有进展了:

> ./rtk_hciattach -n -s 115200 /dev/ttyS1 rtk_h5
Realtek Bluetooth init uart with init speed:115200, final_speed:115200, type:HCI UART H5
Realtek Bluetooth :Realtek hciattach version 2.5

Realtek Bluetooth :3-wire sync pattern resend : 1, len: 8

Realtek Bluetooth :3-wire sync pattern resend : 2, len: 8

Realtek Bluetooth :Get SYNC Resp Pkt

Realtek Bluetooth :3-wire config pattern resend : 1 , len: 10
Realtek Bluetooth :Get CONFG resp pkt-active mode

Realtek Bluetooth :H5 init finished

Realtek Bluetooth :config offset(f4),length(8)
Realtek Bluetooth :config baud rate to :4928002, hwflowcontrol:5f, 1
Realtek Bluetooth :config offset(27),length(1)
Realtek Bluetooth :config offset(fe),length(1)
Realtek Bluetooth :config offset(15b),length(4)
Realtek Bluetooth :config offset(1e3),length(1)
Realtek Bluetooth :Get config baud rate from config file:4928002
Realtek Bluetooth :Load FW OK
Realtek Bluetooth :RTK send HCI_VENDOR_READ_RTK_ROM_VERISION_Command

Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth :RTK get HCI_VENDOR_READ_RTK_LMP_VERISION_Command

Realtek Bluetooth :rtk get lmp version timeout, retry: 0

Realtek Bluetooth :Peer acked invalid packet
Realtek Bluetooth ERROR: h5 hdr checksum error!!!
Realtek Bluetooth ERROR: h5 hdr checksum error!!!
Realtek Bluetooth ERROR: h5 hdr checksum error!!!
Realtek Bluetooth ERROR: h5 hdr checksum error!!!
Realtek Bluetooth ERROR: h5 hdr checksum error!!!
Realtek Bluetooth ERROR: h5 hdr checksum error!!!
Realtek Bluetooth :RTK get HCI_VENDOR_READ_RTK_LMP_VERISION_Command

Realtek Bluetooth :rtk get lmp version timeout, retry: 1

暂时卡在这个问题上了

离线

#68 2019-03-02 23:42:51

checkout
会员
注册时间: 2018-11-09
已发帖子: 173
积分: 168

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

可能是电源纹波太大,导致复位或通讯出问题,明天接个电容再试试。
没逻辑分析仪和示波器,只能靠猜了。。

离线

#69 2019-03-03 15:39:33

checkout
会员
注册时间: 2018-11-09
已发帖子: 173
积分: 168

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

解决了,word天!!!
电源加了1个104滤波电容,问题没解决,不是电压不稳导致复位的情况。
手动在代码上把流控关掉然后就ok了。。(ps:硬件上明明已经做了下拉,为什么不行呢??百思不得其姐)

离线

#70 2019-03-03 17:31:49

checkout
会员
注册时间: 2018-11-09
已发帖子: 173
积分: 168

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

终于把自己挖的坑填完,例子都试了一遍,都ok。18年10月份之前的版本,hid profile的例子有bug,所以出现17楼晕哥所说的问题,新版本已经解决掉了

root@ubuntu:/home/liaoqingmo/licheepi/btstack/port/posix-h5# ./hog_keyboard_demo 
Packet Log: /tmp/hci_dump.pklg
H5 device: /dev/ttyUSB0
Local version information:
- HCI Version  0x0006
- HCI Revision 0x1e3e
- LMP Version  0x0006
- LMP Revision 0xe40e
- Manufacturer 0x005d
Unknown manufacturer / manufacturer not supported yet.
Local name: RTK_BT_4.0
BTstack up and running at 8D:18:D9:58:85:14
Display Passkey: 94205
Disconnected
Display Passkey: 78176
Disconnected
Display Passkey: 124430
Report Characteristic Subscribed 1
Boot Keyboard Characteristic Subscribed 1
sending: k
sending: k
sending: k
sending: k
sending: k
sending: k
sending: k
sending: k
sending: k
sending: k
sending: k

最近编辑记录 checkout (2019-03-03 17:35:03)

离线

楼主 #71 2019-03-03 18:32:47

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

谢谢 @checkout 大神填坑!





离线

#72 2019-03-18 13:35:11

checkout
会员
注册时间: 2018-11-09
已发帖子: 173
积分: 168

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

这两天试了一下test/pts下使用portaudio播放音频流的例子,效果不是很好。
测试环境:ubuntu16.04——usb转串口(cp2102)——rtl8723bs,速率1.5Mbps
cp2102最大支持2Mbps
1.主动连接手机/ipad,偶尔会出现丢包,播放还算流畅。

[00:08:38.913] LOG -- hci_transport_h5.c.749: slip frame time 22 ms for 947 decoded bytes. nomimal time 6 ms
[00:08:38.922] LOG -- hci_transport_h5.c.749: slip frame time 7 ms for 947 decoded bytes. nomimal time 6 ms
[00:08:38.946] LOG -- hci_transport_h5.c.749: slip frame time 6 ms for 766 decoded bytes. nomimal time 5 ms
[00:08:38.946] LOG -- hci_transport_h5.c.556: expected payload len 941 but got 760
[00:08:39.066] LOG -- hci_transport_h5.c.749: slip frame time 120 ms for 947 decoded bytes. nomimal time 6 ms
[00:08:39.076] LOG -- hci_transport_h5.c.749: slip frame time 8 ms for 947 decoded bytes. nomimal time 6 ms
[00:08:39.088] LOG -- hci_transport_h5.c.749: slip frame time 9 ms for 947 decoded bytes. nomimal time 6 ms
[00:08:39.113] LOG -- hci_transport_h5.c.749: slip frame time 22 ms for 947 decoded bytes. nomimal time 6 ms
[00:08:39.123] LOG -- hci_transport_h5.c.749: slip frame time 7 ms for 947 decoded bytes. nomimal time 6 ms

2.手机主动连接蓝牙模块,出现分包发送的情况,断断续续的,音质很差

[00:15:27.482] LOG -- hci_transport_h5.c.749: slip frame time 2 ms for 268 decoded bytes. nomimal time 1 ms
[00:15:27.490] LOG -- hci_transport_h5.c.749: slip frame time 5 ms for 689 decoded bytes. nomimal time 4 ms
[00:15:27.494] LOG -- hci_transport_h5.c.749: slip frame time 2 ms for 268 decoded bytes. nomimal time 1 ms
[00:15:27.517] LOG -- hci_transport_h5.c.749: slip frame time 20 ms for 689 decoded bytes. nomimal time 4 ms
[00:15:27.522] LOG -- hci_transport_h5.c.749: slip frame time 2 ms for 268 decoded bytes. nomimal time 1 ms
[00:15:27.545] LOG -- hci_transport_h5.c.749: slip frame time 20 ms for 689 decoded bytes. nomimal time 4 ms
[00:15:27.550] LOG -- hci_transport_h5.c.749: slip frame time 2 ms for 268 decoded bytes. nomimal time 1 ms
[00:15:27.573] LOG -- hci_transport_h5.c.749: slip frame time 20 ms for 689 decoded bytes. nomimal time 4 ms
[00:15:27.578] LOG -- hci_transport_h5.c.749: slip frame time 3 ms for 268 decoded bytes. nomimal time 1 ms
[00:15:27.586] LOG -- hci_transport_h5.c.749: slip frame time 5 ms for 689 decoded bytes. nomimal time 4 ms
[00:15:27.602] LOG -- hci_transport_h5.c.749: slip frame time 0 ms for 38 decoded bytes. nomimal time 0 ms
[00:15:27.625] LOG -- hci_transport_h5.c.749: slip frame time 21 ms for 689 decoded bytes. nomimal time 4 ms
[00:15:27.630] LOG -- hci_transport_h5.c.749: slip frame time 2 ms for 268 decoded bytes. nomimal time 1 ms
[00:15:27.639] LOG -- hci_transport_h5.c.749: slip frame time 5 ms for 689 decoded bytes. nomimal time 4 ms
[00:15:27.644] LOG -- hci_transport_h5.c.749: slip frame time 3 ms for 268 decoded bytes. nomimal time 1 ms
[00:15:27.667] LOG -- hci_transport_h5.c.749: slip frame time 21 ms for 689 decoded bytes. nomimal time 4 ms
[00:15:27.673] LOG -- hci_transport_h5.c.749: slip frame time 3 ms for 268 decoded bytes. nomimal time 1 ms
[00:15:27.696] LOG -- hci_transport_h5.c.749: slip frame time 20 ms for 689 decoded bytes. nomimal time 4 m

离线

#73 2019-03-18 13:56:49

checkout
会员
注册时间: 2018-11-09
已发帖子: 173
积分: 168

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

晕哥有没试过rtl8723bs,3Mbps速率的情况
上传一下portaudio播放的代码,解压到/port/posix-h5/目录下,直接make就行
需要安装portaudio
不会是我连接的杜邦线太长了吧(捂脸.jpg)
test.rar

最近编辑记录 checkout (2019-03-18 14:02:29)

离线

楼主 #74 2019-03-18 14:49:50

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

我记得没有测试过3Mbps码率。

这个portaudio怎么测试?





离线

#75 2019-03-18 16:12:14

checkout
会员
注册时间: 2018-11-09
已发帖子: 173
积分: 168

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

ubuntu下,apt-get install portaudio19-dev安装portaudio,然后把上面那个test文件解压到你的btatack路径/port/posix-h5/下,进入/你的btstack路径/port/posix-h5/test,直接make就行
上面的test代码默认使用/dev/ttyUSB0,速率1.5Mbps。晕哥你可以试试,看看这个坑怎么填

最近编辑记录 checkout (2019-03-18 16:14:43)

离线

楼主 #76 2019-03-18 17:50:55

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

我的RTL8723模块好像找不到了,捂脸。。。





离线

#77 2019-03-19 01:44:15

checkout
会员
注册时间: 2018-11-09
已发帖子: 173
积分: 168

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

移植到zero上跑起来了,播放完全没杂音,也没丢包情况,分包发送应该是sbc配置的问题。
使用正常!!
ubuntu使用cp2102转串口连接,出现杂音,可能是cp2102的问题导致丢包出现杂音

最近编辑记录 checkout (2019-03-19 01:47:21)

离线

#78 2019-03-19 08:24:05

jimmy
会员
注册时间: 2017-10-29
已发帖子: 316
积分: 315

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

checkout 说:

移植到zero上跑起来了,播放完全没杂音,也没丢包情况,分包发送应该是sbc配置的问题。
使用正常!!
ubuntu使用cp2102转串口连接,出现杂音,可能是cp2102的问题导致丢包出现杂音

厉害厉害

是用 73 楼这代码搞定的吗?

checkout 说:

晕哥有没试过rtl8723bs,3Mbps速率的情况
上传一下portaudio播放的代码,解压到/port/posix-h5/目录下,直接make就行
需要安装portaudio
不会是我连接的杜邦线太长了吧(捂脸.jpg)
test.rar


再请教一下, portaudio 在 V3s 是作为一个独立进程运行, 还是静态链接到你的app ?
底层还是一样调用 alsalib ?

离线

#79 2019-03-19 09:07:47

checkout
会员
注册时间: 2018-11-09
已发帖子: 173
积分: 168

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

是的,73楼的代码可以直接跑起来的,有兴趣可以试试。
portaudio是和alsalib一样作为库调用,很方便。
迟点开个贴整理一下步骤

jimmy 说:
checkout 说:

移植到zero上跑起来了,播放完全没杂音,也没丢包情况,分包发送应该是sbc配置的问题。
使用正常!!
ubuntu使用cp2102转串口连接,出现杂音,可能是cp2102的问题导致丢包出现杂音

厉害厉害

是用 73 楼这代码搞定的吗?

checkout 说:

晕哥有没试过rtl8723bs,3Mbps速率的情况
上传一下portaudio播放的代码,解压到/port/posix-h5/目录下,直接make就行
需要安装portaudio
不会是我连接的杜邦线太长了吧(捂脸.jpg)
test.rar


再请教一下, portaudio 在 V3s 是作为一个独立进程运行, 还是静态链接到你的app ?
底层还是一样调用 alsalib ?

最近编辑记录 checkout (2019-03-19 09:11:45)

离线

#80 2019-03-19 09:20:50

jimmy
会员
注册时间: 2017-10-29
已发帖子: 316
积分: 315

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

多谢 @checkout 分享宝贵经验!

离线

楼主 #81 2019-03-19 09:49:21

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

多谢 @checkout 分享宝贵经验!
坐等大神发教程





离线

#82 2019-06-27 15:06:48

Diablo
会员
注册时间: 2019-06-27
已发帖子: 1
积分: 1

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

正在搞这个协议栈,mark一下

离线

#83 2020-03-20 14:41:41

木子猫
会员
注册时间: 2018-03-27
已发帖子: 63
积分: 22.5

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

晕哥 说:

先初始化RTL8723BS:


运行btstack测试程序:


还真是一点反应都没有,
然后进入看逻辑分析仪:
https://whycan.cn/files/members/3/QQ20180508102753.png

https://whycan.cn/files/members/3/QQ20180508102849.png

https://whycan.cn/files/members/3/QQ20180508102928.png

立刻想到了 打开 串口的姿势不正确.


这个最后怎么解决的呢 现在也是卡在EVT <= 60 01 01  后面就不动了

离线

#84 2020-09-19 15:14:39

TeveT
会员
注册时间: 2019-07-01
已发帖子: 148
积分: 91

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

checkout 说:

晕哥有没试过rtl8723bs,3Mbps速率的情况
上传一下portaudio播放的代码,解压到/port/posix-h5/目录下,直接make就行
需要安装portaudio
不会是我连接的杜邦线太长了吧(捂脸.jpg)
test.rar

大佬,如何设置3M的通信波特率? 修改rtl8723bs_bt的驱动代码么,我看波特率设置数值是从芯片那边读过来的。
Realtek Bluetooth :config baud rate to :4928002, hwflowcontrol:5f, 1

对应的:
    {0x04928002, 1500000},

咋改成 3000000 呢? 我这边是这样,高码率流的曲子, 会出现偶发的沙沙响,正在想办法查。

离线

#85 2020-09-19 16:46:31

TeveT
会员
注册时间: 2019-07-01
已发帖子: 148
积分: 91

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

checkout 说:

晕哥有没试过rtl8723bs,3Mbps速率的情况
上传一下portaudio播放的代码,解压到/port/posix-h5/目录下,直接make就行
需要安装portaudio
不会是我连接的杜邦线太长了吧(捂脸.jpg)
test.rar

看到配置文件了,
/lib/firmware/rtl_bt/rtlbt_config

这个东西是可以自己随意改的么?
# cat /lib/firmware/rtl_bt/rtlbt_config | hexdump
0000000 ab55 8723 0031 00f4 0108 0000 0500 0050
0000010 0c00 1000 8002 0492 c550 19ea 1be1 aff1
0000020 015f 0ba4 0027 6301 00fe 0101 015b 0b04
0000030 0b0b e30a 0101 0000
0000037


看到了 0000010 0c00 1000 8002 0492 c550 19ea 1be1 aff1
其中的04928002 我可以自己改? 想设置高一点,一点点排除问题。

离线

#86 2020-09-19 16:50:37

smartcar
会员
注册时间: 2018-02-19
已发帖子: 735
积分: 735

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

没有文档只能一顿瞎改了,笑哭.gif

离线

#87 2020-09-19 17:37:22

TeveT
会员
注册时间: 2019-07-01
已发帖子: 148
积分: 91

Re: 郁闷,没有搞定 Ubuntu下用btstack协议栈驱动 RTL8723BS

smartcar 说:

没有文档只能一顿瞎改了,笑哭.gif

我搞了一顿下来,我把vlc 搞进文件系统,直接用vlc 播放flac 源文件,也是一样的有沙沙响,看来不是蓝牙的问题了,可能是V3S 内置的CODEC的问题了,奇怪。

那这还咋玩……硬件上有器件要换一下? 感觉像是频率引起的。

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn