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.

RTOS/TM4C123GH6PM: RTOS Pulse Capture

Part Number: TM4C123GH6PM

Tool/software: TI-RTOS

Hello,

I am interested in capturing a pulse on the GPIO and using the captured value within a TI RTOS environment to control a variable. I am capturing a PPM signal from a RC transmitter and using it to change the a speed variable on a robot. If anyone can help me it would be greatly appreciated. I already have TIVA code for a capture, but I am not sure how to implement it into the RTOS environment. Thank you. 

  • Tyler,

    I believe you have created a capture driver of your own?

    The best way for you to integrate your driver into the RTOS is by creating a Hardware Interrupt (Hwi). When you create (or construct) a Hwi, you will specify the interrupt number. This will serve as the ISR for your general purpose timer operating in capture mode.

    An example:

    #include <ti/sysbios/hal/Hwi.h>
    void captureHwi(uintptr_t arg);
    
    void main()
    {
        Hwi_Handle myHwi;
        Hwi_Params hwiParams;
        
        hwiParams.arg = (uintptr_t) optionalArgument;
        hwiParams.priority = ~0;    
        myHwi = Hwi_create(INT_TIMERXX_TM4C123, captureHwi, &hwiParams, NULL);
        
        if (myHwi == NULL) {
            /* Hwi_create() failed */
        }
    }
    
    void captureHwi(uintptr_t arg)
    {
        /* Your ISR code here ie... */
    }

    In this example, captureHwi is the function that is called each time the general purpose timer generates an interrupt. You can think of the Hwi as an ISR that the RTOS is aware of.

    Derrick

  • Thank you for this excellent response. I will implement this. Greatly appreciated.