cancel
Showing results for 
Search instead for 
Did you mean: 

Bridging I2C Ports Using DMA

dclark9
Associate II
Posted on July 16, 2012 at 18:14

Hi,

Just a very quick question - is it fairly easy or even possible to bridge or tie 2 I2C ports together using a DMA. It's just something that I'm looking to do due to a change in a requirement whereby we just want to passthrough data from one I2C to another with the processor not actually doing anything with it.

Many thanks in advance for any replies,

Dave

#i2c-dma #i2c #dma
4 REPLIES 4
Posted on July 16, 2012 at 21:29

You can't really bond things together in this fashion with DMA. I2C being a particularly difficult thing to forward, and back propagate error or ACK conditions. Even copying GPIO states back and forth would be difficult as the bus is bi-directional.

Some wire would be easier.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
jpeacock2399
Associate II
Posted on July 16, 2012 at 23:59

It's not impossible but the interrupt routines (DMa and I2C) will be lengthy and complicated because I2C is not a simple data transfer like an SPI port.  You would have to manage buffers, allocating a buffer to each incoming message, freeing it as the outgoing DMA completes, all the while sequencing the I2C protocols on both channels.  The data rates would be asynchronous between source and destination because you can't start a DMA transmit until a complete message arrives.

Lot of CPU overhead if it all occurs in an interrupt.  I wouldn't approach the problem that way, simpler to have one task feed the mesages into a queue. and a second task drain the queue.

  Jack Peacock

dclark9
Associate II
Posted on July 17, 2012 at 10:11

Mmm - had a horrible feeling that might be the case, and unfortunately a wire is out of the question due to the hardware being integrated and being inaccessible apart from via a bootloader.

I feel a state machine coming on!!!

Thanks for you reply.

dclark9
Associate II
Posted on July 17, 2012 at 10:13

Hi Jack,

Thanks for your reply too - I shall look into doing this a different way.