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?
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.
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.
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.
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.
Thank you for the reply.
Can you explain what purpose serve the registers I2C_RA and I2C_A2?
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.
Does Processor Expert support this functionality? (range addres and determined address) I can not find this in option.
Retrieving data ...