I2C Multimaster in FRDM-K64F with KDS and Processor Expert

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

I2C Multimaster in FRDM-K64F with KDS and Processor Expert

Jump to solution
1,198 Views
quevedo
Contributor V

Hello,

I am working on a project for a FRDM-K64F board, using KDS 3.0 and Processor Expert (bare metal, no RTOS). I am using Processor Expert and added a Generic I2C component, that works on top of a I2C LDD component. I have enabled interrupts, and I have configured PE generic I2C to generate code for the OnError event. The peripheral is working on master/slave mode, since I want to place the board into a multimaster I2C bus.

I have assembled a test jig, using a 24LC08 EEPROM IC, and a switch to put SDA line to GND. I can test if the bus is available reading the I2Cx_S register and checking the BUSY bit. However, I did not think of a way to test the simultaneous START signal from 2 masters, and to check arbitration loss. I also do not know if when one Kinetis I2C peripheral device loses arbitration, if it switches automatically to slave mode and if it responds as a slave when the ID sent by the other master matches the slave ID of the device that just lost arbitration.

I would like to know if someone has some example code working on the constraints presented above.

Thanks in advance.

Labels (1)
1 Solution
638 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Antonio Quevedo:

I do not have example code to test this situation, but your assumption is correct, when the Kinetis I2C module loses arbitration it automatically switches to slave mode and should respond to a matching incoming address. This text is from K64 Reference Manual:

K64_I2C.png

Also, be aware that arbitration lost is not the only cause for the OnError event. You can find the error masks in PE_types.h:

pastedImage_3.png

Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
2 Replies
639 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Antonio Quevedo:

I do not have example code to test this situation, but your assumption is correct, when the Kinetis I2C module loses arbitration it automatically switches to slave mode and should respond to a matching incoming address. This text is from K64 Reference Manual:

K64_I2C.png

Also, be aware that arbitration lost is not the only cause for the OnError event. You can find the error masks in PE_types.h:

pastedImage_3.png

Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
638 Views
quevedo
Contributor V

Thanks! I am aware that there can be other reasons for an OnError call, and my software will deal with that. I just wonder if there is any way to make a test for bus arbitration loss. I am thinking on connecting the set input of a flip-flop to the SDA line (triggeting on trailing edge), with a push-button on reset line. Its output will be connected to an open-collector inverter, and its output to the SDa line. Thus, when my board lowers SDA, the flip-flop will lock this line on low, and my device will lose arbitration.

I will let you know if that worked.

Thanks once more

Antonio