cancel
Showing results for 
Search instead for 
Did you mean: 

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

sugarkoatedlies
Associate

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;

};

2 REPLIES 2

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
Up vote any posts that you find helpful, it shows what's working..
sugarkoatedlies
Associate

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