This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Blink Newbie help debug!

Hi Forum.

I'm new to ARM, but have experience with AVR. I'm just trying to make a Hello World with blinky LEDs. I have this board:

https://forum.micropython.org/viewtopic.php?t=3086

So ok, everything seems to be setup right. I can compile and also program the Flash, it verify's with no errors. There are two onboard LEDs connected to A6 and A7 (it says so in the link, but I have also double checked). I can't get them to blink or flash. 

This is my code:

#include "stm32f407xx.h"

void myDelay(int times){

	volatile int i, j;

	for (i = 0; i < times; ++i) {
		j++;
	}
}

void ini(void){
	RCC -> AHB1ENR |= RCC_AHB1ENR_GPIOAEN; //enable GPIO clock for AHB og RCC
	GPIOA -> MODER |= GPIO_MODER_MODER6_0 |GPIO_MODER_MODER7_0;
	GPIOA -> OTYPER &= ~(GPIO_OTYPER_OT_7|GPIO_OTYPER_OT_6);
	GPIOA -> OSPEEDR |= GPIO_OSPEEDER_OSPEEDR7_1 | GPIO_OSPEEDER_OSPEEDR6_1; //High speed 10
	GPIOA -> PUPDR &= ~(GPIO_PUPDR_PUPDR7 | GPIO_PUPDR_PUPDR6);

}


int main(void)
{

	void ini();

    while(1)
    {

    	GPIOA -> BSRRL |= 0x000000C0; //Bit Set 6 & 7
    	myDelay(200000);
    	GPIOA -> BSRRL |= 0x00C00000; //Bit 6 & 7 reset
    	myDelay(200000);
    }

    return 0;
}

I hope someone can help me se what I'm doing wrong?

Best Regards

Ole.