STMicroelectronics / STM32CubeH7

STM32Cube MCU Full Package for the STM32H7 series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits))
https://www.st.com/en/embedded-software/stm32cubeh7.html
Other
490 stars 302 forks source link

I2S: I2S_InitTypeDef doesn't have IOSWP #212

Open ino-josh opened 2 years ago

ino-josh commented 2 years ago

Yes, it is just a matter of calling SET_BIT(hi2s1.Instance->CFG2, SPI_CFG2_IOSWP); But, this is a matter of exposure.

I wasted hours trying to figure out why RXDR was always zero. I triple checked everything I could possibly think of; looked at everything in the reference manual that could explain what I was doing wrong. It wasn't until I saw this sentence that I realized the problem:

SDI: Serial Data Input (mapped on the MISO pin) to receive the audio samples in
master, and to transmit the audio sample in slave. 

C'mon now. Serial Data Input is only an Input when in master mode, it is an output when in slave mode. Aside from the poor choice of naming, this issue can be somewhat addressed by exposing IOSWP as a part of I2S_InitTypeDef, and adding the wording about SDO/SDI directionality in master vs. slave mode in its comment. This would at least give some exposure to the problem (and a solution) and prevent others from wasting their time.

ASELSTM commented 1 year ago

ST Internal Reference: 149516