stm32-rs / stm32h7xx-hal

Peripheral access API for STM32H7 series microcontrollers
BSD Zero Clause License
209 stars 99 forks source link

I2S / SPI Multiplexing #395

Open ostenning opened 1 year ago

ostenning commented 1 year ago

Hello, I'm wondering if its possible to run I2S over SPI?

For example, I have the SPI2 peripheral with pins PA9 for SCK and PC1 for MOSI. Within the Cube HAL I know its possible to run the SPI peripheral as if it were I2S, which would simplify circular DMA implementations and enable fixed sampling rates.

Is this currently possible? If not, would it be hard to implement? Any guidance is appreciated.

Thanks

maxekman commented 1 year ago

I would also be interested to know about this. As I understand it the I2S peripherals available in the SPIs are separate from the I2S functionality from the SAI peripheral (which can also do more advanced formats). It would be really useful to use the simpler SPI based I2S when not in need of the extended SAI functionality.

liarokapisv commented 1 month ago

This is definitely possible, the SPI peripheral has a dedicated I2S configuration register that takes over the peripheral. It does not seem to be currently supported by the crate.