Project

General

Profile

GPIO interrupt in MityOMAP-L138F

Added by Michele Canepa over 11 years ago

Hello all,
I need to hook a HWI to a GPIO pin in a DSP application.
I have some questions:

1- Do your core library provide any class to do that? I see DspFpgaGpio.h and Gpio.h, but they lack a bit of documentation, and I can't find a working example to follow.

2 - Could you please provide a sort of code snippet to instantiate an ISR triggered by a GPIO ? (the best would be using both an OMAP GPIO pin and a custom GPIO pin in a FPGA GPIO core..)

3- It is possible to trigger an SPI transfer in an HWI using your tcDspFpgaSpi::Transfer() method in an HWI context?

Hope I'm not asking too much, but I'm quite confused about that.

Thank you in advance,
Best Regards.

Michele Canepa


Replies (4)

RE: GPIO interrupt in MityOMAP-L138F - Added by Michael Williamson over 11 years ago

Are you trying to use a FPGA GPIO or an OMAP-L138 GPIO?

The DspGpio.h class should provide access to the OMAP-L138 GPIOs from the DSP. The DspFpgaGpio.h class should be used to access FPGA based GPIO modules. Both classes are derived from a basic interface class in Gpio.h.

If you want an ISR callback, you need to register for one with the base class SetISRCallback() interface when you instantiate either class.

I'm not sure we support running Transfer() from within an HWI as it uses BIOS routines for serialized access to the class. You would need to post a semaphore to a task() to initiate the transfer, or modify the provided DspFpgaSpi class to meet your application requirements.

I will try to post a snippet, but it may take a bit to get some time to do that.

-Mike

RE: GPIO interrupt in MityOMAP-L138F - Added by Michele Canepa over 11 years ago

Hi Mike,
thanks for fast reply!

The best would be an example using an fpga gpio pin and an omap pin, just to test the possibilities.

Does the .tcf configuration file has a role in configuring the interrupt based on an fpga gpio pin?
Best,
Michele

RE: GPIO interrupt in MityOMAP-L138F - Added by Michele Canepa over 11 years ago

Hi Mike,
I successfully implemented an interrupt example using FPGA Gpio core and your core libraries on DSP.
Maybe is useful to someone to say how, because the documentation is too generic about this topic:

1- Assuming you have a Gpio Core connected to the Interrupt Level n.1 (the DSP one), first call:

   tcDspInterruptDispatch::set_hw_interrupt_level(1,N_HWI);

N_HWI is the HWI line to which you will connect the interrupt event of the FPGA Interrupt Level choosed.
N_HWI should be a number beetween 6 and 15, because DSPLINK uses interrupt line number 4 and 5

2- Now instance a tcDspFpgaGpio object, call ConfigurePin method:

   tcDspFpgaGpio *MyGpio = new tcDspFpgaGpio((void*)GPIO_BASE_ADDRESS);
   MyGpio->ConfigurePin(mygpioBank,mygpioOffset,0,0,mygpioIntRising,mygpioIntFalling);

Of course they should be inputs, so third argument is 0.
Note that mygpioBank and mygpioOffset should reflect the configuration you choosen connecting the gpios to the GPIO Core.

For Offset: 0 is the LSB.
For Bank: 0 is the first Bank

3- Then call SetISRCallback method:

   MyGpio->SetISRCallback(mygpioBank,mygpioOffset,MyISR,NULL);

4- MyISR should be declared using this prototype:

   void MyISR(tcGpio *apThis, unsigned int Bank, unsigned int Offset, void *apUser);

I hope these hints could be useful to somebody.

Thanks,

Michele

RE: GPIO interrupt in MityOMAP-L138F - Added by Michael Williamson over 11 years ago

I am glad you were able to figure this out, and these notes are helpful. Thanks for posting them.

We have been struggling for the DSP to sort out an easier way to track and validate the IRQ routing for the DSP application. The DSPLINK levels quietly consume 4 and 5, and that has caused many folks grief in the past.

-Mike

    (1-4/4)
    Go to top
    Add picture from clipboard (Maximum size: 1 GB)