Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 236660

Forum Post: RE: TM4C129ENCPDT: How to distinguish pin mode between pin assigned to some hw blocks (like Ethernet LEDs) and regular GPIO pin?

$
0
0
Hi, I think I know the reason. It is a misinterpretation of the pin number to be passed to GPIODirModeGet(port, pin) . Refer to the user's guide. As you can see, for GPIODirModeGet, it is expecting a numerical pin number, not a bit-packed representation of the pins . Therefore, for PA1, you would need to input 0x1, not GPIO_PIN_1 because GPIO_PIN_1 is actually 0x00000002 as defined in gpio.h. When I input 0x1 for PA1, it works. GPIOPinConfigure(GPIO_PA1_U0TX); GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_1); tmp = GPIODirModeGet(GPIO_PORTA_BASE, 0x1 ); if (tmp != GPIO_DIR_MODE_HW) { while (1); } GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_1); tmp = GPIODirModeGet(GPIO_PORTA_BASE, 0x1 ); if (tmp != GPIO_DIR_MODE_OUT) { while (1); }

Viewing all articles
Browse latest Browse all 236660

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>