Library to handle the X-NUCLEO-CCA02M1 MEMS Microphones Expansion Board.

Dependencies:   ST_I2S ST_FREQUENCY_DIVIDER USBDEVICE

Dependents:   HelloWorld_CCA02M1 HelloWorld_CCA02M1_mbedOS HelloWorld_CCA02M1 Karaoke_CCA01M1_CCA02M1_mbedOS

Fork of X_NUCLEO_CCA02M1 by ST Expansion SW Team

MEMS Microphones Library

Library to handle the X-NUCLEO-CCA02M1 MEMS Microphones Expansion Board. A single board allows to record a standard 2-channel stereo signal as an array of PCM samples (16 bit/sample); in principle, it could make use of six additional MEMS microphones to realize a 8-channel audio system.


Microphones configuration

Currently the configurations supported are the following:

  • Stereo@48KHz
  • Stereo@44.1KHz (CD audio quality)
  • Stereo@32KHz
  • Stereo@16KHz
  • Stereo@8KHz
  • Mono@48KHz
  • Mono@44.1KHz
  • Mono@32KHz
  • Mono@16KHz
  • Mono@8KHz

Mono configurations need a Jumper connecting PB_5 and PB_13 on the Morpho connector to properly work.


Platform compatibility

  • This board can be currently used with the Nucleo F4 Family only, please see the ST_I2S library compatibility for further information.
  • The library is compatible both with mbed OS 5.x and mbed classic 2.x (to work with mbed classic, the main application has to import the "events" library, which is not included into the "mbed" library).


I2S Peripheral Usage

By default this board makes use of the I2S peripheral available on Nucleo boards.


Acquiring through the USB

In order to acquire the recorded PCM audio channel with an audio SW on a PC, please connect the expansion board to a USB port of the PC, and the Nucleo board to a USB power supply.

Committer:
davide.aliprandi@st.com
Date:
Fri Apr 21 10:33:08 2017 +0200
Revision:
2:9f389fd8fb2e
Child:
15:17bdadc6aa9c
Aligned to ARM mbed codinmg style; OpenPDM2PCM middleware added.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
davide.aliprandi@st.com 2:9f389fd8fb2e 1 /**
davide.aliprandi@st.com 2:9f389fd8fb2e 2 ******************************************************************************
davide.aliprandi@st.com 2:9f389fd8fb2e 3 * @file OpenPDMFilter.h
davide.aliprandi@st.com 2:9f389fd8fb2e 4 * @author CL
davide.aliprandi@st.com 2:9f389fd8fb2e 5 * @version V1.0.0
davide.aliprandi@st.com 2:9f389fd8fb2e 6 * @date 9-September-2015
davide.aliprandi@st.com 2:9f389fd8fb2e 7 * @brief Header file for Open PDM audio software decoding Library.
davide.aliprandi@st.com 2:9f389fd8fb2e 8 * This Library is used to decode and reconstruct the audio signal
davide.aliprandi@st.com 2:9f389fd8fb2e 9 * produced by ST MEMS microphone (MP45Dxxx, MP34Dxxx).
davide.aliprandi@st.com 2:9f389fd8fb2e 10 ******************************************************************************
davide.aliprandi@st.com 2:9f389fd8fb2e 11 * @attention
davide.aliprandi@st.com 2:9f389fd8fb2e 12 *
davide.aliprandi@st.com 2:9f389fd8fb2e 13 * <h2><center>&copy; COPYRIGHT 2013 STMicroelectronics</center></h2>
davide.aliprandi@st.com 2:9f389fd8fb2e 14 *
davide.aliprandi@st.com 2:9f389fd8fb2e 15 * Licensed under MCD-ST Image SW License Agreement V2, (the "License");
davide.aliprandi@st.com 2:9f389fd8fb2e 16 * You may not use this file except in compliance with the License.
davide.aliprandi@st.com 2:9f389fd8fb2e 17 * You may obtain a copy of the License at:
davide.aliprandi@st.com 2:9f389fd8fb2e 18 *
davide.aliprandi@st.com 2:9f389fd8fb2e 19 * http://www.st.com/software_license_agreement_image_v2
davide.aliprandi@st.com 2:9f389fd8fb2e 20 *
davide.aliprandi@st.com 2:9f389fd8fb2e 21 * Unless required by applicable law or agreed to in writing, software
davide.aliprandi@st.com 2:9f389fd8fb2e 22 * distributed under the License is distributed on an "AS IS" BASIS,
davide.aliprandi@st.com 2:9f389fd8fb2e 23 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
davide.aliprandi@st.com 2:9f389fd8fb2e 24 * See the License for the specific language governing permissions and
davide.aliprandi@st.com 2:9f389fd8fb2e 25 * limitations under the License.
davide.aliprandi@st.com 2:9f389fd8fb2e 26 *
davide.aliprandi@st.com 2:9f389fd8fb2e 27 ******************************************************************************
davide.aliprandi@st.com 2:9f389fd8fb2e 28 */
davide.aliprandi@st.com 2:9f389fd8fb2e 29
davide.aliprandi@st.com 2:9f389fd8fb2e 30 /* Define to prevent recursive inclusion -------------------------------------*/
davide.aliprandi@st.com 2:9f389fd8fb2e 31
davide.aliprandi@st.com 2:9f389fd8fb2e 32 #ifndef __OPENPDMFILTER_H
davide.aliprandi@st.com 2:9f389fd8fb2e 33 #define __OPENPDMFILTER_H
davide.aliprandi@st.com 2:9f389fd8fb2e 34
davide.aliprandi@st.com 2:9f389fd8fb2e 35 #ifdef __cplusplus
davide.aliprandi@st.com 2:9f389fd8fb2e 36 extern "C" {
davide.aliprandi@st.com 2:9f389fd8fb2e 37 #endif
davide.aliprandi@st.com 2:9f389fd8fb2e 38
davide.aliprandi@st.com 2:9f389fd8fb2e 39
davide.aliprandi@st.com 2:9f389fd8fb2e 40 /* Includes ------------------------------------------------------------------*/
davide.aliprandi@st.com 2:9f389fd8fb2e 41
davide.aliprandi@st.com 2:9f389fd8fb2e 42 #include <stdint.h>
davide.aliprandi@st.com 2:9f389fd8fb2e 43
davide.aliprandi@st.com 2:9f389fd8fb2e 44
davide.aliprandi@st.com 2:9f389fd8fb2e 45 /* Definitions ---------------------------------------------------------------*/
davide.aliprandi@st.com 2:9f389fd8fb2e 46
davide.aliprandi@st.com 2:9f389fd8fb2e 47 #define HTONS(A) ((((uint16_t)(A) & 0xff00) >> 8) | \
davide.aliprandi@st.com 2:9f389fd8fb2e 48 (((uint16_t)(A) & 0x00ff) << 8))
davide.aliprandi@st.com 2:9f389fd8fb2e 49
davide.aliprandi@st.com 2:9f389fd8fb2e 50
davide.aliprandi@st.com 2:9f389fd8fb2e 51 /* Types ---------------------------------------------------------------------*/
davide.aliprandi@st.com 2:9f389fd8fb2e 52
davide.aliprandi@st.com 2:9f389fd8fb2e 53 typedef struct {
davide.aliprandi@st.com 2:9f389fd8fb2e 54 /* Public */
davide.aliprandi@st.com 2:9f389fd8fb2e 55 uint16_t Fs;
davide.aliprandi@st.com 2:9f389fd8fb2e 56 float LP_HZ;
davide.aliprandi@st.com 2:9f389fd8fb2e 57 float HP_HZ;
davide.aliprandi@st.com 2:9f389fd8fb2e 58 uint16_t In_MicChannels;
davide.aliprandi@st.com 2:9f389fd8fb2e 59 uint16_t Out_MicChannels;
davide.aliprandi@st.com 2:9f389fd8fb2e 60 uint16_t Decimation;
davide.aliprandi@st.com 2:9f389fd8fb2e 61 uint16_t SincN;
davide.aliprandi@st.com 2:9f389fd8fb2e 62 /* Private */
davide.aliprandi@st.com 2:9f389fd8fb2e 63 uint32_t Coef[5];
davide.aliprandi@st.com 2:9f389fd8fb2e 64 uint16_t FilterLen;
davide.aliprandi@st.com 2:9f389fd8fb2e 65 int64_t OldOut, OldIn, OldZ;
davide.aliprandi@st.com 2:9f389fd8fb2e 66 uint16_t LP_ALFA;
davide.aliprandi@st.com 2:9f389fd8fb2e 67 uint16_t HP_ALFA;
davide.aliprandi@st.com 2:9f389fd8fb2e 68 uint16_t bit[5];
davide.aliprandi@st.com 2:9f389fd8fb2e 69 uint16_t byte;
davide.aliprandi@st.com 2:9f389fd8fb2e 70 } TPDMFilter_InitStruct;
davide.aliprandi@st.com 2:9f389fd8fb2e 71
davide.aliprandi@st.com 2:9f389fd8fb2e 72
davide.aliprandi@st.com 2:9f389fd8fb2e 73 /* Exported functions ------------------------------------------------------- */
davide.aliprandi@st.com 2:9f389fd8fb2e 74
davide.aliprandi@st.com 2:9f389fd8fb2e 75 void Open_PDM_Filter_Init(TPDMFilter_InitStruct *init_struct);
davide.aliprandi@st.com 2:9f389fd8fb2e 76 void Open_PDM_Filter(uint8_t* data, uint16_t* data_out, uint16_t mic_gain, TPDMFilter_InitStruct *init_struct);
davide.aliprandi@st.com 2:9f389fd8fb2e 77
davide.aliprandi@st.com 2:9f389fd8fb2e 78 #ifdef __cplusplus
davide.aliprandi@st.com 2:9f389fd8fb2e 79 }
davide.aliprandi@st.com 2:9f389fd8fb2e 80 #endif
davide.aliprandi@st.com 2:9f389fd8fb2e 81
davide.aliprandi@st.com 2:9f389fd8fb2e 82 #endif // __OPENPDMFILTER_H
davide.aliprandi@st.com 2:9f389fd8fb2e 83
davide.aliprandi@st.com 2:9f389fd8fb2e 84 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/