[STM32H743 - Bug in cube] after setting I2S (SPI) from 'master' transmit to 'slave' : no more data coming...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-18 6:24 AM
on H743 board (DevEboard) I2S1 (master 16b 44k1) -> ES9038 DAC (I2S slave) :
DAC playing music fine, ok.
now switching DAC to I2S master , H743 to slave transmitter mode : no data / silence.
test with DSO : pin PA7 (SDO) is tri state now! thats WRONG !!!!
looking in ds/manual , see, maybe change SDi/SDO pins, when change master -> slave mode....
so i try: set in cubeIDE pin PA6 (i2S SDI ) manual to SDI ("no mode" , "yellow" ( pin in cube) = warning);
compile...run : DAC playing, so data coming from "inactive" and "no mode" pin, but from ("green": pin in cube) SDO nothing coming.
i think, this is obvious error in cube; missing the IOSWAP in SPI_CFG2 to set or wrong setting preset.
to proof , i add pinswap in HAL_I2S.c driver / init slave mode:
now sound is ok again; so data coming from SDO now (again).
@Imen DAHMEN​ or @Julien D_OEHAUDT​ ... STM
so please rectify, if i am right.
- Labels:
-
I2S
-
SPI
-
STM32H7 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-24 6:58 AM
seems STM has not very much interest in this...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-26 11:47 AM
Hello @AScha.3​ ,
Which Cube package version are you using?
Are you using CubeMx tool for your settings and to generate your project ? If yes, which version ?
Did you try to change IOSWP bit in SPI_CFG2 register?
hi2s1.Init.IOSwap = I2S_IO_SWAP_ENABLE;
The SPI/I2S offers the possibility to swap the function of SDI and SDO lines thanks to IOSWP bit located into SPI_CFG2. Details can be found in RM0433:
Bit 15 IOSWP: swap functionality of MISO and MOSI pins
0: no swap
1: MOSI and MISO are swapped
When this bit is set, the function of MISO and MOSI pins alternate functions are inverted.
Original MISO pin becomes MOSI and original MOSI pin becomes MISO.
Note: This bit can be also used in PCM and I2S modes.
Please see the "Serial data line swapping" table in RM0433.
Imen
Thanks
Imen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-27 10:11 AM
Hello @Imen DAHMEN​ ,
so...i use :
STM32CubeIDE
Version: 1.10.1
Build: 12716_20220707_0928 (UTC)
OS: Linux, v.4.19.0-1-amd64, x86_64 / gtk 3.22.11
Java vendor: Eclipse Adoptium
Java runtime version: 11.0.14.1+1
Java version: 11.0.14.1
STM32CubeMX 6.6.1.2022
and yes, to proove : i changed IOSWP bit in SPI_CFG2 , in HAL lib:
>> SPI1->CFG2 = 0x008000; // test ! pin swap
as i wrote in first post.
so i think, solution is just : make pinSwap available in I2S mode in cube and setting initial to "1" ;
so SDO stays SDO when selecting slave mode from master mode...and reverse.
(seems , not sooo many people have ever tried, to use I2S transmittter slave mode setting in Cube/HAL on H7xx . )
best regards
Alfred
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-10-07 4:15 AM
so.... make pinSwap available in I2S mode in cube ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-10-22 9:15 AM
now i tried your idea: swap-enable in cfg , but:
>> ...error: 'I2S_InitTypeDef' {aka 'struct <anonymous>'} has no member named 'IOSwap' <<
so its really missing here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-01-16 6:12 AM
Hello @AScha.3​
Thank you for your contributions and for your detailed explanations,
Your suggestion is taken into consideration, it has been reported to STM32CubeMX development team .
Internal ticket number: 143012 (This is an internal tracking number and is not accessible or usable by customers).
I will keep you posted with updates.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-02-08 1:27 AM
Hello,
I just had the same problem with a H723, using I2S as slave RX, and only after setting IOSWP it worked.
I'm mostly using Cube and HAL libs to "learn" when using a new peripheral, and there I didn't come across IOSWP.
The problem is either:
- Cube is setting the wrong data IO pins when in slave mode (MOSI / MISO)
- or HAL doesn't check slave mode together with TX/RX and which data pin is used (MOSI / MISO), there's no use of the IOSWP bit in the HAL libs anywhere
So it's not only a Cube, but also a HAL problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-24 8:55 AM
I confirm that the problem is still present in STM32Cube_FW_H7 v1.11.0
and happening regardless of transmission or reception.
i am using a STM32H723ZG
Adding to stm32h7xx_hal_i2s.c @ line 455
else
hi2s->Instance->CFG2 = 0x008000;
solves the issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-23 6:59 AM - edited ‎2025-04-23 7:07 AM
thank you so much @FCocc.3 !! after adding it in now I can see data from I2S printed out. Before that there was constantly 0 printed out even though i could see the pulses coming out from the data line on logic analyzer.
