Application of Bluecore5-MM in car Bluetooth device

1 Introduction Bluetooth is a wireless technology for voice and data communication over short distances. Compared with other wireless protocols, the Bluetooth standard is more complete, defining the implementation specifications of various applications. To ensure interoperability between devices, its application and development are increasingly widespread. Here, Bluecore5-MM (referred to as BC5-MM) is used to design a car Bluetooth device. Firstly, the device characteristics of BC5-MM, the hardware structure of the Bluetooth subsystem of the car Bluetooth device and the circuit design of the RF part are introduced. Then, the development of BC5-MM specific software is introduced in detail from the aspects of single chip development mode, communication implementation mechanism and UART communication. And implementation.

This article refers to the address: http://


2 Bluetooth subsystem structure The car Bluetooth device adopts the dual processor structure design of BC5-MM+32-bit external embedded processor to realize functions such as USB music playback, Bluetooth hands-free, Bluetooth streaming media music playback, phone book synchronization download, etc. 1 is a structural block diagram of the Bluetooth subsystem. The key features of BC5-MM are as follows:

(1) Integrate the RF and baseband control of the Bluetooth system, the 16-bit MCU of the RISC structure and the Kalimba DSP with a performance of up to 64 MI/s in a single chip format. The MCU implements the Bluetooth protocol stack and application software, and the DSP implements audio and speech processing and encoding and decoding of streaming media music files.
(2) Independent audio input and output system, built-in microphone bias circuit, and a certain audio output drive capability.
(3) The wireless transmission power is up to +8 dBm, the receiving sensitivity is -90 dBm, no external amplifier is needed, and only the printed circuit board antenna can meet the requirements of the Bluetooth RF specification Class 2, and the communication distance is up to 10 m.
(4) It has various interfaces such as USB, I2C, SPI, UART, etc., and external external host controller realizes complex application. The BC5-MM communicates with the host processor via the UART. The SPI interface is used for BC5-MM program debugging, downloading, and key PSKEY attribute settings.
(5) Built-in LD0 (Low-Dropout Linear Regulator) can generate 1.8 V and 1.5 V voltages from an external 3.3 V voltage, of which 1.8 V is mainly for I/O port, 1 The .5 V is primarily powered by the core, simplifying circuit design. Figure 2 shows the circuit design of the Bluetooth RF subsystem. Since the BC5-MM integrates the Bluetooth Modem, only the external filter and antenna can realize the RF subsystem circuit design. Here, the filter uses DBF81F104, which is the reliability of SOSHIN designed for Bluetooth communication. Select 5 ppm high-performance RF crystal oscillator and adjust the key PSKEY-Crystal Trim value of BC5-MM to control the initial carrier offset to a small extent, to ensure that the Bluetooth mobile phone can search for the device and connect it to the pair.

3 Single-chip development method BC5-MM has two development methods: one is to use BC5-MM as Bluetooth baseband transmission device, the protocol stack and application software are all realized by external main processor; the other is to use BC5-MM as Bluetooth The single chip implements the protocol stack and some application software, and completes related applications through communication with the external main processor. This design uses the latter development method. The software development of BC5-MM is carried out on the Roadtunes-SDK provided by CSR. The Roadtunes-SDK provides the completed protocol stack and profile library, software solutions for vehicle applications, and virtual machine VM. For embedded development in a single chip mode. Develop software based on this Solution, including hands-free calling, signal strength, battery power and SMS prompts, streaming music playback and remote control, TAGID3 reading Bluetooth player music, ringtone alert, download Bluetooth mobile phone Inside the phone book, automatic connection, etc. The following describes the principles and development of the relevant mechanisms from the implementation mechanism of communication and UART communication.


4 Communication Implementation Mechanism The Bluetooth communication and local communication of BC5-MM are based on the Stream mechanism. It regards the data transmission path as a pipeline. The population of the pipeline is Source, indicating the source of the data, and the exit is Sink, indicating that the data is sent from here. Shield the underlying implementation to implement data transfer in a simple manner. Its main features are serial and FIFO (first-in-first-out) mechanisms. When developing, first ensure that there is enough space allocated to send and receive data to ensure that the current pointer is correct. Taking the hands-free channel data transmission as an example, firstly, the SinkClaim (HfpSink, DataLength) function is used to allocate the DataLength length memory to the transmission port HfpSink of the hands-free channel, and then it is judged whether the allocation is successful. If the allocation is successful, the memory is assigned and then passed through the SinkFlush. (HfpSink, DataLength) sends the data out. Note that once the data of Length of DataLength is allocated by SinkClaim, the data of its length must be sent out by Sink-Flush, so that the send pointer of HfpSink can be transferred to the correct position. Otherwise, the memory will be allocated for HfpSink by SinkClaim next time, and sent by SinkFlush. The transmitted data on the hands-free channel will use the last allocated memory data, causing a subsequent series of transmission errors. Therefore, it is necessary to deeply understand the communication implementation mechanism of BC5-MM to complete the correct data transmission.


5 UART communication Due to the limited resources of the BC5-MM processor, simple applications can be implemented, but complex applications require an external processor. The BC5-MM+ external main processor is used here. This architecture uses UART communication to implement the interaction between processors and comprehensively complete related applications.
The UART communication protocol includes the underlying transport and application two-part protocol. The transport protocol defines the frame format and selects the appropriate check mechanism and error handling mechanism. The frame format is: frame header (0x55+0Xaa) + id (indicating the meaning of the frame) + dlc (data field length) + data (data Field) +checksum (16-bit arithmetic checksum). According to the frame format, the UART driver combines the frame transmission and parses the received data frame, and the combined frame is relatively simple. The parsing frame defines the corresponding state according to the frame structure to resolve the ID and data with the concept of the state machine.
As a kind of serial communication, UART can cause communication errors when the sampling time interferes. In order to ensure the reliability of data communication, it is necessary to check the data to judge whether the communication is correct, and there are CRC cyclic redundancy check and arithmetic and check. A common way, the fastest CRC operation is the look-up table method, but it consumes a considerable amount of memory space. For CRC16, the table is 256 words or 512 bytes, and the global variable of BC5-MM application software can't exceed 256 words. Obviously, it can't meet the CRC16 operation requirement of table lookup method. The least memory is the bitwise algorithm. The memory consumption is small, but the operation speed is slow. The use of arithmetic summation and verification method not only saves the checksum calculation time, improves the real-time performance, but also satisfies the data verification needs.
The application protocol first defines the corresponding signals according to the specific application, and then combines and encapsulates the respective signals in the frame. The state quantity and the control quantity are defined in the form of bit signals to control the frame length. The development of application protocols is closely related to specific applications, and it is necessary to define corresponding interaction methods for specific applications.


6 UART communication phone book download in the phone book download application is a large-scale data transmission, which requires considerable memory for parsing and storage. The BC5-MM downloads the phone book data from the mobile phone via Bluetooth and transmits it to the main CPU through the UART. The main CPU parses the phone book and stores it. The application requirements are resolved correctly and completely and quickly. The main processor side adopts a multi-tasking mechanism, and the UART receiving task receives the phone book data transmitted by the BC5-MM, and the phone book parses the task and data and stores it.
In this way, if the receiving is fast and the parsing is slow, the data will be overwritten, resulting in incomplete parsing. In order to ensure the correct and complete analysis, the interaction mode is defined: BC5-MM downloads data from the mobile phone and transmits it to the main processor through the UART frame VCARD. After the main processor is parsed, the UART frame NEXT_VCARD_REQ notifies the BC5-MM to continue downloading, and then transmits. To the main processor.
This approach guarantees complete transmission and parsing, but at a slow rate. For users of Bluetooth in-vehicle devices, the speed of the phone book transfer is a key indicator, so the interaction method needs to be improved to improve the speed of the phone book download. Through analysis, it is found that the interaction between the BC5-MM and the main CPU takes a lot of time, and the number of interactions can be reduced to speed up. This requires redefining the UART frame VCARD and modifying the UART communication accordingly, and taking BC5-MM to download multiple downloads from the mobile phone. The package phone book data defines the identifiers of the first package, the intermediate package, the unique package and the last package, and is parsed after the main processor end is combined. After the analysis is completed, the main processor notifies the BC5-MM to continue downloading, which proves that this way The number of interactions can be greatly reduced, thereby increasing the download speed.


7 Conclusion The author combines the experience of the developed car Bluetooth device to introduce the Bluetooth subsystem structure design and BC5-MM device characteristics. From the single-chip development mode, communication implementation mechanism and UART communication, the design features and implementation methods of BC5-MM software are expounded, which provides design reference and reference for engineers who use BC5-MM development.

Programmable Power Meter

Programmable Power Meter,Electrical Load Survey Power Meter,Load Survey Power Meter,Programmable Electrical Load Survey Power Meter

TRANCHART Electrical and Machinery Co.,LTD , https://www.tranchart-electrical.com