|
|
@@ -44,4 +44,75 @@ static const uint8_t init_script[] = {
|
|
|
|
|
|
> 每条命令的长度都为 0xc2,可能需要在末尾填充 0 ?
|
|
|
|
|
|
-初始化的 HCI 包为 `packages/csr8311.pklg` ,可以通过 Wireshark 打开。
|
|
|
+初始化的 HCI 包为 `packages/csr8311.pklg` ,可以通过 Wireshark 打开。
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+> CSR chipset do not require an actual init script in general, but they allow to configure the chipset via so-called PSKEYs. After setting one or more PSKEYs, a warm reset activates the new setting.
|
|
|
+>
|
|
|
+> **BD Addr** can be set via PSKEY. A fixed address can be provided if the chipset has some kind of persistent memory to store it. Most USB Bluetooth dongles have a fixed BD ADDR.
|
|
|
+>
|
|
|
+> **SCO data** can be configured via a set of PSKEYs. We haven't been able to route SCO data over HCI for UART connections yet.
|
|
|
+>
|
|
|
+> **Baud rate** can be set as part of the initial configuration and gets actived by the warm reset.
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+bluez/tools/hciattach.c : csr() 函数里有 CSR 的初始化代码。
|
|
|
+
|
|
|
+`/* 10 seconds should be enough for initialization */`
|
|
|
+
|
|
|
+```
|
|
|
+Read CSR chip build ID:
|
|
|
+01 00 fc 17 c2 00 00 09 00 00 00 19 28 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
|
|
+build ID: resp[15] - resp[14]
|
|
|
+
|
|
|
+Read CSR chip current baudrate:
|
|
|
+01 00 fc 13 c2 00 00 09 00 01 00 02 68 00 00 00 00 00 00 00 00 00 00
|
|
|
+
|
|
|
+Set CSR chip baudrate:
|
|
|
+01 00 fc 13 c2 02 00 09 00 02 00 xx xx 00 00 00 00 00 00 00 00 00 00
|
|
|
+
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+CSR Vendor Read BuildID Command 等同于 HCI Command Read_Local_Version_Information 。
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+warm reset 在上电状态(warm)下强行复位芯片,使之前的配置信息生效(例如更改的波特率),该命令不会有 RSP 返回。
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+该命令大部分时间会返回 RSP
|
|
|
+
|
|
|
+低 13 位用于配置波特率:
|
|
|
+
|
|
|
+
|
|
|
+$$
|
|
|
+Value = (baudrate / 244.140625)
|
|
|
+$$
|
|
|
+Bluez 里用的公式为:
|
|
|
+$$
|
|
|
+(baudrate * 64 + 7812) / 15625;
|
|
|
+$$
|
|
|
+高三位用于配置停止位和奇偶校验,一般都是 0 。
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+CSR8311 成功初始化:
|
|
|
+
|
|
|
+
|