Simple test application for the STMicroelectronics X-NUCLEO-CCA02M1 MEMS Microphones Expansion Board, built against mbed classic.
Dependencies: X_NUCLEO_CCA02M1 mbed ST_Events-old
Fork of HelloWorld_CCA02M1_mbedOS by
Recording audio with the X-NUCLEO-CCA02M1 Expansion Board
This application provides a simple example of usage of the X-NUCLEO-CCA02M1 MEMS Microphones Expansion Board, built against mbed classic 2.x.
It shows how to record a 2-channel stereo signal as an array of PCM samples (16 bit/sample) that can be acquired through an audio SW like Audacity, for example.
Microphones configuration
Currently the configurations supported are the following:
- Stereo@48KHz
- Stereo@44.1KHz (default, 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.
- Please note that the main application makes use of the "events" library (i.e. the "ST_Events" library imported as "events" library), which is not included into the "mbed" library.
- The application built against mbed OS can be found here.
Acquiring through the USB on Windows
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.
On Windows, click on the speaker icon on the bottom bar, select "Recording devices", "Microphone", "Properties", then click on the "Advanced" panel, and select "1/2 channels, 16 bit, 16/32KHz" according to board configuration.
Open your preferred audio SW, like "Audacity" for example, configure it to acquire a 2-channel stereo at 16KHz (for default configuration), and record.
Diff: main.cpp
- Revision:
- 17:97dffa2e68f7
- Parent:
- 12:203c08553f4d
diff -r 8f0723e0df78 -r 97dffa2e68f7 main.cpp
--- a/main.cpp Wed Jul 12 13:57:40 2017 +0000
+++ b/main.cpp Fri Jul 14 16:37:55 2017 +0000
@@ -41,7 +41,6 @@
/* mbed specific header files. */
#include "mbed.h"
-#include "rtos.h"
#if DEVICE_I2S
@@ -63,9 +62,6 @@
2 /* Default number of channels. */
};
-/* Thread to manage I2S peripherals. */
-static rtos::Thread i2s_bh_daemon;
-
/* Functions -----------------------------------------------------------------*/
@@ -86,10 +82,6 @@
exit(EXIT_FAILURE);
}
- /* Starting a thread to manage I2S peripherals. */
- Callback<void()> i2s_bh_task(&I2S::i2s_bh_queue, &events::EventQueue::dispatch_forever);
- i2s_bh_daemon.start(i2s_bh_task);
-
/* Enabling transmission via USB. */
microphones->enable_usb();
@@ -102,6 +94,9 @@
/* Printing to the console. */
printf("--> Recording...\r\n");
microphones->record();
+
+ /* Dispatching forever the I2S queue. */
+ I2S::i2s_bh_queue.dispatch_forever();
}
#else // DEVICE_I2S

X-NUCLEO-CCA02M1 Digital MEMS Microphones Expansion Board.