cancel
Showing results for 
Search instead for 
Did you mean: 

H743 I2S half-duplex slave receive mode, SDI pin should map to MOSI not MISO, cubeMX v6.15, FW_H7 v1.12.1

KimbleYoung
Associate II

Created a STM32H743II prj with I2S2 enabled, half-duplex slave receive mode, and DMA1 S0 bounded to SPI2_RX, to work with an ADC in master mode.

 

Can't get data from the ADC ( DMA linked mem area always zero ), while my oscillograph can properly decode the ADC I2S data output pin ( CK & WS pin also connected between the ADC board and the H743 board, and the oscillograph ).

 

In cube, the SDI pin is mapped to SPI2_MISO, PB14. But as a slave, shouldn't the correct SDI pin map to SPI2_MOSI, PB15?

 

So I modified the cubeMX generated code manually, by changing PB14 to PB15 in the I2S2 GPIO initialization sector, and it worked, the DMA linked mem area shows the same value on my oscillograph.

 

Is this a cubeMX bug?

1 ACCEPTED SOLUTION

Accepted Solutions
AScha.3
Super User

Seems to be a bug , but no big problem, miso mosi can be swapped :

AScha3_0-1760193940621.pngAScha3_1-1760193967804.png

So let Cube do it, and if the pin swap missing, just set it yourself in the init.

  hxxx.Init.IOSwap = SPI_IO_SWAP_DISABLE;   // or _ENABLE

btw

I had same problem...and used the swap feature.

(Maybe it depends on Cube/HAL version, bug might be away. Which version you use? )

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

5 REPLIES 5
TDK
Super User

> In cube, the SDI pin is mapped to SPI2_MISO, PB14. But as a slave, shouldn't the correct SDI pin map to SPI2_MOSI, PB15?

A half duplex data connection on the slave side should be on the MISO pin, as shown in the reference manual.

TDK_0-1760193584273.png

 

If you feel a post has answered your question, please click "Accept as Solution".
AScha.3
Super User

Seems to be a bug , but no big problem, miso mosi can be swapped :

AScha3_0-1760193940621.pngAScha3_1-1760193967804.png

So let Cube do it, and if the pin swap missing, just set it yourself in the init.

  hxxx.Init.IOSwap = SPI_IO_SWAP_DISABLE;   // or _ENABLE

btw

I had same problem...and used the swap feature.

(Maybe it depends on Cube/HAL version, bug might be away. Which version you use? )

If you feel a post has answered your question, please click "Accept as Solution".

Hello @KimbleYoung @AScha.3 @TDK 

Thank you all for your contributions.

Two internal tickets, 160926 and 143012, have been raised to our development team to address this issue.

THX 

Ghofrane

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Thanks for your reply.

 

But I couldn't get it to work with the original code cube generated, maybe I did sth wrong somewhere else.

Hope the development team can give us a clear answer, let's wait.

Thanks for your reply, very helpful.

This IO swapping method is much better than manually modifying the init code, which will be wiped when cubeMX regenerating.

I didn't find the struct member 'Init.IOSwap' in &hi2sx, it just exist in struct &hspix.

But I find this function for I2S - HAL_I2S_EnableIOSwap, which also works.

Added this line, and changed the phyical data pin connection to PB14, works just fine.

HAL_I2S_EnableIOSwap(&hi2s2);

 

 Hope the development team can give us a clear answer, let's wait.