Tool/software: Code Composer Studio
I am using pdk_am335x_1_0_14 .
I tried ti\pdk_am335x_1_0_14\packages\ti\drv\gpio\test\led_blink test program.And I can't get the LED blink with callback as expected.
Here is my (a little changed) code.
int main()
{
Board_initGPIO();
uint32_t testOutput = 1;
/* GPIO initialization */
GPIO_init();
//It is just what it looks like after #ifdef works .
/* Set the callback function */
GPIO_setCallback(GNSS_EXINT, AppGpioCallbackFxn);
//I tried to add some printd message in AppGpioCallbackFxn() , and find it never got callbacked.
/* Enable GPIO interrupt on the specific gpio pin */
GPIO_enableInt(GNSS_EXINT);
/* Write high to gpio pin to control LED1 */
GPIO_write((SYS_STATUS_LED), GPIO_PIN_VAL_HIGH);
AppDelay(DELAY_VALUE);
GPIO_log("\n GPIO Led Blink Application \n");
while(1)
{
gpioBaseAddr = GPIO_GROUP3_BASE_ADDR;
gpioPin = GPIO_GNSS_EXINT_PIN_NUM;
//defined in former head files
/* Trigger interrupt */
GPIOTriggerPinInt(gpioBaseAddr, 0, gpioPin);
//In this line of code I am supposed to see LED lit and extinguished ,right?
//But It just kept on ,as I wrote a HIGH to this pin some lines before.
AppDelay(DELAY_VALUE);
if (testOutput)
{
GPIO_log("\n All tests have passed \n");
testOutput = 0;
}
}
}
I searched in e2e forum and found this. But I don't know if I met the same error with him.
e2e.ti.com/.../568038
I think I used this api wrongly, but can't tell where are the error.
void GPIOTriggerPinInt(uint32_t baseAdd,
uint32_t intLine,
uint32_t pinNumber)
{
if (GPIO_INT_LINE_1 == intLine)
{
HW_WR_REG32(baseAdd + GPIO_IRQSTATUS_RAW_0, (uint32_t) 1 << pinNumber);
}
else
{
HW_WR_REG32(baseAdd + GPIO_IRQSTATUS_RAW_1, (uint32_t) 1 << pinNumber);
}
}