Skip to main content
sugarkoatedlies
Associate
October 22, 2019
Question

I am trying to turn on the user leds on the stm32wb55 nucleo board. What am I doing wrong?

  • October 22, 2019
  • 2 replies
  • 855 views

step 1: initialize clock

step 2: set pins to output

step 3: set corresponding 'set' bits to 1 in BSRR register

int main(){

    

//enable clock for necessary ports

//clock for leds: port port B, pins 0, 1, 5

RCC->AHB2ENR |= RCC_AHB2ENR_GPIOBEN;

//RCC->AHB2ENR |= RCC_AHB2ENR_GPIOCEN;

//decide which pin in input or output

GPIOB->MODER |= GPIO_MODER_MODE0_0;

GPIOB->MODER |= GPIO_MODER_MODE1_0;

GPIOB->MODER |= GPIO_MODER_MODE5_0;

GPIOB->BSRR |= GPIO_BSRR_BS0;

GPIOB->BSRR |= GPIO_BSRR_BS1;

GPIOB->BSRR |= GPIO_BSRR_BS5;

};

This topic has been closed for replies.

2 replies

Tesla DeLorean
Guru
October 22, 2019

Perhaps you could use a debugger, and inspect the registers?

You only need to write BSRR, no need to RMW

If you want to use RMW access ODR

Avoid exiting main()

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
sugarkoatedlies
Associate
October 24, 2019

What do you mean RMW? Are you saying I dont have to enable the clocks for gpio B?