In the future, we wish to have the CYBT-343026-01 act as an I2C master and have therefore connected it to an I2C bus with a peripheral. But we need to conditionally have the module act as a master as there is another I2C master on the bus. We do not need the BT module to ever act as a slave, but we need to have it not interfere with the I2C bus operation when the other master is active.
How can I disable the I2C bus operation in the module?
I've looked in 20706-A2_Bluetooth/apps/demo in WICED Studio, but see no mention of I2C.
In the API reference guide that comes with WICED Studio, I see wiced_hal_i2c_init() to initialize the I2C bus and other functions to operate the bus. However I don't see an indication of how to disable the bus. From empirical evidence, the default module seems to affect the I2C bus operation even without firmware that explicitly calls wiced_hal_i2c_init().
Can you try to get some input from the i2c demo code available for CYW20719 on Github: CypressAcademy_WBT101_Files/Projects/wbt101key/ch02 at master · cypresssemiconductorco/CypressAcadem...
I will check with our software team and try to get some more insight on this issue.
Thanks Sheetal. However, I am not seeing anything in there that helps.
I do see that wbt101key/ch02/key_ch02_ex08_i2c_motion/app.c utilizes the
I2C interface using wiced_hal_i2c_init(), wiced_hal_i2c_write(),
I am inferring that even without firmware calling wiced_hal_i2c_init()
the I2C interface is still active -- at least to the point where it
interferes with another I2C master using the bus. I say that because
the bus is not usable unless I pull the reset line on the BT module low.
We are looking for some way to have BT active (module not in reset) and
have the other I2C master use the I2C bus at the same time.
I think the concern is if you configure the I2C peripheral to be a master, it takes over the pins to be I2C_SCL and I2C_SDA. I think Steve needs a way to "disconnect" the pins from the I2C peripheral and reroute the pins to be plain GPIO's so they don't get in the way of the other processor driving them.
When the other processor is no longer on the bus, we need to reconfigure the IO's to be reconnected to the I2C hardware.
So what is being asked for is a way to dynamically "de-initialize" the I2C, connect the I2C pins to be pulled up (or floating) inputs, and then reinitialize I2C to re-control the pins.
You can save the I2C GPIO config and switch the functionality to GPIO for the I2C pins in high-z state. And later restore it from stored config for I2C functionality.
To clear doubt, I will check internally if wiced_hal_i2c_init() is called by default in firmware.
Sheetal - You'll have to provide information on "saving and restoring" the configuration as this is not documented. Also, wiced_hal_i2c_init() is not be called by default unless you are planning on using the I2C function. Then you have to add it to your initialization firmware.