2022-05-20 06:09 PM
STM32F407VGT6
Why is access to the Microcontroller broken after this code?
The MODER register after this code should look like this: 00000000000000000000000000000011
this is Analog mode for pin 0 of port A.
int main(void)
{
RCC->AHB1ENR|=RCC_AHB1ENR_GPIOAEN;
GPIOA->MODER=0x3;
while (1)
{
}
}
Same but with port B or C does not throw an error
RCC->AHB1ENR|=RCC_AHB1ENR_GPIOBEN;
GPIOB->MODER=0x3;
-----------------------------
RCC->AHB1ENR|=RCC_AHB1ENR_GPIOCEN;
GPIOC->MODER=0x3;
----------------------------
Port A is compatible with Analog mode
A user button is connected to pin 0 of Port A, but it is not pressed, which means it does not interfere with the execution of the code.
Solved! Go to Solution.
2022-05-20 06:32 PM
You are disabling the SWD pins PA13 and PA14. Look at the GPIOx_MODER reset values at the reference manual.
2022-05-20 06:32 PM
You are disabling the SWD pins PA13 and PA14. Look at the GPIOx_MODER reset values at the reference manual.
2022-05-20 06:41 PM
Exactly)) Thanks.