2009-12-27 07:04 AM
How to get GPIO pin status ?
2011-05-17 04:35 AM
Hello !
First of all i want to thank all who helped me to get started with STM32 :-] Now i want to write a program that reports gpio pin MODE and gpio pin SPEED of a certain GPIOx port via rs232 to my computer. Can some one please suggest me how do i get that GPIOx pin info ? Can i get that info from CRL/CRH ? How do i access to a specific port pins configuration ? Thanks :)2011-05-17 04:35 AM
Yes Right , you can get it from CRL/CRH registers.
Cheers.2011-05-17 04:35 AM
Hi bd678834;
of course you can get the GPIO info from CRL/CRH registers since they are ''rw'' (read/write) access. For the specific port configuration you can use the standard library or you can do it using the direct access to the registers: GPIOC->CRL = u32_Value; // to configure port C pins u32_Value = GPIOC->CRL; // to read the pins configuration of port C B.R. M3allem2011-05-17 04:35 AM
Hello bd678834,
why this? The pins have their default configuration (input hi-Z, except some pins like JTAG, all described in the datasheet), and you as a programmer are responsible for changing them. So reading CRL/CRH is good approach, but a little unnecessary (I guess) because you should already know the result :)