Directly controlling I2C SDA pin using GPIO_SetInactive() and GPIO_SetActive()

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
2 posts / 0 new
Last post
mahaju
Offline
Last seen:2 years 1 month ago
加入:2018-01-29 01:08
Directly controlling I2C SDA pin using GPIO_SetInactive() and GPIO_SetActive()

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 GPIO_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

Keywords:
Device:
mahaju
Offline
Last seen:2 years 1 month ago
加入:2018-01-29 01:08
This was solved by changing

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

改变我t back to I2C SDA, call the GPIO_ConfigurePin() function again

GPIO_ConfigurePin(I2C_GPIO_PORT, I2C_SDA_PIN, OUTPUT, PID_I2C_SDA, false);