AnsweredAssumed Answered

STM32F3 GPIO not working properly

Question asked by Amine cheriti on May 28, 2018
Latest reply on May 29, 2018 by AvaTar

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;
}
}

Attachments

Outcomes