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

Cortex Beginner: Cannot Blink LED

Hi

I am migrating from 8-bit PIC MCUs to Cortex MCUs, so I got STM32F0 discovery board (MB1034B) as a starter. I am using Keil IDE for development.

To turn on LED connected to PC8 port on the board, I wrote the following code:


#include "stm32f0xx.h"


int main(void)
{

RCC->CR |= RCC_CR_HSION;
RCC->CFGR &= ~ RCC_CFGR_SW;
RCC->CFGR &= ~ RCC_CFGR_SWS;
RCC->AHBENR |= RCC_AHBENR_GPIOCEN;
GPIOC->MODER |= GPIO_MODER_MODER8;
GPIOC->OTYPER &= ~ GPIO_OTYPER_OT_8;
GPIOC->OSPEEDR |= GPIO_OSPEEDER_OSPEEDR8;
GPIOC->PUPDR &= ~GPIO_PUPDR_PUPDR8;

while(1){

GPIOC->ODR |= 0x0300;

}

}

Despite looking at the debugger and finding that registers are toggled as intended, the LED on port PC8 doesn't turn on at all.

What could be the issue?

Thanks