STM32G431rbt6 firmware isn't working after reset
I've designed a board with stm32G431 MCU (i will include schematic if necessary) and now trying to test how it works. I am using CMSIS for programming and wrote the most simple blink program (LEDs are on PB3-6):
#include "stm32g431xx.h"
void delay(uint32_t time);
uint32_t someVar = 0;
int main(void)
{
RCC->AHB2ENR |= RCC_AHB2ENR_GPIOBEN;
GPIOB->MODER &= ~0x00003FC0;
GPIOB->MODER |= 0x0001540;
GPIOB->ODR |= 0x0078;
while ( 1 )
{
delay(300000);
GPIOB->ODR ^= 0x0078;
someVar += 1;
}
}
void delay(uint32_t time)
{
for ( uint32_t i = 0; i < time; ++i );
}And when I debug it. It works just fine, but after I hit reset it doesn't work anymore. I checked with st-link utility. The program is still in flash. Can anyone explain what is going on and how to fix it?
