cancel
Showing results for 
Search instead for 
Did you mean: 

Confused about GPIOA->CRL

SS.Sagar
Associate III
Posted on January 16, 2016 at 14:19

hello I am using STM32Nuleo103 and keil compiler.

I was configuring GPIOA->CRL register. I found following

GPIOA->CRL = oxooooooo8; //works

GPIOA->CRL |= oxooooooo8; //Not works

I am confused i am just doing ORing with the CRL register to avoid modifying other pins configuration. But i tried to do so, i found second assignment doesn't work but first work.

How to avoid this?
1 REPLY 1
Posted on January 16, 2016 at 15:06

What does ''not work'' actually mean in this context? That it doesn't set bit 3 ?

There are TWO bits per GPIO in the register, you'd want to make sure both bits get where you want.

If you want to write the bit pair 10 for PA1

GPIOA->CRL = (GPIOA->CRL & 0xFFFFFFF3) | 0x00000008;

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..