0
votes

I'm porting an I2C driver from Atmel AVR32 U3 to an Energy Micro EFM32GG Cortex-M3 device. The driver uses the Atmel BSP for communicating with the I2C bus, providing it with the address of the slave device, the register address, and the data.

The Energy Micro BSP doesn't implement the register address. My question is, according to the standard I2C protocol, can I just add the register address as the first byte of the data sent?

1
You should specify exactly what processor you are using. You are probably correct that you can just put the address at the start of your data. But the usage model should be very clearly spelled out in the user manual for your processor.TJD
@TJD it's ARM cortex M3 - EFM32 Giant Geckostdcall
@Mellowcandle: In the question rather than a comment - I edited it for you.Clifford

1 Answers

6
votes

While the I2C protocol is standardised, I2C peripheral devices are not likley to be identical (or even similar) between different vendors. While it might be useful to retain the API from your Atmel implementation - for portability of your application code - you will likley have to change the underlying implementation entirely.

The reference manual for your part will describe in detail the register interface and hardware operation of its I2C peripheral. You will see that it bears little relation to the corresponding Atmel peripheral other than similarities due to the I2C protocol itself. Moreover the implementation of DMA will differ between the parts, so the driver will differ there also.

Energy Micro have an application note on I2C operation with C source code. That is where you should probably start.