MOD5441X. I2C driver via DMA
Posted: Mon May 16, 2016 6:52 am
Hi, All
We realized I2C driver for MOD5441X working properly via CPU interrupts(working with EEPROM).
Due to some timing problems we would like to implement I2C driver writing/reading via DMA.
Copying from memory to memory via DMA also works properly but not from memory to I2C...
Implementing “write to I2C via DMA” I set DMAEN bit on I2C Control Register in I2C Start sequence, according to the document explanation. In I2C Write sequence I put address of my write buffer to DMA Source address(sim2.edma.tcd[channel].saddr) and I put address of I2C Data register to DMA Destination address(sim2.edma.tcd[channel].daddr). Destination offset = 0 – all the time writing to the same data register(sim2.edma.tcd[channel].doff = 0). DMA Source offset sim2.edma.tcd[channel].soff" = 1(writing every byte). Minor loop(citer=biter=1). Major loop (nbytes = written_bytes_number). Writing buffer contains device address byte, EEPROM address(2 bytes) and written data bytes. DMA "channel" = 24 (I2C0 in our case). I set DMA interrupt bit and set DMA start bit. DMA informs about transmit finished(like in successful case of memory to memory copy)...
But no any transmit via I2c is initiated... No any clock of data seen via scope. No data is written to EEPROM
May be anybody have practice with this issue ? Any example or advice how to work with I2c via DMA ?
We realized I2C driver for MOD5441X working properly via CPU interrupts(working with EEPROM).
Due to some timing problems we would like to implement I2C driver writing/reading via DMA.
Copying from memory to memory via DMA also works properly but not from memory to I2C...
Implementing “write to I2C via DMA” I set DMAEN bit on I2C Control Register in I2C Start sequence, according to the document explanation. In I2C Write sequence I put address of my write buffer to DMA Source address(sim2.edma.tcd[channel].saddr) and I put address of I2C Data register to DMA Destination address(sim2.edma.tcd[channel].daddr). Destination offset = 0 – all the time writing to the same data register(sim2.edma.tcd[channel].doff = 0). DMA Source offset sim2.edma.tcd[channel].soff" = 1(writing every byte). Minor loop(citer=biter=1). Major loop (nbytes = written_bytes_number). Writing buffer contains device address byte, EEPROM address(2 bytes) and written data bytes. DMA "channel" = 24 (I2C0 in our case). I set DMA interrupt bit and set DMA start bit. DMA informs about transmit finished(like in successful case of memory to memory copy)...
But no any transmit via I2c is initiated... No any clock of data seen via scope. No data is written to EEPROM
May be anybody have practice with this issue ? Any example or advice how to work with I2c via DMA ?