cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H750B-DK output pins don't work while using the display

AK16
Associate

Hi,

I am trying to make a relay driver with STM32H750DB-K, so I could switch the relays with toggle buttons on display, but I have a difficulty writing on digital pins.

When I don't generate code from TouchGFX (so starting from scratch) and just write on output pin E3 calling the function HAL_GPIO_WritePin(GPIOE, GPIO_PIN_3, GPIO_PIN_SET); in while function of main.c the voltage on pin E3 is set to 3.3V as expected. But when I generate a simple code with TouchGFX (just a toggle button) and write function HAL_GPIO_WritePin(GPIOE, GPIO_PIN_3, GPIO_PIN_SET); in while function of main.c (which is in TouchGFX folder) the voltage on pin E3 is 0V. I tried this on several pins, but it is always the same.

Is there something obvious that I am missing? Does anyone know the solution to this problem?

3 REPLIES 3
RhSilicon
Lead

Generic codes can access the entire Port, this way despite momentarily having the state change in the HAL_GPIO_WritePin() instruction right after the display routines can be accessing the port that was controlled via HAL_GPIO_WritePin().

So that this type of problem does not occur when accessing the port, it is necessary to use a mask so that only the desired pins (bits) are modified.

uint32 target_reg = GPIOA->ODR;
uint32 mask = (1<<5); // mask = 0x00000020      
target_reg = target_reg | mask;
uint32 target_reg = GPIOA->ODR;
uint32 mask = ~(1<<5); // mask = 0xFFFFFFDF         
target_reg = target_reg & mask;

Ref.: https://hackmd.io/@hrbenitez/158_2s2223_GPIO

I don't know if it can help in your case, but I found these videos about advanced debugging:

https://youtube.com/playlist?list=PLnMKNibPkDnEDEsV7IBXNvg7oNn3MfRd6

Smartembedded
Associate III

Perhaps the GPIO you try is later reconfigurated to be input or an alternate function.

Also check if \TouchGFX\target\TouchGFXGPIO.cpp happends to use your GPIO.