cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103C8 GPIO Output

inkong
Associate

I'm trying to control LED using GPIO.

The GPIO pin settings are as follows.

PB 8~15 : input data

PB 4~7 : output LED

After analyzing the input data, I want to export the output, but when PB 4 is exported, PB 12 is turned on, and when PB 5 is exported, PB 13 is turned on.

Interference pins have no H/W connection.

How can I solve this problem??

1 REPLY 1
TDK
Guru

A few possibilities:

  • Your code doesn't do what you think it does. There are GPIO toggling examples in the CubeMX repo. Debug your code and examine GPIO_ODR register values to ensure pin PB5 (for example) toggles when you try to toggle it. Examine GPIO_IDR to ensure pin reflects ODR value.
  • The pin you're toggling isn't connected to what you think it is. What hardware is this? Show your schematic. Recheck wiring.

You're off by 8 in both instances. Perhaps there's a corresponding error in your code.

If you feel a post has answered your question, please click "Accept as Solution".