Skip to main content
Associate
Jan 16, 2025 7:57 PM UTC
Solved

STM32L053 GPIO Outputs not working

Hi,

We have a custom design based on STM32L053C8U8 with the pinout mapping  as image attached. The GPIOs setting and initialization code is generated by STM32CubeIDE version 1.17.0 and companion CubeMX . however, the GPIO level the output pins are not in line with the firmware control using HAL_GPIO_WritePin(). for example, HAL_GPIO_WritePin(GPIOA, GPIO_PIN_11, GPIO_PIN_RESET) won't sew the PA11 to LOW. 

The initialization code is attached. 

What's wrong? thanks in advance and appreciate your responses!

 

 

quanngo_0-1737057327704.png

 



This topic has been closed for replies.
quanngoBest answer
Associate
Jan 17, 2025 2:22 AM UTC

It's resolved. For those who will see the same problem, this is due to the fact that VDD_USB pin of the STM32L053C8 did not pull up resulting PA11 (and PA12) are not usable.

 

8 replies

gbm
Super User
Jan 16, 2025 7:59 PM UTC

Make sure that BOOT0 pin is at logic 0 level.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
quanngoAuthor
Associate
Jan 16, 2025 8:28 PM UTC

BOOT0 is at 0. btw, the firmware is running but the gpio output is not as expected.

Tesla DeLorean
Guru
Jan 16, 2025 8:34 PM UTC

Then debug...

Start by checking the clocks in the RCC, then the pin/bank initialization in the GPIOx peripherals.

If it's running your code you should be able step through it, set break points and inspect memory/peripherals

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
waclawek.jan
Super User
Jan 16, 2025 8:55 PM UTC

Read out and check/post content of GPIOA registers.

What is connected to PA11? How do you measure it? Did you measure it directly at the chip's pin?

JW