-
Notifications
You must be signed in to change notification settings - Fork 153
I2S driver for STM32F4 #621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Functions are added to be able to set up the I2S PLL at startup. PLL multipliers are taken over from ST's example: STM32F4-Discovery_FW_V1.1.0/Project/Audio_playback_and_record/src/system_stm32f4xx.c
13cc86d
to
6f8fc64
Compare
Remove not used parameter from I2S PLL initializer function. Pin setup for the I2S DAC can be done by calling Board::initializeCs43()
7ab6c7d
to
4162b24
Compare
Clock divider for the I2S peripheral is done compile time.
I2S master driver can be used with the TXE (transmit buffer empty) to transmit audio samples. The DAC driver is not that flexible at this moment. It just provides enough config that it can output audio on the headphone output. Register field definition is also not complete. I just added that much that is currently enough to make it work.
Several fixes have been applied to the driver, like removal of blocking calls. ANother fix is applied to the volume setting. The volume can be also set by specifying relative steps.
@ledneczki, what's the status of this PR? I'm seeing some good additions to the PLL code, a driver for the CS43L22 with at least the I2C interface looking somewhat complete, and parts (?) of an I2S driver? Do you want a review? Is there something you want to merge separately already, even if it's incomplete? That way others can take over your work in the future. |
@salkinium thank you for your question! First of all excuse me for being under water for so long. I actually created an example project with stm32f4 discovery kit, which acts as a drum kit, and also the mic signal is piped into the audio DAC. I had/still have troubles finding audio samples with proper licensing (this made me a bit discouraged), so I can not push the latest code yet. But I think I am going to replace the drum kit audio samples with simple sine waves. I will try to make that happen soon. |
Ohhhh, fancy! Looking forward to that.
Yes, I think that's perfectly fine for an example. Not that there's already a SIN table in the DAC examples. |
Thanks @salkinium for the link! Does someone know by chance if it is possible to check in third-party lib, like ST's PDM filter library (already in compiled format)? |
It's technically possible via lbuild, but perhaps it should be a separate application repository. The example should just showcase the basic functionality as a starting point, what you do then with the data is application specific. |
I ask this, because the example makes use of the filters in the library in order to retrieve the audio signal from the PDM signal that is coming from the mic, but I do not know how much people in modm repo want to see a compiled third-party lib checked in. |
Are you talking about the PDM2PCM ST Audio_Addon library? It seems to have some weird license with registering, so I'm not even sure if we allowed to host it. |
Yes, indeed. Then I will try to do this conversion with the available filters. |
Setting up I2S driver is still in a very early stage. I go slowly, step-by-step to get to know the structure of modm.