Home arrow Support arrow Forums

Luminary Micro Forums

johanfr

Fresh Boarder
Click here to see the profile of this user

2008/09/26 10:02

Using DriverLib for GPIO on PORTE

Hi!

I'm trying to get PORTE GPIO2 to simply blink! It works fine if I use PORTF GPIO0 but changing on PORTE it fails. Am I missing something or just done something stupid. The pin simply drives a LED connected to 3.3V for testing.

Used the code for LM3S8962 eval board as base for my LM3S8938 used for testing.

Code looks like the following:

Code:

  SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); GPIOPinTypeGPIOOutput(GPIO_PORTE_BASEGPIO_PIN_2); GPIOPadConfigSet(GPIO_PORTE_BASE,                  GPIO_PIN_2,                   GPIO_STRENGTH_2MA,                   GPIO_PIN_TYPE_STD_WPU); GPIOPinWrite(GPIO_PORTE_BASEGPIO_PIN_21); while(1)     {       GPIOPinWrite(GPIO_PORTE_BASEGPIO_PIN_20);        Delay(1000);             GPIOPinWrite(GPIO_PORTE_BASEGPIO_PIN_21);        Delay(1000);           }



Most grateful for any help!

Cheers,
Johan

login or register to reply

LMI Brian

Admin
Click here to see the profile of this user

2008/09/26 10:25

Re:Using DriverLib for GPIO on PORTE

The second call to GPIOPinWrite should be:

Code:

 GPIOPinWrite(GPIO_PORTE_BASEGPIO_PIN_2GPIO_PIN_2);



The data argument to GPIOPinWrite is the bit value in the proper bit position. When you passed 1, the bit in the pin 2 bit position is zero, so the pin is never asserted.

This may seem a bit confusing, but becomes quite useful if you say something like:

Code:

 GPIOPinWrite(GPIO_PORTE_BASEGPIO_PIN_0 GPIO_PIN_1GPIO_PIN_1);



In this case, PE0 is turned off and PE1 is turned on "simultaneously" (subject to propagation delay), as opposed to hundreds of nanoseconds between the two if they were changed in separate calls.

--Brian

login or register to reply