Associate
May 28, 2018
Question
STM32F3 GPIO not working properly
- May 28, 2018
- 2 replies
- 1268 views
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; }}