Close

I2S framing errors on the STM32

A project log for The ultimate vlogging mic

Recording the best headset audio in a portable form factor

lion mclionheadlion mclionhead 12/16/2017 at 06:250 Comments

After 5 years of living in fear of hearing loss, a solution to I2S slave mode framing errors on the STM32 was finally found.  The trick is the STM32 doesn't automatically align samples on the WS transitions.  It just spits out 32 bit samples as the CLK pin oscillates. It does throw a bone in the form of the SPI_I2S_FLAG_TIFRFE flag.  You need to check this flag to find out if the samples are not aligned with the WS pin.  Reading the flag resets it.  When it inevitably hits true, you need to stop the I2S, stop your ADC, restart the I2S, restart the ADC after I2S is running, & hope it's in sync.  With this nugget in place, you can tap the AK4524's crystal to make it glitch & it recovers without blowing your ears up.

As for the power supply filtering, it's a strange beast.  The easiest hack was a 4.2V 240mAh battery dedicated to the analog section.  This was dropped through a 17R & 10uF which dropped it by 0.5V.  It was incredibly noisy.  In fact, powering it off the W & the W off 5V got quieter results because it had enough voltage to drop through 70R.  The W still made an ever present 1mV pulse on this 32x averaged plot.

It's not nearly utilizing the 24 bit ADC, but it's probably better than the CM109.  

Discussions