I am trying to write a bare metal program to blink green led. In fact, I am unable to turn any LEDs on or off. This is an off-the-shelf board. The board name is NUCLEO F429ZI. Board Image
I have gone through the schematics and I am sure that the pin is PA5
i.e. Port A and pin number 5. However, the led isn't blinking at all. I can see that my code is loaded onto STM32 board using uVision IDE.
I have tried setting blue LED i.e. PB7 but that also didn't work at all.
void delayMs(int delay);
int main(void)
{
//enable clock access to A
RCC->AHB1ENR |= 1; //enable GPIO A clock
GPIOA->MODER |= 0x400; // PA-5 01 0000 - PA0
while(1)
{
GPIOA->ODR |= 0x20;
//delay
delayMs(100);
GPIOA->ODR &=~ 0x20;
delayMs(100);
}
}
void delayMs(int delay)
{
int i = 0;
for(; delay >0; delay--)
{
for(i=0; i<3195; i++)
{
}
}
}
The green LED in the STM32F429ZI should blink.
Next, I tried turning on the blue LED that is also not working. As per my understanding by looking at schematics - PB7 should be turned on for blue LED. But this is also not working.
#include "stm32f4xx.h"
int main(void)
{
RCC->AHB1ENR |= 1;
// ob 01 00 00 00 00 00 00 00 // PB7
GPIOB->MODER = 0x4000;
for(;;)
{
GPIOB->ODR = 0x80;
}
}