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.

Revision:
7:9d6a4a53e640
Parent:
2:9f389fd8fb2e
Child:
11:b2f7f79026e4
diff -r 9b8bc842aeb3 -r 9d6a4a53e640 BSP/PDM2PCMAudio.cpp
--- a/BSP/PDM2PCMAudio.cpp	Fri Apr 21 19:39:27 2017 +0200
+++ b/BSP/PDM2PCMAudio.cpp	Fri Apr 21 19:39:43 2017 +0200
@@ -83,12 +83,13 @@
     switch (decimation_factor)
     {
         case 64:
-            for (uint32_t index = 0; index < 1/*_channels*/; index++) {
+            for (uint32_t index = 0; index < _channels; index++) {
 #ifdef PDM2PCM_AUDIO_DEBUG
                 _pdm2pcm_audio_signal = 1;
 #endif
 #ifdef USE_OPEN_PDM2PCM_LIBRARY
                 Open_PDM_Filter(&((uint8_t *) input_buffer)[index], (uint16_t *) &(output_buffer[index]), volume, (TPDMFilter_InitStruct *) &_PDM2PCM_filter[index]);
+                index++;
 #else                
                 PDM_Filter_64_LSB(&((uint8_t *) input_buffer)[index], (uint16_t *) &(output_buffer[index]), volume, (PDMFilter_InitStruct *) &_PDM2PCM_filter[index]);
 #endif
@@ -100,11 +101,18 @@
 
         case 128:
             for (uint32_t index = 0; index < _channels; index++) {
+#ifdef PDM2PCM_AUDIO_DEBUG
+                _pdm2pcm_audio_signal = 1;
+#endif
 #ifdef USE_OPEN_PDM2PCM_LIBRARY
                 Open_PDM_Filter(&((uint8_t *) input_buffer)[index], (uint16_t *) &(output_buffer[index]), volume, (TPDMFilter_InitStruct *) &_PDM2PCM_filter[index]);
+                index++;
 #else                
                 PDM_Filter_128_LSB(&((uint8_t *) input_buffer)[index], (uint16_t *) &(output_buffer[index]), volume, (PDMFilter_InitStruct *) &_PDM2PCM_filter[index]);
 #endif
+#ifdef PDM2PCM_AUDIO_DEBUG
+                _pdm2pcm_audio_signal = 0;
+#endif
             }
             break;