cancel
Showing results for 
Search instead for 
Did you mean: 

Issues with the GPIO BSRR/BRR Registers in Simulation Environment

DMcla.6
Associate

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

1 ACCEPTED SOLUTION

Accepted Solutions

Keil gave up supporting the Simulator/Emulator several years ago, lot of non-paying customers were using it, and real hardware is now cheap and prolific.

Unless the Keil landing page for the STM32G071 explicitly says simulation is supported, it probably isn't

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

2 REPLIES 2

Keil gave up supporting the Simulator/Emulator several years ago, lot of non-paying customers were using it, and real hardware is now cheap and prolific.

Unless the Keil landing page for the STM32G071 explicitly says simulation is supported, it probably isn't

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
DMcla.6
Associate

Thanks for your reply

Though I haven't been able to find any statement by Keil of a discontinuation of Simulator support for newer devices, it DOES seem like this support is currently unavailable for the part that I'm using, which is unfortunate.

For those who are having similar troubles in the simulation environment, the following should be supplemental to this discussion:

http://www.keil.com/support/docs/1211.htm

http://www.keil.com/dd2/

Thanks again for the help

-David