Hello,
I am using the gpioExample that comes with the Evaluation Module. I'm trying to configure other ports as outputs and set them to 1 but I don't know why it doesn't works.
Correct me if I am wrong or I forgot something:
#include <stdio.h>
#include <string.h>
#include <std.h>
#include <log.h>
#include <tsk.h>
#include <idl.h>
#include <ecm.h>
#include <iom.h>
#include <sio.h>
#include <ti/pspiom/gpio/Gpio.h>
Gpio_Handle gpio0;
#define LOW 0x0
#define HIGH 0x1
#define GPIO0_12_PIN 13
#define GPIO0_13_PIN 14
void main (void)
{
Gpio_Params gpioParams = Gpio_PARAMS;
Gpio_PinCmdArg UserPinCmdArg;
gpioParams.instNum = 0;
gpioParams.BankParams[0].inUse = Gpio_InUse_No;
gpioParams.BankParams[0].PinConfInfo[12].inUse = Gpio_InUse_No;
gpioParams.BankParams[0].PinConfInfo[13].inUse = Gpio_InUse_No;
/* open the GPIO driver to get a handle to it */
gpio0 = Gpio_open(&gpioParams);
/* make sure our driver instance is ok */
if (NULL == gpio0)
{
SYS_abort("Gpio_open() failed to create Gpio driver instance!\n");
}
/* Call the EVM specific initialization function */
configureGpio();
/* Configure GPIO0_12 as an output */
UserPinCmdArg.pin = GPIO0_12_PIN;
UserPinCmdArg.value = Gpio_Direction_Output;
Gpio_setPinDir(gpio0,&UserPinCmdArg);
/* Configure GPIO0_13 as an output */
UserPinCmdArg.pin = GPIO0_13_PIN;
UserPinCmdArg.value = Gpio_Direction_Output;
Gpio_setPinDir(gpio0,&UserPinCmdArg);
// Set Data ow in SET_DATA register for GPIO(GPIO0_12_PIN).
// This turns the LED on
UserPinCmdArg.pin = GPIO0_12_PIN;
UserPinCmdArg.value = LOW;
Gpio_setPinVal(gpio0,&UserPinCmdArg);
// Set Data low in SET_DATA register for GPIO(GPIO0_13_PIN)
// This turns the LED on
UserPinCmdArg.pin = GPIO0_13_PIN;
UserPinCmdArg.value = LOW;
Gpio_setPinVal(gpio0,&UserPinCmdArg);
return;
}
This program only turn on USER_LED_1 wich is connected to GPIO0_12_PIN but not USER_LED_2 connected to GPIO0_13_PIN. What I am forgetting?
Thank you!