Hi All,
in the figure below you can see the time diagram of a MAG3110 I2C (slave).
The Master is a MK10.
The addresses of Device and Register must be written first one then after tx, the other in I2Cx_A1 register or there are other registers?
Solved! Go to Solution.
Hi
I2Cx_A1 is used only when you are acting as a slave and not when acting as bus master. This is clear in the register description:
Regards
Mark
Hi Nikivendola,
The I2C communication is in basic style.
For the "READ" command the first byte you need to write is the Device_ID - it is 0xC4 for MAG3110. Then the slave answers by ACK, next byte you need to write the register address you want to use, the slave answers by ACK, then the master need to generate "repeat_start" and read the byte. The slave in this action sends the data from addressed register and automatically increments the internal registers address pointer. Now it is up to you (master) - is you send the ACK, the slave will send next data from the next register. If you send NACK and then the STOP condition, the communication will be finished.
The important is to use the right addresses in this communication.
For the 'WRITE" command, after first two byte written and answered ACK by slave, you can write such data into addressed register. The slave will answer ACK and then master can finish the write process by STOP condition.
In the normal read mode the slave sends the 16-bit data - two bytes. In the Fast mode the only higher byte is send - 8-bit data.
If you need more help, you are welcome.
Best Regards,
Stano.
Thanks for the reply.
So I have to use to identify the slave 0xC4 ...
however, in which the master registry you have to write the device address (which is 0xC4) and to what another register in which the master must write the Register address, which can be, for example 0x10 (CTRL_REG1)?
It is two different addresses where you have to write nell'I2C of MK10?
Hi
All of the addresses and the data are written to the I2C_D register. There are no special registers used for addressing either the slave on the bus or the slave's internal register - it is just a sequence of data byte transmissions befined by you.
To send the slave's address the only special operation is that you set the master's start bit beforehand so that the data on the bus is understood by slaves as an address.
Regards
Mark
But in the I2C address register _A1 I gotta put 0xC4 to identify the slave?
Hi
I2Cx_A1 is used only when you are acting as a slave and not when acting as bus master. This is clear in the register description:
Regards
Mark