stm32-data icon indicating copy to clipboard operation
stm32-data copied to clipboard

Add support for I2Sext peripherals on stm32f3xx / stm32f4xx

Open bifurcation opened this issue 2 months ago • 1 comments

Full-duplex I2S opeeration on these platforms requires "I2Sext" peripherals that work alongside the SPI/I2S peripherals. This PR attempts to add support for these peripherals, in support of enabling full-duplex operation at the embassy-stm32 layer.

I tried following the directions in the README, invoking ./d extract-all for I2S2ext and I2S3ext. This produced a few dozen YAML files, of which there were two unique classes modulo renaming of fields. I called these i2sext_v1.yaml for the F4 family and _v2.yaml for the F3 family (following release date order). I added lines to perimap.rs which ought to have caught the relevant peripherals.

However, I hit a roadblock here. The entries in PERIMAP never hit, apparently because the I2Sext peripherals don't appear in the chip XML in data/cubedb, from which the ChipGroup values are generated. Those XML files do contain the pin definitions that the ext-peripherals require (e.g., in STM32F405RGTx.xml, pin PB4 has I2S3_ext_SD).

I would appreciate guidance on how to move forward here. I suspect that the I2Sext peripherals might need special handling like the I2S peripherals, but this is exceeding the bounds of my knowledge here.

bifurcation avatar Sep 24 '25 21:09 bifurcation

diff: https://ci.embassy.dev/jobs/7f0d4755169c/artifacts/diff.html

embassy-ci[bot] avatar Sep 24 '25 21:09 embassy-ci[bot]

You can add it to family extra

xoviat avatar Nov 27 '25 13:11 xoviat

I don't think I2SExt is a "real" peripheral though? just a mode of i2s?

Dirbaio avatar Nov 27 '25 13:11 Dirbaio

There may be extra registers here, not sure.

xoviat avatar Nov 27 '25 15:11 xoviat

Yes, there are different registers, and they are not usable as normal I2S peripherals. Worked example in this embassy PR:

https://github.com/embassy-rs/embassy/pull/4746/files#diff-b5769e91d65add7186b780b48d11fb3b3a8464dcd3fe105c2da8998841d99302R30

bifurcation avatar Nov 27 '25 15:11 bifurcation

yeah, so just add the extra regs and refrence them in family/extra

xoviat avatar Nov 27 '25 16:11 xoviat

Only thing that gives me pause about that is that in the SVD files, the I2Sext peripherals are listed alongside the I2S peripherals, in the same format. Is there a way to coalesce registers from multiple peripherals?

bifurcation avatar Nov 27 '25 16:11 bifurcation

Only the extra registers should be added in the i2s yaml.

xoviat avatar Nov 27 '25 17:11 xoviat