I am trying to make a project with NUCLEO-H563ZI in μVision5, starting simple with opening the embedded LED on the board.
main.c:
#include "stm32h5xx.h" // Device header
#include "stm32h563xx.h"
#include "stdint.h"
#include "stdio.h"
static void GPIOConfig (void);
void SysClockConfig (void);
void SysClockConfig (void)
{
RCC->CR |= RCC_CR_HSEON;
while (!(RCC->CR & RCC_CR_HSERDY));
RCC->AHB1ENR |= 1<<28; //RCC_APB1ENR_PWREN;
ADC1->CR |= ADC_CR_ADVREGEN;
FLASH->ACR = FLASH_ACR_WRHIGHFREQ | FLASH_ACR_PRFTEN | FLASH_ACR_LATENCY_5WS;
RCC->CFGR2 |= RCC_CFGR2_HPRE | RCC_CFGR2_PPRE1 | RCC_CFGR2_PPRE2; //_DIV1;
(RCC_PLL1CFGR_PLL1SRC_HSE);
RCC->PLL1CFGR |= RCC_PLL1CFGR_PLL1SRC; //_HSE;
RCC->CR |= RCC_CR_PLL1ON;
while (!(RCC->CR & RCC_CR_PLL1RDY));
RCC->CFGR1 |= RCC_CFGR1_SWS;
while ((RCC->CFGR1 & RCC_CFGR1_SW));
}
static void GPIOConfig (void)
{
RCC->AHB2ENR |= (1<<6);
GPIOG->PUPDR &= ~(1<<9);
GPIOG->MODER &= ~((1<<8) | (1<<9));
GPIOG->MODER |= (1<<8);
GPIOG->OTYPER &= ~(1<<4);
GPIOG->OSPEEDR &= ~((1<<8) | (1<<9));
}
int main(void)
{
SysClockConfig ();
GPIOConfig();
GPIOG -> BRR = 1<<4;
GPIOG -> BSRR = 1<<4;
while (1)
{
}
}
For those wandering I am using μVision5 is because I want to be able to configure the MCU with registers alone for future projects.
For this application I managed to make it compile where I had to change these configurations
After compiling I tried flashing the memory and as far I understand it was successful.
So I can't figure out why the LED is not switching on, when I used similar code in the STM32CubeIDE it worked.
That's what I see on the debugging end: