Hello,
We are developing a new device using CC1352R with two slave I2C devices on two different I2C-bus lines. This MCU has only one I2C bus and we decided to write a software implemented I2C interface. It works properly.
The project is created with the latest SDK 7_10_02_23 and using RTOS. Pins SCL and SDA are defined as outputs - open drain with external pull-ups 10kOhm. Everything works properly.
We would like our code to be written according to the best practices and the philosophy of the current SDK.
1. Pins SCL and SDA are defined in the begging as outputs - open drain.
Example:
GPIO_setConfig(CONFIG_GPIO_I2C_LEDDRV_SDA, GPIO_CFG_OUTPUT_OPEN_DRAIN_INTERNAL | GPIO_CFG_OUT_STR_MED | GPIO_CFG_OUT_HIGH);
GPIO_setConfig(CONFIG_GPIO_I2C_LEDDRV_SCL, GPIO_CFG_OUTPUT_OPEN_DRAIN_INTERNAL | GPIO_CFG_OUT_STR_MED | GPIO_CFG_OUT_HIGH);
2. During the execution of the code we check the state of the pin SCL with the function GPIO_read(...). It works properly.
The questions are:
2.1 If the pin is defined as output ONLY how does the function GPIO_read() works?
2.2 In this case, is it necessary the pins SCL and SDA to be configured as inputs and output together to be able to write and read the pins?
2.3 If we can read the pin state always with function GPIO_Read(...), that means we don't need to reconfigure the pin to be input during the I2C read operation (SDA line is open drain with pull-up in High state). Is that correct?
Again, our purpose is out code to be written by the best way according to the philosophy of the SDK.
Thank very much in advance for you response.