STM32CubeH7 icon indicating copy to clipboard operation
STM32CubeH7 copied to clipboard

I2S: I2S_InitTypeDef doesn't have IOSWP

Open ino-josh opened this issue 3 years ago • 1 comments

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.

ino-josh avatar Apr 07 '22 15:04 ino-josh

ST Internal Reference: 149516

ASELSTM avatar Apr 11 '23 15:04 ASELSTM