2023-11-27 11:58 PM
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.
2023-11-28 12:41 AM
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
2023-11-28 6:39 AM
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.
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.