This is a serial interface and there are several protocols used, e.g. H4, H5, BCSP. The H4 protocol is probably the most common and uses serial control lines. The H5 protocol is a three-wire protocol so no serial control lines are used. There are also a number of proprietary protocols, BCSP (BlueCore Serial Protocol) being an example.
To support flexible partitioning of software between the host and the Bluetooth subsystem, and to enhance the speed of product design, CSR offers a multi-protocol communications link known as BlueCore Serial Protocol (BCSP). BCSP provides a more sophisticated option than currently defined Bluetooth serial protocols: H4/UART or H3/RS232.
Bcsp bluecore serial protocol
BCSP (BlueCore Serial Protocol) is serial protocol for communicationbetween Bluetooth device and host. This protocol is required for nonUSB Bluetooth devices based on CSR BlueCore chip, including PCMCIA andCF cards.
BlueZ supports the core Bluetooth protocols, including host controlinterface (HCI), logical link control and adaptation protocol (L2CAP),personal area networking (PAN), service discovery protocol (SDP),synchronous connection oriented (SCO) audio and serial port emulation(RFCOMM). It also comes bundled with a bunch of user space dæmons andconfiguration tools.
BlueZ supports the different user profiles described by the Bluetoothspecification. BlueZ BNEP (Bluetooth Network Encapsulation Protocol)implements Ethernet emulation, which lets TCP/IP run directly overBluetooth. The BNEP module, together with a user mode dæmon calledpand implements Bluetooth PAN. BlueZ RFCOMM allows serial portapplications, such as terminal emulators, and protocols, such as point-to-pointprotocol (PPP), to run unchanged over Bluetooth. The RFCOMM module,along with a user mode dæmon called dund implements Bluetoothdial-up networking.
The Bluetooth specification defines the use of UART and USB transportmechanisms to transfer HCI packets between a Bluetooth device and ahost system. For UART interfaces, the main protocols available to encapsulate HCI packets are H4/UART and Blue Core SerialProtocol (BCSP). Whereas H4 serves as the standard method fortransmitting Bluetooth data over a UART interface, BCSP is aproprietary protocol from CSR that supports error checking andretransmission. BlueZ supports both H4 and BCSP. If the Bluetooth chipused on your board has a UART interface to the host processor and isprogrammed to encapsulate HCI packets using BCSP, you need toinform the BlueZ stack of this. Do so using hciattach: hciattach ttySxbcsp, where x is the UART channel number connected to theBluetooth chip. The BlueZ UART link driver hci_uart now talks to thechip using BCSP and passes the Bluetooth data to and from the BlueZstack.
where ttySx is the physical or virtual serial device over which PPPruns and connection-script is a file in the /etc/ppp/peers/directory that contains the AT command sequences exchanged betweenpppd and the service provider in order to establish a link. Afterestablishing the link connection and completing authentication, PPPstarts a network control protocol (NCP). Internet protocol controlprotocol (IPCP) is the NCP used for running IP. Once IPCP successfullynegotiates IP addresses, PPP starts talking with the TCP/IP stack.Your device now is ready to run TCP/IP applications over the GPRSlink.Listing 2 is an example PPP connection script for connecting yourdevice to a GPRS service provider.
To open the ttySA1 serial port and initialize the module @ 230400 baud, 8E1, no hardware flow control, the following command is used in Affix:#btctl open_uart /dev/ttySA1 bcsp 230400 pareven,low
But it wouldn't be much sense for Deep Sleep if it can't be used with UART, would it? So CSR cameup with their own proprietary serial protocol - BlueCore Serial Protocol (BCSP). BCSP can coexist with Deep Sleep quite nicely, since it has a mechanism for recovering from lost or corrupted data. If BlueCore receives a BCSP packet while in Deep Sleep mode, packet still can be lost or corrupted, but RX line activity wakes the chip up, and since BCSP supports CRC checksums and packet retransmission, the packet gets re-sent after certain time-out (normally 250ms, adjustable via PSKEY_UART_SEQ_TIMEOUT (0x405) key),by which time the chip is awake and ready to receive.There's a work-around against loosing 250ms on every retransmission - after long period ofinactivity just send a short neutral packet to wake it up (i.e. BCSP ACK packet), wait for10ms and then start transmitting the data. Or alternatively, use PIO or CTS lines to signalcondition and wake the chip up instead of sending wake-up packet to UART. Of course, there'redrawbacks of using BCSP too, one of them is protocol overhead that consumes some of thebandwidth. I guess that's the price to pay for reliable connection.
Having a donor USB dongle in my hands with aim to prove the concept, I wired UART RX and TX, module's +3.3V and ground linesfrom USB dongle with flying leads to TTLRS232 transceiver (old cell phone serial cable collecting dust in my closet was donating the transceiver chip and DB9 connector assembly).The CSR module was still soldered to dongle's PCB (and powered up fromUSB lines). The transceiver chip was powered from CSR module. On initial bootup, BC2 configures itself to use USB protocol. Then I reprogrammed it overUSB bus to use UART BCSP protocol by writing new key values into RAM persistent store (that is important to notice, sinceprogramming keys into RAM can't damage module permanently - if something goes wrong, power-cyclingwould erase RAM and old keys (from flash memory) will be used again. After changing protocol to BCSP,warm reset (which doesn't erase RAM) was issued and viola! I can get BCSP sync packets and establishBCSP connection over serial line! The patient is still on life support, but at least it can breath! ;)Please see pictures below...
Il Serial Line Internet Protocol (protocollo di interfaccia per linea seriale, SLIP), è un protocollo di rete di Livello datalink, usato per stabilire connessioni dirette tra due nodi specie su connessioni seriali asincroni via modem o diretti con l'ausilio di un null-modem. In passato costituiva uno degli standard più usati per l'IP commutato. 2ff7e9595c
Comments