cancel
Showing results for 
Search instead for 
Did you mean: 

I2C_SDA pin value setting

Icont.1
Associate II

Good evening, I would need, for a project with a custom board that mounts a micro STM32H7A3... to be able to set the value of a pin to 0 or 1 during the code and not via MX cube for the initial settings which function could I use? I would like to point out that the pin in question is set as I2C_SDA and not GPIO_output generic.

3 REPLIES 3

Switch it to GPIO output in GPIOx_MODER, and then back again when you need so.

> which function

You need only the bitwise AND (&) and OR (|) operators for that.

JW

TDK
Guru

The behavior of SDA is governed by the state machine of the peripheral.

If you want to set it to an arbitrary value, initialize the pin as a GPIO output, then set it back to I2C AF mode when finished.

If you feel a post has answered your question, please click "Accept as Solution".
Icont.1
Associate II

thanks for the answers but I did not understand how to do. I have no way to use the functions Hal_GPOI on the SDA pin because I have no way to get to the reference GPOIx since I have no references to code of how this particular pin is defined.