- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I need to configure to use 1 I2C both as master and slave. At first the I2C is configured as master and then once the master is done sending data, it is configured as slave. I am thinking of using a SCB block and then switching between the configuration. Is it possible to do so?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Good luck.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I understand your explanation. But as of now I still want my I2C to switch between master and slave. Is it possible with SCB?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.