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.

GPIO API interrupt support, not reliable

Other Parts Discussed in Thread: TMS320C6747, OMAPL138

The GPIO driver API at present presents an impossible situation for reliable interrupt handling.

Explanation of the problem:

There is no function that returns the state of the gpio interrupt register. If byt the time the isr executes, the line is not still in the state that caused the interrupt (whether high or low)  then there is no way to know that that line caused an interrupt.

There are two ways to solve this.

Solution 1.:  Add a function  to the API.

uint32_t Gpio_ReadInterruptStatuBits32( bankpairoffset, uint32_t mask )

uint16_t Gpio_ReadIntStatuBits16( bank,uin16_t mask )

Saves the interrupt status register before clearig the bits specified in mask. The return value is the saved status.

Solution 2:  Pass the interrupt status register contents as the argument to the ISR

If the GPIO driver already does this, it is not documented and no tracks are found in the gpio source tree.

 

(There is perhaps an additioinal issue at the hardware level. Generally interrupts from a peripheral are disabled in its isr and then renabled when the isr returns. New interrupts that are not cleared in the isr then re-trigger the isr. One hopes that the system is bracketing the gpio interrupt routine in this manner, but there is no discussion of it in the GPIO documentation. Also there is not enough description of how the gpio interrupt enbale register works in the gpio user guide, SPRUFL8B. ) 

 

  • I assume, based on the User's Guide cited, that you are targeting the TMS320C6747/C6745/C6743 devices?

    What software baseline are you using?  It would be beneficial to cite the source of the software you are referencing.

  • Hi Mitch,

     

    Yes. As you have mentioned, there should be an API to read the Interrupt status of the GPIO. Thanks for pointing us on this. We will surely try to include this in our next upcoming release.

    If you are not aware, I would kindly request you to go through the following posts:

    http://e2e.ti.com/support/embedded/int-embedded_software/f/123/p/86608/303334.aspx#303334

    http://e2e.ti.com/support/dsp/omap_applications_processors/f/42/p/83410/291148.aspx#291148

     

    Thanks & regards,

    Raghavendra

     

     

     

  • we are using a c6748, more specifically it is the SOM from logic pd.

    here is a dump from the tool settings in ccsv4 build properties:

    -mv6740 -g --define=_INCLUDE_NIMU_CODE --define="xdc_target_types__=ti/targets/std.h" --include_path="C:/Program Files/Texas Instruments/ccsv4/tools/compiler/C6000 Code Generation Tools 7.0.5/include" --include_path="C:/Projects/DSP_Preprocessor/preprocessor.rev4/Debug" --include_path="C:/Program Files/Texas Instruments/ndk_2_20_03_24/packages/ti/ndk/inc" --include_path="C:/Program Files/Texas Instruments/ndk_2_20_03_24/packages/ti/ndk/inc/stack/inc" --include_path="C:/Program Files/Texas Instruments/nsp_1_00_00_09/packages/ti/drv/omapl138/inc" --include_path="C:/Program Files/Texas Instruments/xdctools_3_20_08_88/packages" --include_path="C:/Program Files/Texas Instruments/bios_5_41_10_36/packages/ti/bios/include" --include_path="C:/Program Files/Texas Instruments/bios_5_41_10_36/packages/ti/rtdx/include/c6000" --include_path="C:/Program Files/Texas Instruments/pspdrivers_01_30_01/packages/ti/pspiom/examples/evm6748/uppEvm/evmA/../../../../../.." --include_path="/packages/ti/xdais" --include_path="/include" --include_path="C:/Program Files/Texas Instruments/edma3_lld_01_11_02_05/packages" --diag_warning=225

    -z -m"preprocessor.map" --warn_sections -i"C:/Program Files/Texas Instruments/ccsv4/tools/compiler/C6000 Code Generation Tools 7.0.5/lib" -i"C:/Program Files/Texas Instruments/ccsv4/tools/compiler/C6000 Code Generation Tools 7.0.5/include" -i"C:/Program Files/Texas Instruments/bios_5_41_10_36/packages/ti/rtdx/lib/c6000" -i"C:/Program Files/Texas Instruments/bios_5_41_10_36/packages/ti/bios/lib" -i"C:/Program Files/Texas Instruments/edma3_lld_01_11_02_05/packages" -i"C:/Program Files/Texas Instruments/pspdrivers_01_30_01/packages/ti/pspiom/examples/evm6748/uppEvm/evmA/../../../../../.." -i"C:/Program Files/Texas Instruments/bios_5_41_10_36/packages/ti/pmi/lib" -i"C:/Program Files/Texas Instruments/bios_5_41_10_36/packages/ti/pscl/lib" --reread_libs --rom_model

     

  • 3730.CodeSnippet_API.txt

    Hi Mitch,

     

    Attached is the code snippet wherein, I have provided an API to read the interrupt status of a specified bank. You can incorporate it in the GPIO driver and use it.

    Please place the structure definition, and the API declaration in the Gpio.h file

     

    USAGE :

     Gpio_IntrStatus intrStatus;

     

    intrStatus.bank = 4u;      /* BANK 4 */

    Gpio_readBankInterruptStatus(gpio0,&intrStatus);         /* Gives the interrupt status of BANK 4 */

    printf (“%d”, intrStatus.value); /* Here, the INTSTAT register value of BANK 4 is printed */        

     

     

    Hope this helps..

     

    Thanks & regards,

    Raghavendra

  •  That is not the solution.

    You need to read and clear the bits.  And, it has to be done in such a way that any interrupts that appear after you read it, will cause the isr to be invoked again.