cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L053 GPIO Outputs not working

quanngo
Visitor

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

 



1 ACCEPTED SOLUTION

Accepted Solutions

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.

 

View solution in original post

7 REPLIES 7
gbm
Lead III

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

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

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
Up vote any posts that you find helpful, it shows what's working..

Thanks; It's been debugged and step though many times. the code run properly just that the affect on the gpio output is not as desired ... it happend on random GPIOs on different chips 

here is the clock tree:

quanngo_0-1737060117890.png

thoughts, ideas?

 

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

Not familiar with your code or board.

There's probably a rational explaination, you'd need to isolate sections of code, and present a stronger case as to what specifically is happening.

What do these pins connect too on the board?

Double check what speed the chip is running, perhaps confirm via PA8/MCO, double check flash wait states, power.

Plots from Cube show what you wanted, register bit settings might illustrate what you got.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

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.