cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple I2C DMA requests on STM32H7, chained together

YB.1
Associate

Hi, I want to transmit the following sequence with DMA, ideally without any interrupt (except once all the data transferred i.e. at the end of the whole operation).

I'm talking in I2C with a device that works like that :

  • Send one byte for read request and one byte for register.
  • Receive one byte of data per register.

I need to access registers A1 A2 A3 A4 A5 and the byte read instruction is FF so in essence the sequence would be :

[send FF A1] <receive result, register A1 byte> [send FF A2} <receive register A2 byte> [send FF A3 ] < <receive register A3 byte> [send FF A4] <receive register A4 byte> [send FF A5] < <receive register A5 byte>

Is it possible to, for example, write in a transmit buffer something like :

TxBuf = { FF, A1, FF, A2, FF, A3, FF, A4, FF, A5 }

And then call some HAL DMA function with arguments TxBuf, RxBuf, and somewhat have DMA requests chained together so that RxBuf fills itself without any interruption until transfer is complete?

i.e. obtain =>

RxBuf = { value of reg. A1, value of reg. A2, value of reg. A3, value of reg. A4, value of reg. A5 }

I know there exists "Request generators" inside the STM32H7, I'm just not sure how it could work for my particular problem. Perhaps someone with some experience using DMAMUX/request generators on the STM32H7 could shed some light?

I suppose one would have to chain together DMA requests I2C2_TX and I2C2_RX so that TX is followed by RX which would be followed by TX etc.?

2 REPLIES 2
ripper121
Associate II

Hi :),

did you got i working?

I have also a Project where I want to use the DMA for I2C2, but I'm little confused with the naming RX and TX with I2C.

Design strikes me as one you'd need to manage your own list and queues either under interrupt, in a thread, or with the M4 core.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..