2023-12-15 06:32 AM - last edited on 2023-12-20 04:46 AM by Amel NASRI
Hi, i came across a program to config alternation function for SPI GPIO port A.
GPIOA->CRL |= (11U<<20); // PA5 SCK AF output push pull
GPIOA->CRL |= (11U<<28); // PA7 MOSI AF output push pull
What does the 11U means? i know its something like setting the 20th bit to 11? is 11 the binary value for 3? how does the value 3 relates to PA5 SCK and 28 relates to PA7 MOSI ? Anyone can advise?
Solved! Go to Solution.
2023-12-18 06:01 AM
STM32F446RE
2023-12-18 06:03 AM
yes i agree, no GPIOx_CRL registers in RM0390.
2023-12-18 06:43 AM
Reset value, that is value after reset, of that register is 0x44444444; it means, CNF5=0b01, MODE5=0b00. If you OR that value with 0b1011, CNF5=0b01 OR 0b10 = 0b11; MODE5 = 0b11.
All this is relevant only for 'F1, i.e. irrelevant for 'F446; however, corollary remains, namely that you have to take into account the reset value of register when doing only ORs to set some of the bits.
JW