AnsweredAssumed Answered

BRR register does not work for STM32L100RC and STM32L152RC boards

Question asked by upratat hlavu on Dec 4, 2017
Latest reply on Dec 18, 2017 by Imen D

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.

Outcomes