I have set the I2C SDA and SCL lines at GPIO_PIN_0 and GPIO_PIN_1 respectively, of I2C_GPIO_PORT = 0, defined as
#define I2C_GPIO_PORT GPIO_PORT_0
#定义I2C_SCL_PIN全科医生IO_PIN_1
#define I2C_SDA_PIN GPIO_PIN_0
The I2C operations are all working correctly, and both SCL and SDA are HIGH when I2C is not in operation
I want to be able to manually pull SDA pin LOW for a certain amount of time, then pull it back HIGH after the timer expires, without affecting the SCL line
I tried calling
GPIO_SetInactive( I2C_GPIO_PORT, GPIO_PIN_0 );
to pull SDA LOW, then started a timer and in the timer callback function, I added
GPIO_SetActive( I2C_GPIO_PORT, GPIO_PIN_0 );
to pull it back HIGH
I am observing SDA on an oscilloscope but it is not changing at all
timer period as 3 sec for now, but I need it to be 40 ms in my final program
How can I manually change the logic level of the SDA pin?
Extra information in case this is relevant: I am working on the PRO development board and the
#define CFG_DEVELOPMENT_DEBUG
line is present in da1458x_config_basic.h,
I also tried adding #undef CFG_DEVELOPMENT_DEBUG, but it still doesn't work
If I try to toggle the LED instead of the SDA line, it works correctly
LED is defined as
#elif HW_CONFIG_PRO_DK
#define GPIO_LED_PORT GPIO_PORT_1
#define GPIO_LED_PIN GPIO_PIN_0
This was solved by changing the SDA pin to a general GPIO type
GPIO_ConfigurePin(I2C_GPIO_PORT, I2C_SDA_PIN, OUTPUT, PID_GPIO, false);
The pin can be manually set to 0 or 1 after this
To change it back to I2C SDA, call the GPIO_ConfigurePin() function again
GPIO_ConfigurePin(I2C_GPIO_PORT, I2C_SDA_PIN, OUTPUT, PID_I2C_SDA, false);