STM32G0 - G0B1RE GPIO MOD REGISTER not enabled
Hi, I use STM32Cube IDE, and use STM32G0 - G0B1RE device. I try to enable the mod register to blink the LED here is the code that i try so far, based on the Reference Manual (rm0444), I need to enable RCC_IOPENR before modify the GPIOx_MODER. But unfortunately it still did not work.
When i try in debugging mode via the SFRs by set the value of RCC_IOPENR, GPIOA MODER (MODER5), OTYPER (OT5), PUPDR PUPDR(5), and BSRR the LED was turned on.
The LED is at GPIOA (PA5) based on the schematic.
Did i missed something? or there is anything to enable before I modifie the GPIOx_MODER?
In the reference manual to enable to peripheral in STMG0-G0B1RE the GPIO Bus is IOPORT not AHB or APB





#include "main.h"
#include "stdint.h"
int main(void)
{
uint32_t *ptr;
// RCC_IOPENR
ptr = (uint32_t *)(0x40021000 + 0x34);
*ptr |= (0x1 << 0); //set bit position 0 to value 1 (0x1) for GPIOA
// GPIO MOD Register GPIOA
// [ISSUE] THE MOD REGISTER VALUE DID NOT CHANGE
ptr = (uint32_t *)0x50000000;
*ptr |= (0x1 << 10);
//OTYPE
ptr++;
*ptr &= ~(uint32_t)(0x1 << 5); //output type
//PUPDR
ptr++;
*ptr |= (uint32_t)(0x2 << 10); //pull down
ptr++;
*ptr |= (0x1 << 5);//turn on led
*ptr |= (0x1 << 21);// turn off led
}
