Where did the BRR go?

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
rew
Posts: 383
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 14 times

Where did the BRR go?

Post by rew »

I have an application where in an interrupt I need to set and reset GPIOs quickly. When I want to reset bits, I used the BRR (Bit Reset Register).

For example:

Code: Select all

GPIOF->BRR = 1;

Now I've upgraded Chibios and this code no longer compiles. The compiler suggests a different register in the GPIO struct, and searching for that I found the GPIO_TypeDef struct which included that register as well as the BRR on my processor (STM32F030C8T6).

Turns out that:

Code: Select all

#define mGPIOF ((GPIO_TypeDef *)GPIOF)
   mGPIOF->BRR = 1;
Does work.

Why was "normal" access to GPIOF->BRR removed?????
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Where did the BRR go?

Post by Giovanni »

Hi,

The PAL driver uses a different GPIO structure, you need to use the new one. Note that if you use the PAL port/pad functions then you are manipulating the BRR registers with no extra code, it is all inlined, there is no really need to manipulate the register directly.

Giovanni
rew
Posts: 383
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 14 times

Re: Where did the BRR go?

Post by rew »

OK. So in advance, I've prepared the 32-bit word that sets and clears the right bits of that GPIO port when written to the BSRR (A total of precisely 8 bits need to be set and/or reset, the other 8 need to be left alone). Which function helps me do that?

In the documentation I find:

Code: Select all

#define palSetPort   (port,bits )   palWritePort(port, palReadLatch(port) | (bits))
I would say that this will never be able to be merged with a following ClearPort as the "volatile" on the ODR register declaration now requires at least a clock between the the set and clr operations.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Where did the BRR go?

Post by Giovanni »

You are right, set and clear at same time is not part of the API.

giovanni
Post Reply