2022-03-22 03:41 PM
I tried the BSP example for H735G-DK, but it doesn't work.
What I want to do is get an audio wave from line_in (the blue audio jack on the board).
The setup for SAI1 is in the picture, I can play the audio through the line out without any problem but can not get the readable waveform data from the line in.
uint8_t txData[2] = { 0, 0 };
/* enable the clock by starting the tx */
if (HAL_SAI_Transmit(&hsai_BlockB1, txData, 2, 1000) != HAL_OK)
Error_Handler();
if (audioDrv->Play(audioCompObj) != 0)
Error_Handler();
if (HAL_SAI_Receive_DMA(&hsai_BlockA1, (uint8_t*)recordBuff, RECORD_BUFFER_SIZE) != HAL_OK) {
Error_Handler();
}
The audio input is a 2k sin waveform, what I got from SAI1 are:
It does have the 2k frequency peak, but the waveform is far from a sin wave, what could be the problem?
Solved! Go to Solution.
2022-03-23 12:48 AM
https://www.youtube.com/watch?v=O2XaCFsWxSw
Here is the YouTube video where you can get the audio line-in data from the STM32H735G-DK. If you didn't understand then please contact me here, I'll be very happy to help you.
2022-03-22 05:33 PM
It seems something happened with the first bit of some data. The received values are something like ...,32761,32765,3,8,13,... which should be ...,-7 (32761-32768), -3 (32765 - 32768), 3, 8, 13,...
Even if I modify the value manually, the value seems to be too small, the amplitude is less than 30.
2022-03-23 12:48 AM
https://www.youtube.com/watch?v=O2XaCFsWxSw
Here is the YouTube video where you can get the audio line-in data from the STM32H735G-DK. If you didn't understand then please contact me here, I'll be very happy to help you.
2022-03-23 08:55 AM
Hi MMuba.1, thanks a lot for your nice tutorial, but I still have the problem that the received value is too small. If I disable the 30 dB gain, the maximum received value would be 30, if I enable the 30 dB gain, the maximum received value is 70.
I expected the value range should be [-32768, 32767], what could be the problem?
2022-03-24 06:14 AM
Finally, I managed to make it right, the Frame Synchro Offset of SAI-A didn't match the SAI-B's settings. It should be 'Before First Bit'.
And the amplitude problem is caused by the input volume of wm8994.