cancel
Showing results for 
Search instead for 
Did you mean: 

Blocking a GPIO pin to LOW state

ECiot.1
Associate II

Hi, I have a circuit in which I want to check every cycle if a measured voltage is over a limit value and in that case disable the measure over one of four DUTs forcing to LOW the state of some pins. The problem is that in the main loop I have command line that set the state of the pin sometimes to high and sometimes to low and I would to find a way to block the state of a pin and do not change his state until the end of the program. I thought to use the IF but I have 4 DUTs to check and control separately.

2 REPLIES 2

You haven't told us which STM32 and which pins, so just a vague answer:

One of the tricks could be setting the pin to AF to a peripheral which can hold it low, e.g. timer. After that, writes to  GPIOx_ODR (directly or through GPIOx_BSRR) won't be reflected on the pin's state.

Nonetheless, this is not something you can click in CubeMX.

JW

TDK
Guru

Can't you implement this in program logic?

If out of bounds, don't change pin state.

I don't see how having 4 pins like this changes anything. If you have an array for them, you can do the check there. If not, four separate statements will work.

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