Application of USB interface in smartphone base speaker based on Cortex-M0 processor

Publisher:CelestialSoulLatest update time:2018-03-20 Source: eefocusKeywords:Cortex-M0 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

    The ARM Cortex-M0 processor is the smallest ARM processor currently available. M0 makes full use of ARM Thumb technology, multi-stage pipeline technology, low-power optimization design technology and the latest high-density silicon flash memory technology. It is the smallest, lowest energy consumption and most energy-efficient ARM processor currently available on the market. The processing power consumption is very low, the number of gates is small, and the code occupies a small space, allowing MCU developers to obtain the performance of a 32-bit processor at the price of an 8-bit processor. Chip manufacturers develop M0 products for certain special applications, including highly integrated 32-bit microcontrollers, USB microcontrollers, CAN bus microcontrollers, controllers with USB ports and CAN bus, etc., which are widely used in various fields.

 

    With the rapid development of smart phones, mobile Internet, and cloud storage technology, people's lives have also changed. From information acquisition to shopping, entertainment, and life, including food, clothing, housing, transportation, travel, shopping, and entertainment, a simple and easy-to-use docking speaker has gradually entered people's lives. To design a cost-effective speaker, the USB microcontroller with M0 as the core is a good choice as the main control chip of this type of circuit system.

Iphone speaker dock

    The audio flow of the base speaker is:

Audio Process of Base Speaker

    Taking the iPhone base speaker as an example, the use of digital audio transmission can ensure that the sound source is not distorted by external interference , and say goodbye to the problems of poor sound quality and easy interference of traditional base speakers. The MCU must obtain digital audio through USB, and the endpoint requirements of its USB transmission are: the protocol occupies 3 USB endpoints, another 2 control endpoints and 2 audio endpoints. In this way, more than 7 endpoints of USB interface are basically required to meet the design requirements of this type of solution. The audio decoder is received through I2S, so the MCU must have an I2S interface at the same time, and it must also be controlled through the I2C interface.

    In addition to audio transmission, in order to achieve rich product functions, corresponding functions can be added according to people's needs. For example, LCD screens, infrared remote control panels, various function buttons, etc. are people's most basic choices, or designers can use their imagination to design the base speakers into remote-controlled car models, cute dolls, powerful Transformers... This puts more demands on the MCU. Chip manufacturers may have anticipated that they will face various types of requirements in the application of M0. Then MCUs with M0 as the core basically have rich peripheral interfaces prepared. As shown in the block diagram:

Cortex M0 has rich on-chip resources

    In addition to being able to run at up to 72 MHz Cortex  ?-M0 core, the above also has built-in 36K/68K bytes of Flash memory , 12K/20K bytes of SRAM, and 4K bytes of ROM for storing ISP boot code to ensure smooth operation of the system.

    The USB 2.0 full-speed device controller and transceiver comply with the USB 2.0 full-speed device specification and support control/block/interrupt/isochronous transfer types. The USB device controller has a total of 8 configurable endpoints. Each endpoint can be configured as input or output type. All operations including control transfer, bulk transfer, interrupt transfer and isochronous transfer are supported. The endpoint control module can also be used to manage data sequence synchronization, endpoint status, current start address, current transaction status and data cache status of each endpoint. It just meets the needs of the basic 7 configuration endpoints of the base speaker.

    The I2S controller consists of the I2S protocol and the external audio CODEC interface. Two 8-byte FIFOs are used for read and write channels respectively, which can handle word sizes from 8 to 32 bits. The DMA controller handles the transfer of data between the FIFO and the memory.

    Two sets of I2C controllers, I2C is a two-wire, bidirectional serial bus that implements data exchange between devices through a simple and effective connection method. The I2C standard is a multi-host bus, including conflict detection and arbitration to prevent data corruption when two or more hosts try to control the bus at the same time. In this way, the MCU controls external devices such as audio decoders and encryption chips. The SPI interface can be connected to external devices such as LCD screens that require SPI communication. The integration of UART, PS/2, GPIO and other interfaces enriches user needs.

 

    The clock controller integrated in the MUC provides the clock source for the entire chip, including the system clock and all peripheral device clocks. One of the external 4~24 MHz high-speed crystal oscillators can provide the clock source for interfaces such as USB, and a 22.1184MHz internal clock can be applied to the clock transmitted by the UART interface. There is also an internal 10 KHz low-speed oscillator. Therefore, the MCU provides great flexibility in setting the working clock.

    The controller also controls power consumption through separate clock on/off, clock source selection and frequency divider. After the CPU enables the PWR_DOWN_EN bit, the Cortex-M0 core executes the WFI instruction and the chip enters power-down mode. When a wake-up interrupt occurs, the chip exits power-down mode. In power-down mode, the clock controller turns off the external 4~24 MHz high-speed crystal oscillator and the internal 22.1184 MHz high-speed oscillator to reduce the power consumption of the entire system.

    Based on the resources of this MCU, we can build a basic base speaker system.

Application of Cortex-M0's USB interface in smartphone base speakers

    First, the protocol is authenticated. The protocol data is input through the USB of the MCU and transferred to the I2C to be decrypted by the decoding chip and then sent back to the host computer via USB for authentication. Once the authentication is passed, the next step of audio transmission can be carried out.

The PCM code     of the digital audio data input from the USB is sent to the 512-byte SRAM of the NUC123 USB, and then moved to the system's SRAM through PDMA 1. The PCM code is then moved to the I2S cache through PDMA2, and then transmitted to the audio decoder through I2S for playback. The system SRAM reaches 20K bytes, which has enough space for audio synchronization or audio data calculations, etc. Since the system integrates a 6-channel PDMA, the efficiency of audio synchronization transmission is greatly improved. Through the HID protocol specified by the host computer, the relevant buttons are designed using the GPIO interface of the MCU, and the command characters specified by the host computer are sent to the host computer to realize functions such as player control.

    Such a low-power and cost-effective docking audio platform has been built. Different audio decoders, amplifiers , cabinets and speakers can be selected according to different needs, and a simple docking audio design is completed. MCU has many idle interfaces, and related functions can be added according to different requirements, such as Bluetooth communication, LCD display, infrared remote control... This requires the imagination of consumers and designers.


Keywords:Cortex-M0 Reference address:Application of USB interface in smartphone base speaker based on Cortex-M0 processor

Previous article:Calculation of the timing time of the general timer of the STM32 microcontroller
Next article:Design of terminal hardware and software platform based on AT91SAM9260

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号