esp-rs / esp-hal

no_std Hardware Abstraction Layers for ESP32 microcontrollers
https://docs.esp-rs.org/esp-hal/
Apache License 2.0
703 stars 193 forks source link

ESP32-S2: SPI DMA test_asymmetric_dma_transfer fails #2098

Open SergioGasquez opened 1 week ago

SergioGasquez commented 1 week ago
          For some reason, [S2 HIL](https://github.com/esp-rs/esp-hal/actions/runs/10717649673/job/29718015468) is failing this test, I can also reproduce it locally.  Not sure why it only happens in S2 and when using different buffer sizes (using `dma_buffers!(4,4)` passes the test)

main doesnt have any issue with this test in S2

_Originally posted by @SergioGasquez in https://github.com/esp-rs/esp-hal/pull/2074#discussion_r1745182546_

See https://github.com/esp-rs/esp-hal/pull/2074#discussion_r1746719403 for more information

Dominaezzz commented 1 week ago

Ah yeah it is almost definitely this.

For the S2 the fix is trivial. You just need to change https://github.com/esp-rs/esp-hal/blob/492e35aa74d7b6dfc9d8b5cfc3e11ae6e637378f/esp-hal/src/spi/master.rs#L3459-L3479 to pass the correct lengths for the read and write side rather than the max of both.

Dominaezzz commented 1 week ago

It's also worth noting that this bug would've been swept under the rug (like it is for some of the other chips) if the pdma was being reset during construction like the Gdma currently is.