CSR Bluetooth headset solution development
Bluetooth headsets provide a secure and cordless way to send and receive calls and transmit voice. This method is particularly convenient when it is inconvenient for the user to hold the mobile phone. Users of Bluetooth headsets can move freely within a range that can maintain a connection, and can communicate with a variety of devices, making them widely used.
This article conducts design research and implementation of Bluetooth headsets based on the CSR Blue Core5Multi2MediaExternal (CSRBC52MME) embedded system. CSR is the world's leading supplier of Bluetooth technology. Its Blue Core5 embedded platform has a high-performance on-chip DSP and is the only Bluetooth platform that can support third-party audio enhancement software, providing excellent sound quality and best-in-class information. The noise ratio reaches -90dB, and it leads the industry in terms of power consumption and radio design. It is currently the preferred development platform for headphone products. Through the 2.4GHz short-range radio frequency wireless communication technology in the ISM band, using short-range, low-cost wireless connections to replace cable connections, Bluetooth technology provides a unified connection for existing data networks and small peripheral device interfaces. The Bluetooth headset follows the Bluetooth headset specification and hands-free specification defined by the Bluetooth SIG organization, realizing wireless communication between the headset and the audio gateway.
1. Introduction to Bluetooth headset hardware platform
The system design is a mid-to-high-end Bluetooth headset product with mono-channel dual-microphone noise reduction processing. It has a separate power switch, a multi-function button and a three-color LED light. It uses CSR's Blue Core5Multimedia chip with external FLASH memory. , using the CSR Blue Lab headset software development system, supports integrated speech synthesis, that is, text-to-speech (TTS) function, and speech recognition function, which is highly customizable and flexible in function, and has different packaging methods for selection , has a dedicated DSP audio noise cancellation processor and rich peripheral interfaces such as I2C, USB, UART, PCM/I2S/SPDIF and other interfaces. The Bluetooth headset hardware module block diagram is shown in Figure 1. Key features of the BC52MME platform:
(1) The 16b MCU has a speed of 100MHz and can support up to 32Mb external FLASH and 48kB internal RAM. (2) Ultra-low power Kalimba DSP co-processor, 64MIPS, can integrate third-party software to provide high-quality audio processing such as noise cancellation. (3) Dual-channel 16bADC and DAC processing, supporting dual MIC and dual SPK, can achieve stereo audio. (4) It has rich interfaces such as UART, USB, SPI, PCM, I2S/SPDIF, which can realize connection and communication with external devices. (5) There are 2 dedicated LED interfaces that can achieve a fade-in and fade-out flickering effect.
2. Software platform for Bluetooth headsets
The Bluetooth headset software is designed and independently developed based on the Blue Core embedded development environment Blue Lab software platform provided by CSR. The Blue Lab software platform is a software development tool developed by CSR Company for its high-end chips. It includes the platform's related development tools, Bluetooth protocol library and part of the source code. The design uses the software platform provided by CSR to customize and develop Bluetooth headset products. Bluetooth headset software can be divided into two parts: Bluetooth protocol system part and Bluetooth headset standard application part.
2.1 Bluetooth headset protocol stack
As shown in Figure 2, the Bluetooth protocol system can be divided into 4 layers, including core protocol layer, alternative cable protocol layer, phone control protocol layer and optional protocol layer. Each layer also has some specific protocols:
(1) Core protocol: Baseband, Link Management Protocol (LMP), Logical Link Control and Adaptation Protocol (L2CAP), Service Discovery Protocol (SDP); (2) Alternative cable protocol: Serial Circuit Emulation Protocol (RFCOMM) ; (3) Telephone Control Protocol: Binary Telephone Control Specification (TCSBi2nary) and AT2 Command (AT2Command); (4) Optional Protocol: Point-to-Point Protocol (PPP), Object Exchange Protocol (OBEX), etc. The Host Controller Interface (HCI) provides a command interface to access the baseband controller, link controller, and hardware status and control registers. In Figure 2, the HCI layer is located under L2CAP.
2.2 Bluetooth headset specifications
The application specifications in the Bluetooth headset software include Headset Profile Protocol (HSP), Hands-free Profile Protocol (HFP), Advanced Audio Profile Protocol (A2DP), Audio Video Remote Control Profile Protocol (AVRCP), etc. At present, the headset profile protocol and the hands-free profile protocol are the content that must be supported in the Bluetooth headset; and the high-end stereo Bluetooth headset will increase support for the audio profile protocol and the audio and video remote control profile protocol.
3. Bluetooth headset software design and implementation
3.1Blue Core task architecture and message flow
In the Blue Core embedded development environment, on the one hand, you can configure the corresponding project compilation and development environment to facilitate software debugging; on the other hand, you can use the Bluetooth protocol library and part of the source code, that is, Blue Core's Firmware firmware and some Bluetooth protocol files, such as As shown in Figure 3. Based on the embedded software layered structure, you only need to focus on the development and implementation of application profiles. In Figure 3:
(1) Task: Each Task corresponds to a task, which corresponds to a basic block. Multiple blocks form an application. Each task completes the interface connection between the application and the Blue Core firmware and is responsible for the corresponding function. Each task has a message processing function and corresponding task status structure. All tasks are run in a single process, and multiple tasks are not allowed to be processed in parallel.
(2) Message: Message is the transfer of information between tasks. Its parameter form and meaning are as follows: Task t: identifies the destination address of the message, which is the pointer of the receiving task; Message Id id: the label of the message, when the task receives the message Used to identify and call the corresponding function function; Message pay load: The payload of the message should include the required status data, so that the processing function can handle it correctly. The payload's memory is freed after the message is delivered. The payload content is optional and can be set to Null. After the message is sent, all messages must enter the message FIFO queue for queuing and forwarding processing. The Message Loop function controls the main scheduling loop and processes dispatch task messages; each dispatch checks the first message in the queue and dispatches it to the corresponding task. Its calling location is shown in the pseudocode section in Section 3.3.
3.2 MMI Design and Task Design
The Bluetooth headset software is based on the Blue Core embedded software hierarchical architecture and message mechanism, and the software application design and implementation is based on the requirements of the man machine interface (MMI). The human-machine interface MMI design of Bluetooth headsets is related to its product positioning and product complexity. The Bluetooth headset designed in this article supports the headset profile protocol and the hands-free profile protocol, realizes the function of voice calls, and completes product compatibility testing. The design of MMI mainly includes 4 parts: button function, LED indication, sound prompt and Bluetooth status operation process. According to the design requirements of MMI, it is divided into: I/O input management task (io in Task), I/O output management task (io out task), Bluetooth profile management task (prof Task), headset profile management task (hshf Task) 6 application tasks: , audio driver management task (audio Task) and battery power management task (batt Task).
(1) I/O input management task: ① Initialize the task, apply for the task memory and initialize variables and the message processing function of the task; ② Initialize the input I/O port configuration and initialize it according to the table of I/O input port attributes; ③ Initialize I/O input events according to the event list; ④ Manage and send corresponding trigger events to different tasks.
(2) I/O output management task: ① Initialize the task, apply for the task memory and initialize variables and the message processing function of the task; ② Initialize and configure the output I/O port, initialize according to the table of I/O output attributes; ③I/ O output management, including PIO and dedicated LED port, is processed in the task processing function according to the LED flashing mode and timing requirements.
(3) Bluetooth profile management tasks: ① Initialize the task, apply for the task memory and initialize variables and message processing functions of the task; ② Initialize and manage the operating mode of the headset, initialize the Bluetooth protocol stack Connection Task; ③ Manage Bluetooth status, register, Query the Bluetooth status transfer management of Bluetooth connection device processes such as pairing, authentication, and reconnection; perform corresponding MMI display according to the Bluetooth status.
(4) Headset profile management tasks: ① Initialize the task, apply for the task memory and initialize variables and message processing functions of the task; ② Initialize the Bluetooth profile protocols HSP and HFP; ③ Manage Bluetooth headset call processing, which is one of the important tasks of Bluetooth headsets. .
(5) Audio driver management tasks: ① Initialize the task, apply for the task memory and initialize variables and the message processing function of the task; ② Adjust the gain of the Speaker and Mic; ③ Configure the SCO audio channel of the platform. (6) Battery power management task ① Initialize the task, apply for the task memory and initialize variables and the message processing function of the task; ② Charging power display and algorithm; ③ Discharge power display and algorithm.
Different functions are distinguished according to tasks, which is easy to understand and has flexibility and scalability. Task modules can be added or blocked by task module. Communication between tasks can be achieved through the FIFO message mechanism of Blue Core, thereby realizing the Bluetooth headset function, as shown in Figure 4.
3.3 Bluetooth headset initialization and working process
On the BC52MMExt chip, the VREGENABLEH pin is compatible with a maximum voltage of 4.9V. When the pin is pulled up to a high level pulse for 2s, the Firmware runs and internally locks the pull-up, after which the pin can be used as an input pin. After the Firmware is started, the VM virtual machine is then run, thus providing a running environment for the Application Task.
After initializing the headset, the headset first enters the pairing mode (pai2ringmodeorinquiryscanmode), and the AG (audio gateway) queries (inquiry mode) the currently pairable devices. After the headset device is found, password authentication verification can be performed. After the authentication is passed, the headset and AG can Make a service connection (SLC establishment). After that, the Bluetooth headset enters normal standby mode and can perform incoming calls, dialing and other related operations that comply with HSP/HFP profile specifications. The headset can pass the PTS (front line test system) functional test and conforms to the Bluetooth headset HSP and HFP profile protocol communication processes.
Conclusion
Based on the CSR Bluetooth embedded platform design, the Bluetooth headset call function is implemented. Through in-depth research on the Blue Core5Multimedia embedded system platform, the platform has the characteristics of high performance, high flexibility, and customizability, and is suitable for the development of high-end headphone products. Bluetooth headset products on this platform will definitely win the high-end customer market and have important application significance.
The above are the details of the Bluetooth headset solution introduced to you by Shenzhen Zuchuang Microelectronics Co., Ltd. If you have development and design needs for Bluetooth headsets, you can rest assured to leave it to us. We have rich experience in customized electronic product development and can evaluate the development cycle and IC price as soon as possible, and can also calculate PCBA quotations. We are agents of many domestic and foreign chips: Songhan, Yingguang, Jieli, Ankai, Quanzhi, realtek, including MCU, voice IC, Bluetooth IC and modules, and wifi modules. Our development capabilities cover software and hardware design such as PCB design, microcontroller development, Bluetooth technology development, software customization development, APP customization development, WeChat public account development, etc. It can also undertake the research and development of smart electronic products, home appliance solution design, beauty instrument development, Internet of Things application development, smart home solution design, TWS headset development, Bluetooth headset speaker development, children's toy solution development, and electronic education product development.
Proposal recommendation
- TOP