We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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