This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BIOS5 PSP GPIO Driver Confusion

Guru 15580 points
Other Parts Discussed in Thread: OMAP-L138, OMAPL138

I am trying to implement the PSP GPIO driver on my OMAP-L138 application using DSPBIOS. I am getting confused with the documentation and example code. Please explain the following:

1. The header file in gpioSample_main.c says :

This example demonstrates the use of GPIO driver/module. The sample does this by taking input on GPIO pin GPIO0_4(configured as input pin), via an MMCSD card inserted in the MMCSD slot.

You then define the following:

#define GPIO_BANK_0 0x00

#define GPIO_BANK_4                 4u

#define GPIO4_0_PIN                 65u

and then set the parameters in main

Void main (Void)

{

    Gpio_Params     gpioParams = Gpio_PARAMS;

    /* update the gpio parameters to our needs */

    gpioParams.instNum = 0;

    gpioParams.BankParams[GPIO_BANK_4].inUse = Gpio_InUse_No;

    gpioParams.BankParams[GPIO_BANK_4].hwiNum  = 8u;

    gpioParams.BankParams[GPIO_BANK_4].PinConfInfo[0].inUse = Gpio_InUse_No;

which appear to be using bank 4, pin zero, not bank zero pin 4 as the header says.

2. What does GPIO4_0_PIN define? It appears to be the EVT number for GPIO bank 4 (EVT 65, OMAP-L138 data sheet, page 104, table 6-8). What does this have to do with a pin number since EVTs are for the entire bank? 

3. Where can I find the documentation for the definition of the "Gpio_PinCmdArg". It does not appear in the PSP User Guide, and the only "definition" given in the doxygen document is :

Data Fields

Uint32  pin Uint32  value

.....what does "value" represent?

 

Thx,

MikeH

 

  • .....and....

    What does this mean?

    4.6 Gpio Bank Event Numbers

    The bank event numbers are configured for the Gpio banks on the EVM OMAPL138

    can be obtained from the SoC reference Guide. This table should be used when

    configuring the HWI interrupt select numbers and HWI number for a given bank that

    the user wishes to use.

    The HWI's are defined at HWI7 = 0, HWI8 = 1, HWI9 = 2, HWI10 = 3 in your example. If I want to use GP2[14], the bank2 EVT is 49. Where do I use EVT 49?

  • Folks, I'm dead in the water here.........can I get some help? Are you supporting PSP or should I move on to something else?

  • Mike,

    Unfortunately, the PSP experts are not in our time zone -- they are located in India.  I'll push them on them to look at your question first thing, but you will not likely get a response before tonight.

    Dave

  • Dave,

    Thanks for the update. Wow, so I get one interaction per work day. I don't think this is going to work out. Guess I'll just go back to doing it the hard way.

    MikeH

     

  • Hi Mike,

    First of all, we are sorry for misleading you because of a wrong comment made in the "Example Description".
    It should be -> This example demonstrates the use of GPIO driver/module. The sample does this by taking input on GPIO pin GPIO4_0(configured as input pin), via an MMCSD card inserted in the MMCSD slot.


    #define GPIO_BANK_0                 0x00 /* BANK 0 */

    #define GPIO_BANK_4                 4u     /* BANK 4 */

    #define GPIO4_0_PIN                  65u  /* This is the Pin Number for the 0th pin of GPIO bank 4 (Find details in http://www.ti.com/litv/pdf/sprufl8b Page65 )   */

    The GP4[0] is connected to 'SD_INS' pin.And, the 'SD_INS' is connected to 'CD' of the 'MMC'. Whenever, we insert/eject an MMC/SD card, the signal on the SD_INS line changes to low/high. If we have enabled interrupts to be generated on both edges of the GP4[0] pin's transition, then an interrupt is generated on both insertion(falling edge)and ejection(rising edge) of the MMC/SD card. (These details are obtained from the OMAPL138 schematics and unfortunately i donot have the links to it!). 

    Hence we program the GPIO4_0_PIN.

    Referring to the (omap-l138) Page33 shows: Table 3-1. DSP Interrupt Map


    Event    Interrupt Name    Source
    54         GPIO_B4INT         GPIO Bank 4 Interrupt


    To determine the hardware interrupt numbers for the gpio, following table needs to be considered

    The event number to HWI mapping should be as follows:
    HWI                                  event number

    7                                          0-31

    8                                          32-63

    9                                          64-95

    10                                        96-127

    Hence for "OMAPL138"  SOC the event number to HWI mapping should be as below:

    Source                             event number     map to  HWI

    GPIO Bank 4 Interrupt           54                        8

    GPIO Bank 5 Interrupt           59                        8

    GPIO Bank 7 Interrupt           72                        9

    Only a few are named above. So we have /* gpioParams.BankParams[GPIO_BANK_4].hwiNum  = 8u; */

    Secondly,
    struct Gpio_PinCmdArg {
        Uint32 pin;       /* This is the Pin number */
        Uint32 value;   /* This is the value to check if the pin direction is input or output */
    };


    Hope this answers your question..


     

    Thanks & regards,

    Raghavendra

  • Raghavendra,

    Thanks for your response.

    Raghavendra Maddikery said:
    #define GPIO4_0_PIN                  65u  /* This is the Pin Number for the 0th pin of GPIO bank 4 (Find details in http://www.ti.com/litv/pdf/sprufl8b Page65 )   */

    There is no page 65 in sprufl8b! Can you point out exactly where this pin number is documented? This is the essence of much of my confusion and frustration. From what I can tell (by methodically stepping through each line of your code), this pin number is calculated by multiplying the bank number by 32, then adding the pin number position in the bank, then adding one. So for my case (GP2P14) it is (16*2)+14+1 = 47. I find it rather interesting that no where in your user manual is this mentioned.

    Raghavendra Maddikery said:

    To determine the hardware interrupt numbers for the gpio, following table needs to be considered

    The event number to HWI mapping should be as follows:
    HWI                                  event number

    7                                          0-31

    8                                          32-63

    9                                          64-95

    10                                        96-127

    Where did this mapping come from? Is this what you have created for your example, or is it documented somewhere? Also, I assume that this mapping needs to be done in the bios .tcf file...? Does this feed and interrupt handler somewhere that identifies the specific interrupt that occurred?

    Raghavendra Maddikery said:

    Secondly,
    struct Gpio_PinCmdArg {
        Uint32 pin;       /* This is the Pin number */
        Uint32 value;   /* This is the value to check if the pin direction is input or output */
    };

     

    I'm sure this must be obvious to you, but it is not to me. I am using PIN 14 of GPIO bank 2. Therefore, I would expect "pin" to be = 14. If this is not the case, then you should point this out SOMEWHERE in your documentation!

    As you can tell, I am very frustrated with your documentation and example software, as well as the time difference between us. I hope you can provide some answers to my above questions.

    MikeH

     

     

     

  • Mike,

    Sorry for the inconvenience. Please refer to Page12 of: http://www.ti.com/litv/pdf/sprufl8b. A mistake occured when i was inserting the link.

    #define GPIO4_0_PIN                  65u

    Here we are defining the GPIO pin number for the 0th pin of the GPIO bank 4. This is passed to the 'pin' argument of "Gpio_PinCmdArg".

    MikeH said:
    I am using PIN 14 of GPIO bank 2.

    So referring to the document that is suggested above, If you are using PIN 14 of GPIO bank 2, the GPIO PIN NUMBER would be 47.

    MikeH said:

    The event number to HWI mapping should be as follows:
    HWI                                  event number

    7                                          0-31

    8                                          32-63

    9                                          64-95

    10                                        96-127

     I said this so as to make it easy for you to understand how the interrupt mapping occurs. In the (.tcf) file we have:

    /* ECM configuration */
    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;

    So here the group 0 is for (0-31 events) and group 1 is for (32-63 events) and so on..

     Unfortunately I could not point you to the "Gpio_PinCmdArg" in the documentation, but at this point of time i can only help you with these suggestions for your issue.

    Please let me know if you need any further details/information.

     

     

    Thanks & regards,

    Raghavendra