Simple I2S microphone tester
Small STM32F0DISCOVERY application intended for testing noise level and spectrum of I2S microphones, converting signal from I2S microphone to analog signal from DAC with switchable gain.
I've got STM32F0DISCOVERY from a giveaway and quite a few of these boards was distributed few years ago this way.
It may seem less powerful than black pill (STM32F401) or blue pill, but it has both I2S (although single direction has to be choosen, so
it cannot receive and transmit same time) and DAC. Although DAC would offer lower output sound quality than I2S codec it still is quite
sufficient for this purpose and has benefit of simplicity - as it has no filtering of any kind.
Special consideration might be needed for some I2S microphones that have DC offset in output signal.
DAC is configured with output buffer - this would allow to drive headphones directly, but as it still has quite limited current - 1.5 kOhm or larger resistor should be used in series.
INP441 seems to be quite popular I2S microphone at the moment with inexpensive mini boards available (~2.50). L/R pin can be left unconnected for this application, so just 3 I2S pins and power (3.3V) are needed.
- LED LD3 (at PC9) - blinking once per second when main loop is running
- LED LD4 (at PC8, blue, near reset button) - blinking with number of blinks indicating current gain level (1...12 where 1 = no gain, 12 = 11 bit shift)
- button B1 (blue) - switching between gain levels
Boards starts with maximum gain (shift by 11 bits) after reset as its main purpose is listening to microphone noise. This is fine for INP441 though just placing headphones near the microphone might create loopback in this case and signal from other microphone types might be distorted.
Code was tested with GCC compiler bundled with EmBitz 1.11, though any version of arm-none-eabi-gcc would probably work.
Path to GCC is defined inside run_make.bat file. If path contains spaces - use quotation marks.
There is EmBitz project file included, but using it is not necesary as it uses run_make.bat/make/Makefile anyway, so IDE is actually only for code editing and debugging with STLinkUtil.exe/st-util.exe/OpenOCD. Path to GDB server can be defined through EmBitz Debug/Interfaces menu.