Prototype21
New Member
HI,
I have written the below code for my STM32F446RE Nucleo board. All I am trying to do is turn on Pin PA3, Pin PA2 and onboard LED Pin PA5. The code compiled and flashed successfully. But no success in turning on LED pins except onboard LED Pin PA5. I don't know why Pin PA3 and Pin PA2 is off?? Am I missing any register?? Need some help guys.
Thank You
I have written the below code for my STM32F446RE Nucleo board. All I am trying to do is turn on Pin PA3, Pin PA2 and onboard LED Pin PA5. The code compiled and flashed successfully. But no success in turning on LED pins except onboard LED Pin PA5. I don't know why Pin PA3 and Pin PA2 is off?? Am I missing any register?? Need some help guys.
C:
// Enable clock access to the port.
// Set pin mode
// Set pin as o/p
#include "stm32f4xx.h" // Device header
#define RED (1U << 3) // PIN PA3
#define VIOLET (1U << 2) // PIN PA2
#define GREEN (1U << 5) // PIN PA5 Onboard LED
#define GPIOA_CLOCK (1U << 0)
#define RED_OUT_BIT (1U << 6) // General purpose output
#define VIOLET_OUT_BIT (1U << 4) // General purpose output
#define GREEN_OUT_BIT (1U << 10) // General purpose output
int main() {
RCC -> AHB1ENR |= GPIOA_CLOCK;
GPIOA -> MODER |= RED_OUT_BIT | VIOLET_OUT_BIT | GREEN_OUT_BIT;
while(1) {
GPIOA -> ODR |= RED | VIOLET | GREEN;
}
}
Thank You