One question, why do you want to change the I2c from master to slave?
Normally, the I2C block inside a microcontroller is configured as a master and any other external device (eeprom, adc, etc.) is treated as slave. If you want to share communication between two or more microcontrollers having other devices too, you can configure the microcontroller's I2C as multmaster.
Why do you want to change the I2c from master to slave - That is how the application is designed (for reasons I cannot mention)
How is having multi master going to help in this situation? I need to write data to a device (acting as master) and then wait for the other device to send me data(now acting as slave)
Hi, there is no need to post the specific application of your circuit. But for example, I use a microcontroller as master and a I2C eeprom as slave. The master sends commands to the eeprom and if it is a command that requires a response, the eeprom will send the response and the master will receive it without changing to slave.
In other words, master starts communication and depending on the command used, it will wait a response from the slave.
I suggest you to check the examples available in Cypress website.
I understand your explanation. But as of now I still want my I2C to switch between master and slave. Is it possible with SCB?
1 of 1 people found this helpful
Yes, if you use the unconfigured SCB. The function SCB_I2CInit(SCB_I2C_INIT_STRUCT *config) lets you to change the mode of operation. See page 28 of the datasheet of the SCB component.