2019-04-05 02:23 PM
Hello to everyone,
I'm working on the STM32F746NG Discovery Board to realize a simple audio effect and i need to use the audio codec WM8994. It is interfaced with the SAI2 audio peripheral. I dont want to use the HAL libraries but to write directly the MCU registers; i had read the MCU datasheet for CPU configuring, SAI2 and I2C for the codec configuration. The I2C part seems to work, the codec manually configured for an analog in-out audio loop works fine (only a low output volume).
Concerning the SAI2 configuration i have some problems.....After configuring everything:
-BLOCK A: master tx, 2 slots, 16 bit data, 32bits per slot, DSP mode b (0 offset for first bit)
-BLOCK B: slave receiver, same TDM configuration as for the Block A.
-Frequency 48Khz (sai_sys_clk is derived from the PLLSAI with M=25, N=344, P=8, Q=7, SAIQ div =1) to obtain 49.142Mhz. With the oversample factor of 256 fixed in SAI and MDIV = 2 i should obtain approximatively 48Khz
-FIFO Empty interrupt request active.
As soon as i enable the SAI2-B Block the interrupt routine is called (fifo is empty), i write two samples (each write operation on DR register fills a 32bit slot of the fifo for a single audio slot), but the interrupt is no more called....if i pause the core with debugger the fifo threshold is still at 1 (<1/4 filled threshold); it doesn't seem to consume data in the fifo :(
I used two DMAs streams (DMA2-stream2 and 4) but it happens the same...the DMA is called only once and no more :(
Can someone help me? if needed i can post the code
Thanks and sorry for my bad english.