2022-10-01 11:26 PM
Hello,
I'm using an STM32 M4 for recording short audio signals through the I2S interface and I write the PCM to an SD card. To check that everything is fine I have recorded pure tones (1kHz or 2kHz). By doing that I noticed in some recordings (not all of them) some glitches in the audio signal. Can someone help understand why those glitches appear?
The reference manual reports that I2SxCLK frequency should be higher than the APB bus. In my case the APB is 16MHz and the I2SxCLK is 48MHz. Here is attached one of the 2s audio tracks recorded. Sometimes the glitch appears at the beginning of the track, some others later.
What else can generate this issue?
2022-10-05 09:53 AM
https://forum.arduino.cc/t/arduino-due-sd-card-write-speed-unpredictable/311955
https://forum.arduino.cc/t/how-long-time-does-is-take-to-write-to-an-sd/107499
How much RAM do you have? And is it used efficiently? Here is a bad example of ST's bloated code:
https://community.st.com/s/question/0D53W00001FT7OdSAL/problem-with-optimal-code-size
2022-10-07 11:45 PM
Dear @AScha.3 ,
I'm already using micro SD from "good" source. I have tried SanDisk, Kingston with different sizes but the glitch still appears.
@Piranha, I have 16kB in one RAM and 32kB in the other. The problem is that, the Radio stack requires quite some RAM. What I could do is modify the linker script in order to put the inizialized/unitialized data into RAM1 and use RAM2 for stack/heap in oder to have some more space for the DMA buffer. The problem is that allocating a PDM buffer large enough to store PDM data to produce 4kB of PCM, with 128 decimation I would need 16k uint16 for the buffer.
2022-10-08 10:56 AM
about buffer size : simple calcutate : 100ms delay can happen, 16ks/32bit is to store, so 1,6 x4 = 6,4kB need to be buffered, to avoid any problem, when SD needs 100ms extra time buffer;
+ 512 B. for regular buffer itself.
if you dont have this buffer, change your system or your expectation (= accept dropouts).