Address registers I2C in MK10

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Address registers I2C in MK10

ソリューションへジャンプ
1,566件の閲覧回数
nikivendola
Contributor III

Hi All,

in the figure below you can see the time diagram of a MAG3110 I2C (slave).

137978_137978.pngImmagin2e.png

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?

タグ(3)
0 件の賞賛
返信
1 解決策
1,315件の閲覧回数
mjbcswitzerland
Specialist V

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:

pastedImage_0.png

Regards

Mark

元の投稿で解決策を見る

5 返答(返信)
1,315件の閲覧回数
Stano
NXP Employee
NXP Employee

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.

1,315件の閲覧回数
nikivendola
Contributor III

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?Immagin2e.png

0 件の賞賛
返信
1,315件の閲覧回数
mjbcswitzerland
Specialist V

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

I2C: http://www.utasker.com/docs/uTasker/uTaskerIIC.PDF

1,315件の閲覧回数
nikivendola
Contributor III

But in the I2C address register _A1 I gotta put 0xC4 to identify the slave?

0 件の賞賛
返信
1,316件の閲覧回数
mjbcswitzerland
Specialist V

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:

pastedImage_0.png

Regards

Mark