Slave i2c address in mkl05

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Slave i2c address in mkl05

跳至解决方案
2,323 次查看
krzysztofstasch
Contributor I

Hi, I'm working with mkl05 uC, where I use the mkl as I2C slave. The datasheet states that multiple slave addresses can be assign to the uC, so my question is how can the mkl find out which slave address the master uses in the transaction?

标签 (1)
标记 (4)
0 项奖励
回复
1 解答
1,848 次查看
mike_susen
NXP Employee
NXP Employee

Hi,

I2C_RA is range register for address. For example: If you fill registers I2C_A1=0x0A and I2C_RA=0x0C, then I2C slave will receive data for addresses from 0x0A to 0x0C. Unfortunately you cannot detect for which of the addresses data are. Register I2C_A2 is address register for SMBus.

Regards

在原帖中查看解决方案

0 项奖励
回复
7 回复数
1,848 次查看
mike_susen
NXP Employee
NXP Employee

Hi Krzysztof,

You can choose any address that you like. In slave application write address in to I2C_A1 register. In master application is slave address send as data with R/W bit after START condition.

Regards

Michal

0 项奖励
回复
1,848 次查看
krzysztofstasch
Contributor I

Hi,

Sorry that I did not specify my question clearly. I want to implement different functionalities in the mkl05 depending on the slave address being sent by master.

I write the slave address to I2C_A1, then the second slave address either to I2C_A2 or I use the range address register to make the mkl05 respond to multiple slave addresses. Then I have a master that uses more than one slave address, let's say the master sends data using 0xA0 address and next data using address 0x4B. Then I need that the mkl05 knows which address was used by the master 0xA0 or 0x4B in order to process the data depending on the slave address. So when the mkl05 sees the address 0xA0 it stores the data in its SRAM thus emulating an I2C EEPROM and when it sees the address 0x4B I want that the mkl displays some text on LCD display.

I couldn't find that information in the datasheet.

Regards

0 项奖励
回复
1,848 次查看
martynhunt
NXP Employee
NXP Employee

Hi Krzysztof,


The address that caused an address match for the slave can be determined in software. When the dummy read of I2Cx_D is performed (after checking if IAAS is set), software should store the data (the address) so that software behavior can change based on the value received.


If you have any further questions, please let me know.


Thank you,


Martyn

0 项奖励
回复
1,848 次查看
grzegorzkonopko
Contributor III

Hi Martyn

Does Processor Expert support this functionality? (range addres and determined address) I can not find this in option.

Regards

/Greg

0 项奖励
回复
1,848 次查看
mike_susen
NXP Employee
NXP Employee

Hi,

I´m sorry but this is not standard behavior of the I2C and it is not supported in our I2C peripheral. But you can emulate I2C by GPIO method or use KL43Z chip with FlexIO peripheral.

Regards

Michal

0 项奖励
回复
1,848 次查看
krzysztofstasch
Contributor I

Thank you for the reply.

Can you explain what purpose serve the registers I2C_RA and I2C_A2?

Regards

0 项奖励
回复
1,849 次查看
mike_susen
NXP Employee
NXP Employee

Hi,

I2C_RA is range register for address. For example: If you fill registers I2C_A1=0x0A and I2C_RA=0x0C, then I2C slave will receive data for addresses from 0x0A to 0x0C. Unfortunately you cannot detect for which of the addresses data are. Register I2C_A2 is address register for SMBus.

Regards

0 项奖励
回复