cancel
Showing results for 
Search instead for 
Did you mean: 

Possible to use TWO circular DMA buffers for same I2C rxd?

flyer31
Senior

Hello,

I would like to use TWO circular DMA buffers for ONE I2C interface.

Depending on received address byte, in the ADDR interrupt I would always enable the correct circular buffer (disabling the other one - so at one time always only ONE buffer is active).

So I would like, depending on address of the received I2C message, switch the CCR_EN bit of the two DMA channels ... would this work? (or would switching EN off / on somehow reset the internal CNDTR setting?).

(In 12.4.4 DMA arbitration there is a note "If the channel x is disabled, the DMA registers are not reset... " ... so I have the slight hope that this might work?).

1 ACCEPTED SOLUTION

Accepted Solutions
KiptonM
Lead

I do not think it will work, because there is only 1 DMA per device. You cannot map 2 DMA Devices to I2C1 RX for example.

If you see something different, I would like to know.

View solution in original post

3 REPLIES 3
KiptonM
Lead

I do not think it will work, because there is only 1 DMA per device. You cannot map 2 DMA Devices to I2C1 RX for example.

If you see something different, I would like to know.

I skipped it now... I use a different scheme now with one buffer only and a separate list/array marking the addresses and the corresponding DMA buffer start offsets.

Thank you for your answer.

Singh.Harjit
Senior II

There is one DMA request from the I2C RX and another DMA request from the I2C TX.

These go into the DMAMUX and you can map any DMA channel to the DMA request. Look at Table 91 in RM0440 for the mapping between the DMA request and the DMAMUX input selection.

So, for example, you can have two different DMA channels setup to service the I2C RX. You can have one disabled and the other enabled and its DMAMUX input select should correspond to the I2C RX.

You can do interesting things like chain DMA and I think (not 100% sure because I haven't looked at it in a very long time) you can ping pong between them but like I said it has been a very long time since I've looked at this.