cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F3 GPIO not working properly

Amine cheriti
Associate II
Posted on May 28, 2018 at 21:30

Hi guy,

I'm new to STM32. I'm using a STM32F373. I'm just trying to use the GPIO, and turn on some LEDS that are on port C(C0,C1,C2,C3) but it does not work. Actually, my problem is with the written operation. I am not able to configure my GPIOC->ODR register to turn on only LED1 (which is on C0). I tried to use the BSRR register but I get the same result: LED2-3-4 turn on( C1,C2,C3) but the only LED I was trying to power on is off... Thanks for the help !

#include 'stm32f3xx.h' // Device header

unsigned int i;

int main(void)

{

//AHB peripheral clock enable register, needs to be activated so that the readable values are good (used to recude power consumption)

(RCC->AHBENR )= (1UL << 19);

//GPIO mode register Configure desired I/o pin as out,in,analog

//(GPIOC->MODER)= 0x00000031;

(GPIOC->MODER)|= 0x00000055;

// Reset output data register

//(GPIOC->ODR) = (0x00000000);

while(1)

{

// First attempt with ODR

GPIOC->ODR|=0x00000001;

// Second attempt with BSRR

//GPIOC->BSRR=1<<0;

}

}
3 REPLIES 3
Artur IWANICKI
ST Employee
Posted on May 29, 2018 at 07:18

Hello,

What is the full partnumber of the MCU you are using?

Would it be possible for you to share screenshot with GPIOC registers content after write '1' on PC0, please (including GPIOC->IDR)?

Thank you in advance,

Best Regards,

Artur

Jan Waclawek
Senior II
Posted on May 29, 2018 at 07:42

How are the LEDs physically connected? Any drawing?

JW

Posted on May 29, 2018 at 08:08

Or anything else connected to this GPIOs ?

I'm new to STM32.    ... 

STM32F3 GPIO not working properly

Seems a bit of a contradiction to me.

I always start to look at my work for mistakes.