2025-01-16 11:57 AM
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!
Solved! Go to Solution.
2025-01-16 06:22 PM
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.
2025-01-16 11:59 AM
Make sure that BOOT0 pin is at logic 0 level.
2025-01-16 12:28 PM
BOOT0 is at 0. btw, the firmware is running but the gpio output is not as expected.
2025-01-16 12:34 PM
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
2025-01-16 12:42 PM
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:
thoughts, ideas?
2025-01-16 12:55 PM
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
2025-01-16 01:03 PM
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.
2025-01-16 06:22 PM
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.