AN4227 Application note Audio hub demonstration kit supporting the MP45DT02, MP34DB01, and MP34DT01 microphones Introduction This document provides a brief description of the audio hub demonstration board STEVALMKI138V1 available from www.st.com along with simple steps to use the board with the APWorkbench software tool. The purpose of this board is twofold: 1. It can be used as an STSmartVoice interface. In combination with this board (STEVAL-MKI126Vx), it manages the signal coming from the onboard microphones. The STSmartVoice board hosts up to six microphones and the STA321MPL microphone processor converts the PDM signals from them into the common I2S audio format. (For additional details, please refer to AN4146 “STSmartVoice demonstration board STEVAL-MKI126Vx” available from www.st.com). Basically the audio hub, using the STM32F107RC microcontroller, is able to program the STA321MPL device via the I2C and decodes the I2S into a USB stream in order for the PC to manage the sound captured by the microphones. Multiple features for using the microphones on the STSmartVoice demonstration board are listed and accessible thanks to the APWorkbench software tool. 2. It can be used as a USB sound card. As shown in Figure 1, the audio hub board hosts either the MP45DT02 or MP34DT01 (top-port digital microphones) and the MP34DB01 which is a bottom-port digital microphone. The board is able to host both types of microphones as shown below. The task of the STM32 microcontroller is to decode the PDM signals coming from the microphones and stream the audio via the USB. Figure 1. STEVAL-MKI138V1 Entire board (top and bottom views) MP45DT02 MP34DB01 MP34DT01 Microphone section (zoom) March 2013 DocID024106 Rev 1 1/13 www.st.com Contents AN4227 Contents 1 Hardware description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2 Software description (getting started with APWorkbench) . . . . . . . . . . 6 2.1 STSmartVoice interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.2 USB voice recorder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Appendix A Schematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Appendix B Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3 2/13 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 DocID024106 Rev 1 AN4227 Hardware description The connection is done through a USB cable that supplies the board and also streams the audio collected by the microphones to the PC. Figure 2. Block diagram - microphone USB demonstration board ST Audio HUB MCLK Mic_Vdd SEL MIC_DATA12 Vdd Vdd Out Clk L/R J1 LRCK BICK SDO12 SDO34 SDO56 Mic_Vdd MIC_CK 12.288 MHz SDA SCL 1 Hardware description Out gnd I2C I2S µC_Vdd L/R gnd STM32F107RC SEL Mic_Vdd SPI SPI_CK MIC_CK Clk SEL MCO J5 Mic_Vdd Timer USB I/F 3.3V 12.288 MHz OSC µC_Vdd Mic_Vdd Regulator 3.3V 5V USB Connector D1 D2 D3 D4 D5 Referring to Figure 2: • The supply section of the board is made up of one voltage regulator that steps down the 5 V of the USB connection to 3.3 V. The supply voltage ranges of the digital microphones are given below in Table 1. Table 1. Supply voltage range of microphones • Part number Min. Typ. Max. MP45DT02 1.64 1.8 3.6 MP34DB01 1.64 1.8 3.6 MP34DT01 1.64 1.8 3.6 Regarding the microphone sections, the MEMS outputs are a PDM signal, which is a high-frequency (1 to 3.25 MHz) stream of 1-bit digital samples. The “Functionality” section of each microphone datasheet (available on www.st.com) provides details concerning the connections of the microphone in single channel configuration or stereo configuration by setting the LR pin. This pin sets the validity of the output data on the high level of the clock or on the low level as shown in Table 2. Table 2. L/R channel selection L/R Clock low Clock high GND Data valid High impedance VDD High impedance Data valid DocID024106 Rev 1 3/13 Hardware description AN4227 In this board the microphones are used in stereo configuration, so the two digital outputs are shorted (Mic_DATA12, refer to schematic) and the two MEMS LR pins must be respectively set one to GND and the other one to VDD. On the board, the resistors R1 and R13 already set the LR pin of the microphones, R1 and R42 give the user the possibility to change the MEMS polarity. Note that the PCB sections hosting the MEMS microphones are detachable. This option has been considered to let the user put the microphones in the desired position (i.e. for a display application in which the microphones are placed at the edges of the display). • The hardware relative to the STM32F107RC microcontroller has been chosen to support both modes of usage listed above (either STSmartvoice interface or USB sound card). The board hosts two clock devices, the first one is a crystal quartz at 12.288 MHz and the other one is an active oscillator at 12.288 MHz as well. The first one, connected to the OSC_IN and OSC_OUT pins, serves to generate the entire internal clock of the microcontroller (STM32 clock tree). Once the clock tree has been set, all the internal peripherals of the microcontroller have their own clocks. If the ST audio hub is used as the STSmartVoice interface, the internal clock tree provides the clock for the USB, for the I2C cell, for the I2S cell and also provides the clock for the daughterboard through the MCO pin (12.288 MHz as well). The microcontroller is used to program the STA321MPL via I2C and also is used to decode the I2S coming from the daughterboard and to stream the audio via the USB. For this reason dedicated STM32 pins are connected to the connector physically interfacing the STSmartVoice board. An additional clock device (active oscillator) has been mounted for debugging purposes only. In the default configuration, the selector composed of R42, R21, and R17 is set to connect the MCLK trace to the MCO pin (refer to the schematic). If the ST Audio hub is used as a USB sound card, the clock tree is used to provide the MIC_CK and SPI_CK thanks to internal timers and a dedicated loop trace on the board (short between pin 21 and pin 27). The STM32 samples the output data of the microphones using the synchronous serial port (SPI1). The microphone signal MIC_DATA12 is a stereophonic signal and the SPI must be able to sample both channels. Since MIC_DATA12 is synchronous with its clock, SPI_CK must be doubled. Summarizing, the timer generates: – MIC_CK = 3.072 MHz – SPI_CK = 6.144 MHz The supported microcontroller USB interface allows streaming the audio on the USB peripheral, rendering this demonstration board compatible with any laptop or desktop. 4/13 DocID024106 Rev 1 AN4227 Hardware description • Some LEDs have been mounted on the board, thus allowing a real-time check of what the demonstration board is performing. LEDs D1 and D5 give feedback about the supply and successful enumeration while the purpose of D2, D3 and D4 is to check the status of the board. D2 and D3 will alternately blink while the STM32 is in DFU mode (before the dedicated firmware has been correctly loaded into the flash memory of the microcontroller). Checking the PC “Device Manager”, the STM device in DFU mode will appear (see Figure 3 below). Figure 3. Device manager when STM32 is in DFU mode The audio hub boards are provided by ST with the firmware already loaded; the DFU section has been included to allow a firmware update by the user with no need for flash loader kits and is directly supported by the APWorkbench tool. The status of LEDs D1-D5 is summarized in the table below. Table 3. LED status D1 ON: USB enumeration successful D2 D3 Blinking: DFU mode Blinking: DFU mode Off: Firmware correctly Off: Firmware correctly downloaded downloaded DocID024106 Rev 1 D4 D5 Off: Firmware correctly ON: Board supplied downloaded 5/13 Software description (getting started with APWorkbench) 2 AN4227 Software description (getting started with APWorkbench) The firmware of the ST audio hub supports two different audio frameworks. In the first case the board can be used as the interface for the STSmartVoice, allowing the I2C programming and the decoding of the I2S coming from the daughterboard. When the board is used for this purpose, it will be recognized as "STAudioHub interface"(a). The other possibility is the use of the board essentially as a PDM decoder that allows the couple of microphones on the board to be interfaced directly to the PC via the USB in which case the board will be recognized by the operative system as "STM32 Capture PDM mode". The APWorkbench tool allows choosing one of these modes by following these simple steps: 2.1 1. Run the tool 2. Click on the "MEMS Microphones Demo Kit" button 3. Select the mode in the "Microphone Kit selection" box 4. Click on the "Run Selected Application…" button STSmartVoice interface If the user wants to operate the board as the STSmartVoice interface, the corresponding mode must be selected as shown in Figure 4. Figure 4. APWorkbench launch wizard (STSmartVoice demonstration kit) a. APWorkbench is compatible with Windows XP, Windows Vista and Windows 7. 6/13 DocID024106 Rev 1 AN4227 Software description (getting started with APWorkbench) After this selection, the setup wizard panel of the STSmartVoice supported configurations will appear. For a detailed description of the meaning of the configurations listed in Figure 5, please refer to AN4146 "STSmartVoice demonstration board STEVAL-MKI126Vx" available on www.st.com. Figure 5. STSmartVoice - setup wizard DocID024106 Rev 1 7/13 Software description (getting started with APWorkbench) 2.2 AN4227 USB voice recorder If the user wants to operate the board as a USB voice recorder, the proper mode must be selected as depicted in Figure 6. Figure 6. APWorkbench launch wizard (USB digital voice recorder) Once this selection has been run, a dedicated panel will appear. If the user wants to operate the board as a USB voice recorder, the tool shows the panel performing either FFT or scope monitoring. It is also possible to record the signal sensed by the microphones on the board. Figure 7. USB voice recorder - FFT monitoring 8/13 DocID024106 Rev 1 Schematics AN4227 Appendix A Figure 8. Board schematic (power supply and JTAG connector) <Power Supply> UC_VDD VCC_USB UC_VDD 1 R23 10k 1K 1 D1 LED-1 180 2 E R38 1k 2 C41 10nF C40 1 VCC_USB D5 LED-1 2 DocID024106 Rev 1 J7 VBUS 1 D- 2 D+ 3 ID 4 GND 5 Mini TypeB U8 1 I/O1 I/O1 6 2 GND VBUS 5 3 I/O2 I/O2 4 USBLC6-2 2 2 R6 22 R12 22 1 3 1 2 2 UC_VDD A_VDD BEAD 1 C39 100nF L6 BEAD L1 U4 L4 2 MIC_VDD BEAD LD1117 + C3 10uF C49 100nF 1 1 R8 1.5K 33uF + 2 BEAD R26 4 E R22 36k GND Q2 B 1 2 Vout 2 2 2 R24 1 Vin 1 C 1 3.3V L3 INDUCTOR2 R27 0R0 NC Q1 B 2 USB_DISC VCC_USB 1 C 2 Vout R25 47k 2 1 1 USBDM 1 USBDP C5 100nF <JTAG> UC_VDD 1 1 R2 10K 1 R3 10K 2 R4 10K 2 UC_VDD 2 JTMS JTCK STM32_I2S_BICK STM32_I2S_LRCK NRST 2 3 6 5 8 7 1 R15 10K 2 9 J2 9/13 Schematics JRST 4 10 1 JP3 JP 5X2_HEADER 2 1 <Mangusta option> R39 0R0 NC C29 2.2uF STM32_I2S_BICK 2 L/R MIC1LR MIC1LR 2 4 MIC_DATA12 DATA VDD 1 GND 2 LR 3 GND VDD 6 DOUT 5 CLK 4 0R MIC_DATA12 R42 MIC1CK 1 MIC_VDD MP45DT01 MP34DT01 2 1 R28 100 C26 15pF MIC_CK C25 15pF R18 0R 2 3 4 I2S_BICK 5 6 7 8 9 10 44 43 11 12 USBDM 13 14 MCLK 15 2 MCO TP2 39 TP3 38 STM32_I2S_MCLK 37 STM32_I2S_MCLK 36 STM32_I2S_DATA12 1 R1 0R NS SDA FAIL MIC2LR C6 NS C7 10pF 5 CLK 4 2 C20 15pF R29 C19 100 15pF MIC_DATA12 MIC2CK 1 MIC_CK U11 MIC2CK U9 VDD 4 DATA 5 4 3 3 L/R 2 CLK 1 MP34DB01 3 4 CLK DATA L/R VDD 2 1 MIC2LR MIC_VDD MP34DT01 4 MIC_DATA12 1 3 2 1 MIC_CK MIC_DATA12 J6 CON4 12.288_CK MIC_DATA12 MIC_CK 3 1 J10 CON4 2 MIC_VDD 1 J8 CON4 R14 0R0 UC_VDD DOUT C8 10pF J15 2 2 6 MCO 4 MIC_VDD STM32_LQFP64 GND STM32_I2S_MCLK 3 STM32_I2S_LRCK LR 3 VDD MP45DT01 12.288_CK 2 33 2 16 MIC_VDD STM32_I2S_BICK GND STBY 35 34 R41 0R RESET 1 2 42 40 R19 100 2 1 USBDP USB_DISC 41 1 R20100 C21 100nF U1 I2S_LRCK GND 45 2 SCL MUTE VSS_CAP C22 10uF MIC_VDD I2S_DAT_34 5 JTMS 0R 46 2 50 51 1 GND 47 LED3 UC_VDD I2S_DAT_12 I2S_DAT_56 2 C16 4.7uF 4 VDD_1 48 32 PB11 31 30 29 VSS_1 PB12 PB10 PA2 PB2 PB13 PB1 3.3V C15 100nF MIC_VDD <Connectors> 49 PA14 PA15 52 PC11 PC10 53 54 55 PB3 PD2 PC12 58 57 60 56 PB4 PB5 PB7 PB6 59 62 63 61 PB8 BOOT0 PB9 PB14 PA1 2 L5 BEAD VSS_3 PA0-WKUP PB0 16 PB15 27 LED2 VDDA 28 15 PC6 17 1 C9 100nF 14 VSSA 26 C10 10uF LED1 MIC_CK PC7 PC5 L2 820nH PC8 PC3 PC4 13 PC9 PC2 25 2 PC1 PA3 1 PA8 U5 24 12 PA9 PC0 PA7 11 NRST PA6 10 FAIL PA10 23 MUTE PD1_OSC_OUT 22 9 PA11 PA5 8 STBY PD0_OSC_IN PA4 7 RESET PA12 20 A_VDD C4 100nF PC15-OSC32_OUT 21 BUT1 TACT2 2 NRST VDD_3 64 6 PA13 VDD_4 UC_OSC_OUT VSS_2 PC14-OSC32_IN VSS_4 2 UC_OSC_IN 5 VDD_2 PC13-TAMPER-RTC 19 4 R5 10K VBAT 18 3 1 DocID024106 Rev 1 2 CLK 5 UC_VDD JTCK R17 1 LED3 LED2 LED1 UC_VDD 1 3 C23 100nF U2 0R NS C27 100nF XT_ACTIVE 12.288_CK MCO C1 100nF 4 C24 10uF MIC_VDD SCL JRST 1 MIC_VDD SDA 2 UC_VDD 1 R13 MIC1CK C31 18pF STM32_I2S_LRCK R33 10K C18 4.7uF CLK MP34DB01 U10 Y1 12.288MHz 2 3 R21 C17 100nF R34 1k DATA 2 0R NS 1 D4 LED-1 1 STM32_I2S_DATA34 R40 2 D3 LED-1 2 R35 1k 2 1 D2 LED-1 U3 1 0R NS 1 2 1 2 2 UC_VDD R32 100 4 MIC_DATA12 L/R 1 R31 100 UC_OSC_OUT 2 1 R30 100 1 VDD 1 R37 10k UC_VDD UC_VDD 1 C2 18pF UC_OSC_IN 1 3 GND UC_VDD C28 2.2uF 1 <Microphones> MIC_VDD 1 5 UC_VDD <Clock Generators> U7 2 VSS_CAP GND <uController STM32> AN4227 Figure 9. Board schematic (STM32 microcontroller, Mangusta option, clock generators, connectors, and microphones) J9 CON4 R16 0R NS MIC_DATA12 C11 100nF C12 4.7uF C14 4.7uF C13 100nF VSS_CAP TP1 SPI1_Clock 2 1 R36 0R0 I2S_DAT_12 I2S_DAT_34 I2S_BICK I2S_LRCK 2 2 0R0 R9 0R0 R7 1 1 0R0 R11 2 1 2 0R0 R10 1 STM32_I2S_DATA12 STM32_I2S_DATA34 STM32_I2S_BICK STM32_I2S_LRCK Schematics 10/13 AN4227 Appendix B Layout Layout Figure 10. Board layout - top view Figure 11. Board layout - bottom view DocID024106 Rev 1 11/13 Revision history 3 AN4227 Revision history Table 4. Document revision history 12/13 Date Revision 22-Mar-2013 1 Changes Initial release. DocID024106 Rev 1 AN4227 Please Read Carefully: Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any time, without notice. All ST products are sold pursuant to ST’s terms and conditions of sale. Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no liability whatsoever relating to the choice, selection or use of the ST products and services described herein. No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein. UNLESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. ST PRODUCTS ARE NOT AUTHORIZED FOR USE IN WEAPONS. NOR ARE ST PRODUCTS DESIGNED OR AUTHORIZED FOR USE IN: (A) SAFETY CRITICAL APPLICATIONS SUCH AS LIFE SUPPORTING, ACTIVE IMPLANTED DEVICES OR SYSTEMS WITH PRODUCT FUNCTIONAL SAFETY REQUIREMENTS; (B) AERONAUTIC APPLICATIONS; (C) AUTOMOTIVE APPLICATIONS OR ENVIRONMENTS, AND/OR (D) AEROSPACE APPLICATIONS OR ENVIRONMENTS. WHERE ST PRODUCTS ARE NOT DESIGNED FOR SUCH USE, THE PURCHASER SHALL USE PRODUCTS AT PURCHASER’S SOLE RISK, EVEN IF ST HAS BEEN INFORMED IN WRITING OF SUCH USAGE, UNLESS A PRODUCT IS EXPRESSLY DESIGNATED BY ST AS BEING INTENDED FOR “AUTOMOTIVE, AUTOMOTIVE SAFETY OR MEDICAL” INDUSTRY DOMAINS ACCORDING TO ST PRODUCT DESIGN SPECIFICATIONS. PRODUCTS FORMALLY ESCC, QML OR JAN QUALIFIED ARE DEEMED SUITABLE FOR USE IN AEROSPACE BY THE CORRESPONDING GOVERNMENTAL AGENCY. Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any liability of ST. ST and the ST logo are trademarks or registered trademarks of ST in various countries. Information in this document supersedes and replaces all information previously supplied. The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners. © 2013 STMicroelectronics - All rights reserved STMicroelectronics group of companies Australia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan Malaysia - Malta - Morocco - Philippines - Singapore - Spain - Sweden - Switzerland - United Kingdom - United States of America www.st.com DocID024106 Rev 1 13/13