Slave i2c address in mkl05

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Slave i2c address in mkl05

Jump to solution
1,656 Views
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?

Labels (1)
Tags (4)
0 Kudos
1 Solution
1,181 Views
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

View solution in original post

0 Kudos
7 Replies
1,181 Views
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 Kudos
1,181 Views
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 Kudos
1,181 Views
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 Kudos
1,181 Views
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 Kudos
1,181 Views
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 Kudos
1,181 Views
krzysztofstasch
Contributor I

Thank you for the reply.

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

Regards

0 Kudos
1,182 Views
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 Kudos