stm32f7xx-hal icon indicating copy to clipboard operation
stm32f7xx-hal copied to clipboard

Support for I2S protocol

Open ost-ing opened this issue 5 years ago • 8 comments
trafficstars

I'm trying to determine if the SPI implementation can support I2S? If not, any plans in the future to add this? I assume that its related to SPI, as the datasheet for stm32f747zg suggests:

Up to 6 SPIs (up to 50 Mbit/s), 3 with muxed simplex I2S for audio class accuracy via internal audio PLL or external clock

Thanks!

ost-ing avatar Oct 12 '20 17:10 ost-ing

I know next to nothing about I2S, but to the best of my knowledge, it is not supported. I'm also not aware of any plans to implement it, but of course any contributions doing so would be very welcome.

hannobraun avatar Oct 13 '20 10:10 hannobraun

Thanks for the response @hannobraun. When I find the time, I could begin to look into it. For further reference, the stm32f429-hal implements it.

Kind regards, Oliver

ost-ing avatar Oct 13 '20 11:10 ost-ing

I've begun implementing I2S support, but I need some assistance regarding the way the HAL currently implements the rcc::CFGR.

I'm porting the I2S initialization C++ function HAL_StatusTypeDef HAL_I2S_Init(I2S_HandleTypeDef *hi2s).

This function requires access to:

  • system clock switch status, to determine if HSI or HSE is being used
  • the configured PLLM value
  • the plli2scfgr register, specifically the plli2sn and plli2sr values.

These values are then used to determine the I2S MCK value, which is crucial for I2S Master operation.

After calling constrain() on pac::RCC, I lose access to read these registries. Further the stm32f7xx_hal::rcc::CFGR freeze function returns a Clocks struct that also cannot help me.

Is there an example somewhere of accessing these registries (read-only) in a safe or unsafe way after constraining? If not, I could attempt to modify the rcc.rs to allow accessing read-only values, or is there any suggestion on how to handle this situation?

cc. @hannobraun & @no111u3

Kind regards, Oliver

ost-ing avatar Nov 09 '20 19:11 ost-ing

You can always conjure up an instance of pac::RCC via pac::RCC::ptr(). Or you could just add the required information to Clocks. I don't have a strong opinion here.

hannobraun avatar Nov 10 '20 12:11 hannobraun

Thanks for pointing me in the right direction :+1:

ost-ing avatar Nov 10 '20 13:11 ost-ing

@ostenning Did you get anywhere with the I2S implementation? I am thinking of possibly implementing it myself if not :)

andybest avatar Apr 07 '21 17:04 andybest

@andybest Sorry, no I ended up going in a different direction with my project. But take a look at the stm32h7xx-hal, its already implemented there.

ost-ing avatar Apr 08 '21 17:04 ost-ing

@ostenning No worries! Thanks, I'll see if I can port over the implementation from there :)

andybest avatar Apr 08 '21 21:04 andybest