Issues with the GPIO BSRR/BRR Registers in Simulation Environment
I've been having trouble with the GPIO BSRR/BRR registers for the part i'm emulating in Keil, as the setting of bits in these registers aren't having any affect on the ODR register.
I've been trying to just have a loop toggle the state of a pin, which should be writing to BSRR/BRR registers for that port to set and reset that pin respectively.
However, when monitoring the state of the ODR bit for this pin, it isn't being toggled.
Code Snippet as follows:
while (1)
{
HAL_GPIO_TogglePin(RST_OUT_N_GPIO_Port, RST_OUT_N_Pin);
}
// And the HAL function call:
void HAL_GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
{
/* Check the parameters */
assert_param(IS_GPIO_PIN(GPIO_Pin));
if ((GPIOx->ODR & GPIO_Pin) != 0x00u)
{
GPIOx->BRR = (uint32_t)GPIO_Pin;
}
else
{
GPIOx->BSRR = (uint32_t)GPIO_Pin;
}
}
-------------------------------------------------------------------------
It's only when I manually toggle the ODR bit directly, that I see the change:
RST_OUT_N_GPIO_Port->ODR ^= RST_OUT_N_Pin;
Design baseline generated in CubeMx. More details about my setup are below:
Part: STM32G030K6
IDE: Keil MDK-ARM v5
Keil Support Package: Keil::STM32G0xx_DFP v1.20
CubeMX FW Package: STM32Cube FW_G0 V1.3.0
Note: Compiler optimization has been set to Level 0(-O0)
I'm thinking this is just something weird with the simulation environment, as this function call is working when hooked up to a Nucleo dev board for the STM32G071.
Any input or suggestions would be greatly appreciated! Let me know if I can provide more info
Thanks,
David
