Reply by andr...@gmail.com July 8, 20102010-07-08
Richard,

Thank you for your answer. I finally found the problem (btw its the OMAP-L137 SoC with C6747): I was confused by the user manual stating the the pin number to be used in code should be the one from the manual -1, but it's not:
GPIO2_13_PIN = 46
has solved the problem!

Andreas
Hi.
>
>I'm trying getting to run an interrupt on falling edge from GPIO using the OMAP-L137 EVM and PSP drivers 1.20.
>
>I use the GPIO2[13] (on ASFX0). I get a successfully created GPIO handle, but the interrupt is never triggered.
>
>I've checked the input signal on the scope, it's like follows: it's periodic and 3.3V (though quite noisy, noise between 2.9V and 3.6V) during ~16 ms and then goes to 0V for about 0.1 ms. I hope GPIO can handle this kind of signal?
>
>So, and that's what I do on the DSP side:
>
>- I use SPI1and USB as additionnal peripherals (SPI for input, USB for output), I hope this is not any problem?
>
>- the important part in the .tcf is:
>
>bios.HWI.instance("HWI_INT7").interruptSelectNumber = 0;
>bios.HWI.instance("HWI_INT8").interruptSelectNumber = 1;
>bios.HWI.instance("HWI_INT9").interruptSelectNumber = 2;
>bios.HWI.instance("HWI_INT10").interruptSelectNumber = 3;
>bios.HWI.instance("HWI_INT11").interruptSelectNumber = 11;
>bios.HWI.instance("HWI_INT12").interruptSelectNumber = 12;
>
>(this is from the USB HID keyboard example, but I've seen that it covers the same interrupt select numbers like in the GPIO examples)
>
>- further, in my main task (not the main function), I have the following:
>
>// setup PINMUX + power
> Setup_System_Config();
> Setup_Psc_All_On();
>Psc_ModuleClkCtrl(Psc_DevId_1, GPIO_LPSC_NUM, TRUE);
>
>Setup_System_Config() sets the PINMUX:
>
>#define PINMUX0_VALUE 0x11112188
>#define PINMUX1_VALUE 0x11111111
>#define PINMUX2_VALUE 0x11111111
>#define PINMUX3_VALUE 0x11111111
>#define PINMUX4_VALUE 0x11111111
>#define PINMUX5_VALUE 0x11111111
>#define PINMUX6_VALUE 0x11111111
>#define PINMUX7_VALUE 0x11111111
>#define PINMUX8_VALUE 0x10022111
>#define PINMUX9_VALUE 0x00080001
>#define PINMUX10_VALUE 0x00000000
>#define PINMUX11_VALUE 0x00000000
>#define PINMUX12_VALUE 0x00000000
>#define PINMUX13_VALUE 0x00000000
>#define PINMUX14_VALUE 0x00000000
>#define PINMUX15_VALUE 0x00000000
>#define PINMUX16_VALUE 0x00000000
>#define PINMUX17_VALUE 0x00000000
>#define PINMUX18_VALUE 0x00000000
>#define PINMUX19_VALUE 0x00000000
>
>- Setup_Psc_All_On is a copy from http://processors.wiki.ti.com/index.php/Flashing_the_C6747_EVM
>
>- GPIO_LPSC_NUM = 3
>
>- GPIO initialization and configuration follows Psc_ModuleClkCtrl like follows:
>
>gpioParams = Gpio_PARAMS;
>// update the gpio parameters to our needs
>gpioParams.instNum = 0;
>gpioParams.BankParams[2].inUse = Gpio_InUse_No;
>gpioParams.BankParams[2].hwiNum = 8;
>// It is to be noted here that the pin numbers in GPIO peripheral user guide
>// starts from 1 and end at N. However the GPIO params uses arrays to maintain
>// the pin and bank configuration info. Hence, respective position for this
>// pin in the array will be (pinNumber-1).
>gpioParams.BankParams[2].PinConfInfo[13].inUse = Gpio_InUse_No;
>// open the GPIO driver to get a handle to it
>gpio0 = Gpio_open(&gpioParams);
>// Configure GPIO2_13 as an output
>UserPinCmdArg.pin = GPIO2_13_PIN;
>UserPinCmdArg.value = Gpio_Direction_Input;
>Gpio_setPinDir(gpio0,&UserPinCmdArg);
>// Enable GPIO Bank interrupt for bank GPIO_BANK_2
>Gpio_bankInterruptEnable(gpio0,GPIO_BANK_2);
>// Configure GPIO(GPIO0_8_PIN) to generate interrupt on falling edge
>Gpio_setFallingEdgeTrigger(gpio0,GPIO2_13_PIN);
>// Set the interrupt handler for GPIO0_8_PIN. However we cannot register
>// interrupts for individual pins in OMAPL137, therefore register interrupt
>// for the associated bank(BANK0) as a whole
>UserIntrCmdArg.value = GPIO_BANK_2;
>UserIntrCmdArg.bankOrPin = Gpio_BankOrPin_isBank;
>UserIntrCmdArg.isrHandler = (Gpio_Isr)&gpio_input_isr;
>Gpio_regIntHandler(gpio0,&UserIntrCmdArg);
>
>where
>
>GPIO_BANK_2 = 2 and
>
>GPIO2_13_PIN = 45
>
>- finally the interrupt function simply sets a flag:
>
>extern Bool vsync;
>Void gpio_input_isr(Ptr ignore)
>{
> ignore = ignore;
> vsync = TRUE;
>}
>
>So I'm not pretty sure what is causing the problem? Some missing or wrong configuration? or is the input signal that has bad characteristics? Could somebody help me getting this to work? Thank you very much.
>
>Andreas
>
>_____________________________________

_____________________________________
Reply by Richard Williams July 6, 20102010-07-06
andreas,

Somehow, I missed which DSP this code is targeted toward.

Anyway,

I think the NMI interrupt needs to be enabled.
I think the Global interrupt needs to be enabled.

It looks to me that you are using the BIOS.

In that case, all that setup work can be handled in the BIOS configuration file.

I also noted that one of your comments says to make a certain GPIO pin as an
output, but the code is making it an input.

Hope this helps.

R. Williams

---------- Original Message -----------
From: a...@gmail.com
To: c...
Sent: Tue, 06 Jul 2010 04:18:45 -0400
Subject: [c6x] No interrupt from GPIO

> Hi.
>
> I'm trying getting to run an interrupt on falling edge from GPIO using
> the OMAP-L137 EVM and PSP drivers 1.20.
>
> I use the GPIO2[13] (on ASFX0). I get a successfully created GPIO
> handle, but the interrupt is never triggered.
>
> I've checked the input signal on the scope, it's like follows: it's
> periodic and 3.3V (though quite noisy, noise between 2.9V and 3.6V)
> during ~16 ms and then goes to 0V for about 0.1 ms. I hope GPIO can
> handle this kind of signal?
>
> So, and that's what I do on the DSP side:
>
> - I use SPI1and USB as additionnal peripherals (SPI for input, USB for
> output), I hope this is not any problem?
>
> - the important part in the .tcf is:
>
> bios.HWI.instance("HWI_INT7").interruptSelectNumber = 0;
> bios.HWI.instance("HWI_INT8").interruptSelectNumber = 1;
> bios.HWI.instance("HWI_INT9").interruptSelectNumber = 2;
> bios.HWI.instance("HWI_INT10").interruptSelectNumber = 3;
> bios.HWI.instance("HWI_INT11").interruptSelectNumber = 11;
> bios.HWI.instance("HWI_INT12").interruptSelectNumber = 12;
>
> (this is from the USB HID keyboard example, but I've seen that it
> covers the same interrupt select numbers like in the GPIO examples)
>
> - further, in my main task (not the main function), I have the following:
>
> // setup PINMUX + power
> Setup_System_Config();
> Setup_Psc_All_On();
> Psc_ModuleClkCtrl(Psc_DevId_1, GPIO_LPSC_NUM, TRUE);
>
> Setup_System_Config() sets the PINMUX:
>
> #define PINMUX0_VALUE 0x11112188
> #define PINMUX1_VALUE 0x11111111
> #define PINMUX2_VALUE 0x11111111
> #define PINMUX3_VALUE 0x11111111
> #define PINMUX4_VALUE 0x11111111
> #define PINMUX5_VALUE 0x11111111
> #define PINMUX6_VALUE 0x11111111
> #define PINMUX7_VALUE 0x11111111
> #define PINMUX8_VALUE 0x10022111
> #define PINMUX9_VALUE 0x00080001
> #define PINMUX10_VALUE 0x00000000
> #define PINMUX11_VALUE 0x00000000
> #define PINMUX12_VALUE 0x00000000
> #define PINMUX13_VALUE 0x00000000
> #define PINMUX14_VALUE 0x00000000
> #define PINMUX15_VALUE 0x00000000
> #define PINMUX16_VALUE 0x00000000
> #define PINMUX17_VALUE 0x00000000
> #define PINMUX18_VALUE 0x00000000
> #define PINMUX19_VALUE 0x00000000
>
> - Setup_Psc_All_On is a copy from
http://processors.wiki.ti.com/index.php/Flashing_the_C6747_EVM
>
> - GPIO_LPSC_NUM = 3
>
> - GPIO initialization and configuration follows Psc_ModuleClkCtrl like
> follows:
>
> gpioParams = Gpio_PARAMS;
> // update the gpio parameters to our needs
> gpioParams.instNum = 0;
> gpioParams.BankParams[2].inUse = Gpio_InUse_No;
> gpioParams.BankParams[2].hwiNum = 8;
> // It is to be noted here that the pin numbers in GPIO peripheral user
> guide // starts from 1 and end at N. However the GPIO params uses
> arrays to maintain // the pin and bank configuration info. Hence,
> respective position for this // pin in the array will be (pinNumber-1)
> . gpioParams.BankParams[2].PinConfInfo[13].inUse = Gpio_InUse_No; //
> open the GPIO driver to get a handle to it gpio0 > Gpio_open(&gpioParams); // Configure GPIO2_13 as an output
> UserPinCmdArg.pin = GPIO2_13_PIN; UserPinCmdArg.value = Gpio_Direction_Input;
> Gpio_setPinDir(gpio0,&UserPinCmdArg);
> // Enable GPIO Bank interrupt for bank GPIO_BANK_2
> Gpio_bankInterruptEnable(gpio0,GPIO_BANK_2);
> // Configure GPIO(GPIO0_8_PIN) to generate interrupt on falling edge
> Gpio_setFallingEdgeTrigger(gpio0,GPIO2_13_PIN);
> // Set the interrupt handler for GPIO0_8_PIN. However we cannot
> register // interrupts for individual pins in OMAPL137, therefore
> register interrupt // for the associated bank(BANK0) as a whole
> UserIntrCmdArg.value = GPIO_BANK_2; UserIntrCmdArg.bankOrPin Gpio_BankOrPin_isBank;
> UserIntrCmdArg.isrHandler = (Gpio_Isr)&gpio_input_isr;
> Gpio_regIntHandler(gpio0,&UserIntrCmdArg);
>
> where
>
> GPIO_BANK_2 = 2 and
>
> GPIO2_13_PIN = 45
>
> - finally the interrupt function simply sets a flag:
>
> extern Bool vsync;
> Void gpio_input_isr(Ptr ignore)
> {
> ignore = ignore;
> vsync = TRUE;
> }
>
> So I'm not pretty sure what is causing the problem? Some missing or
> wrong configuration? or is the input signal that has bad
> characteristics? Could somebody help me getting this to work? Thank
> you very much.
>
> Andreas
------- End of Original Message -------

_____________________________________
Reply by andr...@gmail.com July 6, 20102010-07-06
Hi.

I'm trying getting to run an interrupt on falling edge from GPIO using the OMAP-L137 EVM and PSP drivers 1.20.

I use the GPIO2[13] (on ASFX0). I get a successfully created GPIO handle, but the interrupt is never triggered.

I've checked the input signal on the scope, it's like follows: it's periodic and 3.3V (though quite noisy, noise between 2.9V and 3.6V) during ~16 ms and then goes to 0V for about 0.1 ms. I hope GPIO can handle this kind of signal?

So, and that's what I do on the DSP side:

- I use SPI1and USB as additionnal peripherals (SPI for input, USB for output), I hope this is not any problem?

- the important part in the .tcf is:

bios.HWI.instance("HWI_INT7").interruptSelectNumber = 0;
bios.HWI.instance("HWI_INT8").interruptSelectNumber = 1;
bios.HWI.instance("HWI_INT9").interruptSelectNumber = 2;
bios.HWI.instance("HWI_INT10").interruptSelectNumber = 3;
bios.HWI.instance("HWI_INT11").interruptSelectNumber = 11;
bios.HWI.instance("HWI_INT12").interruptSelectNumber = 12;

(this is from the USB HID keyboard example, but I've seen that it covers the same interrupt select numbers like in the GPIO examples)

- further, in my main task (not the main function), I have the following:

// setup PINMUX + power
Setup_System_Config();
Setup_Psc_All_On();
Psc_ModuleClkCtrl(Psc_DevId_1, GPIO_LPSC_NUM, TRUE);

Setup_System_Config() sets the PINMUX:

#define PINMUX0_VALUE 0x11112188
#define PINMUX1_VALUE 0x11111111
#define PINMUX2_VALUE 0x11111111
#define PINMUX3_VALUE 0x11111111
#define PINMUX4_VALUE 0x11111111
#define PINMUX5_VALUE 0x11111111
#define PINMUX6_VALUE 0x11111111
#define PINMUX7_VALUE 0x11111111
#define PINMUX8_VALUE 0x10022111
#define PINMUX9_VALUE 0x00080001
#define PINMUX10_VALUE 0x00000000
#define PINMUX11_VALUE 0x00000000
#define PINMUX12_VALUE 0x00000000
#define PINMUX13_VALUE 0x00000000
#define PINMUX14_VALUE 0x00000000
#define PINMUX15_VALUE 0x00000000
#define PINMUX16_VALUE 0x00000000
#define PINMUX17_VALUE 0x00000000
#define PINMUX18_VALUE 0x00000000
#define PINMUX19_VALUE 0x00000000

- Setup_Psc_All_On is a copy from http://processors.wiki.ti.com/index.php/Flashing_the_C6747_EVM

- GPIO_LPSC_NUM = 3

- GPIO initialization and configuration follows Psc_ModuleClkCtrl like follows:

gpioParams = Gpio_PARAMS;
// update the gpio parameters to our needs
gpioParams.instNum = 0;
gpioParams.BankParams[2].inUse = Gpio_InUse_No;
gpioParams.BankParams[2].hwiNum = 8;
// It is to be noted here that the pin numbers in GPIO peripheral user guide
// starts from 1 and end at N. However the GPIO params uses arrays to maintain
// the pin and bank configuration info. Hence, respective position for this
// pin in the array will be (pinNumber-1).
gpioParams.BankParams[2].PinConfInfo[13].inUse = Gpio_InUse_No;
// open the GPIO driver to get a handle to it
gpio0 = Gpio_open(&gpioParams);
// Configure GPIO2_13 as an output
UserPinCmdArg.pin = GPIO2_13_PIN;
UserPinCmdArg.value = Gpio_Direction_Input;
Gpio_setPinDir(gpio0,&UserPinCmdArg);
// Enable GPIO Bank interrupt for bank GPIO_BANK_2
Gpio_bankInterruptEnable(gpio0,GPIO_BANK_2);
// Configure GPIO(GPIO0_8_PIN) to generate interrupt on falling edge
Gpio_setFallingEdgeTrigger(gpio0,GPIO2_13_PIN);
// Set the interrupt handler for GPIO0_8_PIN. However we cannot register
// interrupts for individual pins in OMAPL137, therefore register interrupt
// for the associated bank(BANK0) as a whole
UserIntrCmdArg.value = GPIO_BANK_2;
UserIntrCmdArg.bankOrPin = Gpio_BankOrPin_isBank;
UserIntrCmdArg.isrHandler = (Gpio_Isr)&gpio_input_isr;
Gpio_regIntHandler(gpio0,&UserIntrCmdArg);

where

GPIO_BANK_2 = 2 and

GPIO2_13_PIN = 45

- finally the interrupt function simply sets a flag:

extern Bool vsync;
Void gpio_input_isr(Ptr ignore)
{
ignore = ignore;
vsync = TRUE;
}

So I'm not pretty sure what is causing the problem? Some missing or wrong configuration? or is the input signal that has bad characteristics? Could somebody help me getting this to work? Thank you very much.

Andreas

_____________________________________