There were some problems with the sketch attached to post 1, which have been corrected. In addition, it is now recorded in WAVE format. The changes are as follows
- setGain() is executed after the begin() since the gain is set to the default value in the begin()
- Change data writing to little-endian format
- Review PDM buffer size and FIFO size
- Use SD with the fastest write speed possible
- Record in WAVE format.
For example, you can import the waveforms into the application “Audacity” to edit, check, and play back. After editing, the waveform can be exported in wave format.
The timing of reading PDM data and writing to SD was checked with a digital scope.
- PDM data is pushed from the PDM buffer to the FIFO every 16mS for 200uS
- In most cases, the data is popped every 16mS and written to SD over 6mS
- In rare cases, it takes over 500mS to write to the SD
So I needed FIFO which will not overflow, If FIFO overflow, the red LED will blink 5 times, so please increase FIFO size.
POST_nRF52_XIAO_PDM_WAVE_SD.zip (2.4 KB)