2020-12-13 09:01 PM
I wanted to toggle an LED in STM32 , there's this GPIOx_BSRR ,The boundry address for the GPIOC is 0x4001 1000 and the register (GPIOx_BSRR) is on the offset 0x10,I wanted to toggle the led_13 using bitbanding but Im not getting to the alias address
0x4200 0000 + (0x40011010-0x40000000)*0x20 + (13)*4 = 0x42220252
this isnt giving the right address to me ? can someone tell me why its wrong ?? thanks
2020-12-13 10:11 PM
How can anything that's a multiple of 4 have a least significant digit of 2??
Take 0x11010 multiply that by 32, add 13*4 and add 0x42000000
2020-12-13 11:21 PM
+1 to what Clive said above.
Here is a calculator you can check your results against.
But, regardless, don't use bitbanding for GPIO_BSRR. Write directly into it.
JW