2012-07-16 09:14 AM
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 #dma2012-07-16 12:29 PM
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.2012-07-16 02:59 PM
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 Peacock2012-07-17 01:11 AM
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.2012-07-17 01:13 AM
Hi Jack,
Thanks for your reply too - I shall look into doing this a different way.