2026-04-16 11:30 PM
Heyho,
using L073 at 32MHz, so even I2C transfers "seem" fast, at least in "fast mode plus" at SCL 1 MHz. And I don't want to over-use clock stretching.
I'm looking for a way to use I2C slave receive with DMA, but an unknown transfer length.
Right now it looks to me as if I could do the following:
Any problems with that?
Have only 1 device for now...
Thanks!
Solved! Go to Solution.
2026-04-20 8:35 AM
Working nicely!
The I2C slave's DMA RX is set to maximum buffer size, when an I2C bus STOP (funny wording) is found a flag is set in the I2C IQR, which is then checked by the I2C control function.
This compares the first received data byte ( = I2C packet length) in the DMA RX buffer with the CNDTR register, which should be buffer max - rx length.
But boy, there were some *** mistakes on my side, mostly with the I2C TX test function in the same MCU with another I2C peripheral (e.g. forgot to clear NBYTES in CR2).
And 2 big things I found in the L073 errata (2.12.9 Transmission stalled after first byte transfer).
The other one the minimum clock requirements.
With DMA this seems to run smoothly at CPU clock 32 MHz (L073 max) even in "Fast Mode Plus" (1Mbit) - for now...
2026-04-20 8:35 AM
Working nicely!
The I2C slave's DMA RX is set to maximum buffer size, when an I2C bus STOP (funny wording) is found a flag is set in the I2C IQR, which is then checked by the I2C control function.
This compares the first received data byte ( = I2C packet length) in the DMA RX buffer with the CNDTR register, which should be buffer max - rx length.
But boy, there were some *** mistakes on my side, mostly with the I2C TX test function in the same MCU with another I2C peripheral (e.g. forgot to clear NBYTES in CR2).
And 2 big things I found in the L073 errata (2.12.9 Transmission stalled after first byte transfer).
The other one the minimum clock requirements.
With DMA this seems to run smoothly at CPU clock 32 MHz (L073 max) even in "Fast Mode Plus" (1Mbit) - for now...