Skip to content

Conversation

ledneczki
Copy link

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.

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
@ledneczki ledneczki force-pushed the feature/i2s-stm32f407 branch from 13cc86d to 6f8fc64 Compare April 21, 2021 19:49
@rleh rleh changed the title Feature/i2s stm32f407 I2S driver for STM32F4 Apr 22, 2021
Remove not used parameter from I2S PLL initializer function.

Pin setup for the I2S DAC can be done
by calling Board::initializeCs43()
@ledneczki ledneczki force-pushed the feature/i2s-stm32f407 branch from 7ab6c7d to 4162b24 Compare April 22, 2021 17:17
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.
@salkinium
Copy link
Member

@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.

@ledneczki
Copy link
Author

@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.

@salkinium
Copy link
Member

also the mic signal is piped into the audio DAC

Ohhhh, fancy! Looking forward to that.

I think I am going to replace the drum kit audio samples with simple sine waves.

Yes, I think that's perfectly fine for an example. Not that there's already a SIN table in the DAC examples.

@ledneczki
Copy link
Author

ledneczki commented Sep 26, 2021

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)?

@salkinium
Copy link
Member

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.

@ledneczki
Copy link
Author

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.

@salkinium
Copy link
Member

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.

@ledneczki
Copy link
Author

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.

@rleh rleh mentioned this pull request Oct 29, 2021
6 tasks
@rleh rleh added the stale ♾ label May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants