cancel
Showing results for 
Search instead for 
Did you mean: 

BRR register does not work for STM32L100RC and STM32L152RC boards

upratat hlavu
Associate
Posted on December 04, 2017 at 22:58

RM0038 Reference manual states on page 188 that GPIOx_BRR register is available for Cat. 3 product - which includes both stm32l100rc and stm32l152rc (page 40 of Reference manual).

But code below works when used BSRR and does not when used BRR register on stm32l152rc (similarly for stm32l100rc when port changed to GPIOC and pins to 8 and 9).

#include 'stm32l1xx.h'

void delay(uint32_t del);

#define DELAY_VAL 100000

int main(void){

RCC->AHBENR |= RCC_AHBENR_GPIOBEN;

GPIOB->MODER = GPIO_MODER_MODER6_0 | GPIO_MODER_MODER7_0;

GPIOB->OSPEEDR = GPIO_OSPEEDER_OSPEEDR6_Msk | GPIO_OSPEEDER_OSPEEDR7_Msk;

  while (1){

    //GPIOB->BSRR = (GPIO_BRR_BR_6 | GPIO_BRR_BR_7) << 16;

   GPIOB->BRR = GPIO_BRR_BR_6 | GPIO_BRR_BR_7;

    delay(DELAY_VAL);

    GPIOB->BSRR = GPIO_BSRR_BS_6;

    delay(DELAY_VAL);

    GPIOB->BSRR = GPIO_BSRR_BS_7;

    delay(DELAY_VAL);

  }

}

void delay(uint32_t del){

    uint32_t i;

    for(i=0;i<del;i++){};

}

Am I doing something wrong? Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Imen.D
ST Employee
Posted on December 18, 2017 at 18:32

Hello

upratathlavu

,

You are right about this confusion.

The request is raised internally to correct the reference manual and update thechapter: '7.4.11 GPIO bit reset register (GPIOx_BRR) (x = A..H)' to remove 'Cat.3' from description.

So final sentence shouldbe:These registers are available on Cat.4, Cat.5 and Cat.6 products only.

Our team is aware about this error and should fix this in the coming release of reference manual.

Thank you for your contribution.

Best Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

View solution in original post

1 REPLY 1
Imen.D
ST Employee
Posted on December 18, 2017 at 18:32

Hello

upratathlavu

,

You are right about this confusion.

The request is raised internally to correct the reference manual and update thechapter: '7.4.11 GPIO bit reset register (GPIOx_BRR) (x = A..H)' to remove 'Cat.3' from description.

So final sentence shouldbe:These registers are available on Cat.4, Cat.5 and Cat.6 products only.

Our team is aware about this error and should fix this in the coming release of reference manual.

Thank you for your contribution.

Best Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen