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/EK-TM4C129EXL: EK_TM4C129EXL PWM interrupt in RTOS

Part Number: EK-TM4C129EXL

Tool/software: TI-RTOS

Dear support,

I woulfd like to add PWM Interrupt to pwmled_EK_TM4C129EXL_TI example.

Added to cfg file:

var m3Hwi0Params = new m3Hwi.Params();
m3Hwi0Params.instance.name = "PWM_Generator_0";
m3Hwi0Params.priority = 0;
Program.global.PWM_Generator_0 = m3Hwi.create(26, "&hwi0_isr", m3Hwi0Params);

added in the pwmled.c:

void hwi0_isr(UArg arg)
{GPIO_toggle(Board_LED1);}

But when I added :

PWMIntEnable(PWM_BASE, PWM_GEN_0); - get error that 

PWM_BASE and PWM_GEN_0 undefined, but they exist is hw_memmap.h that include in the project:

#include "inc/hw_memmap.h"

Could you pls help me with it? where is the problem here?

Thanks,Sabina

 

  • Did you do #include <driverlib/pwm.h>

    Is there a reason you don't want to use the PWM driver suppied TI-RTOS? We have an example of it called pwmled.

    Todd
  • Hi Todd,

    I try to add PWM interrupt in PWMled example.

    It includes  #include <ti/drivers/PWM.h>

    pls see attached

    /cfs-file/__key/communityserver-discussions-components-files/908/0312.pwmled.c

    /cfs-file/__key/communityserver-discussions-components-files/908/pwmledOutput.txt

    We have to use PWM interrupt in our user application(in raise or down)

    PWMGenConfigure(PWM_BASE, PWM_GEN_0, PWM_GEN_MODE_DOWN | PWM_GEN_MODE_NO_SYNC);

    Thanks,Sabina

  • Hi Todd,

    Could you pls help us with it. Before new project starting with this specific board we have to check all features that we should use.

    one of the features it PWM interrupt in RTOS environment.

    We need it ASAP.

    Thanks, Sabina

  • Hi Sabina,

    The functions & symbols the compiler is mentioning are defined in "driverlib/pwm.h".  You need to add that include to your C file.  Also; PWM_BASE is not a valid symbol; I think you want to use PWM0_BASE.

    Regards,

    -- Emmanuel

  • Hi  Emmanuel,

    thank you very much! I had a problem with  PWM_BASE0 and used #include <ti/drivers/PWM.h> instead of #include <driverlib/pwm.h>. now the program is build successfully, But I never reach the interrupt. My settring is:
     

    PWMGenConfigure(PWM0_BASE, PWM_GEN_0, PWM_GEN_MODE_DOWN | PWM_GEN_MODE_NO_SYNC);
    PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, 400);
    PWMPulseWidthSet(PWM0_BASE, PWM_OUT_0, 100);
    PWMIntEnable(PWM0_BASE, PWM_GEN_0);
    PWMGenIntTrigEnable(PWM0_BASE, PWM_GEN_0,PWM_INT_CNT_ZERO);
    PWMOutputState(PWM0_BASE, (PWM_OUT_0_BIT | PWM_OUT_1_BIT), true);
    PWMGenEnable(PWM0_BASE, PWM_GEN_0);

    and in the configuration file:

    var m3Hwi0Params = new m3Hwi.Params();
    m3Hwi0Params.instance.name = "m3Hwi0";
    Program.global.m3Hwi0 = m3Hwi.create(26, "&hwi0_isr", m3Hwi0Params);


    from pw.c
    for PWM_GEN_0    INT_PWM0_0_TM4C129  = 26 

    I also setting in (not sure if have to do it)

    In the startup_ccs.c

       PWM0IntHandler,                         // PWM Generator 0

    What is the wrong in my setting?

    Thanks,Sabina

  • Could you pls help us to fix PWM interrupt problem? We can not continue without it

    I see that iISRStatus = PWMIntStatus(PWM0_BASE, false); return 1 . it means that interrupts is enabled. But I don't reach it

    Thanks,Sabina

  • Hi Sabina,

    Sorry I lost track of this.  Are you still experiencing issues?  I have modified an example project to trigger an interrupt when the counter reaches zero; it is attached to this post.  If you look closely at the ISR, it toggles the LED every 50 interrupts; this equates to roughly 3 LED blinks a second.

    Looking at the code you posted above, I believe the problem is the wrong parameters are being passed into PWMIntEnable().  The PWM_INT_GEN_0 macro should be provided as a parameter (instead of PWM_GEN_0); it should be something like:

        PWMGenIntTrigEnable(PWM0_BASE, PWM_GEN_0, PWM_INT_CNT_ZERO);
        PWMIntEnable(PWM0_BASE, PWM_INT_GEN_0);

    The reason you are getting a 1 returned from PWMIntStatus(PWM0_BASE, false) is because you are reading the raw interrupt register & the PWMGenIntTrigEnable() is working correctly.  But since the PWMIntEnable() call is incorrect; the actual interrupt is not enabled nor triggered.

    Regards,

    -- Emmanuelpwmled_interrupt_proj.zip

  • Thanks a lot! It was my problem. Now I get PWM interrupt!

    Thanks,Sabina

  • Hi Sabina,
    Sorry to post this, not REALLY related to your technical issue, but rather to a forum attitude: you marked YOUR "Thank you" message as the solution for the problem, while it is Emmanuel's post that solves it.
    Marking the correct answer helps the forum function better, and also allows for the people who help you achieve their deserved points.
    All the best,
    Bruno
  • Indeed Bruno - indeed.     And your sense of, "forum correctness and/or order" - and desire to "steer toward that" is much appreciated!  

    Perhaps "guiding language" - which should state, "THIS is the post which RESOLVED thread's issue" would lessen the (too high occurrence) of poster's, "incorrectly clicking their own post" - rather than the (proper) post (Mr. Trinidad's, here) which effectively "resolved" their issue.

    Definition likely assists:  "RESOLVE" -  that post which, "SOLVES or ANSWERS"  the posted issue or question!      

    At times - several posts may each contribute to the solution - thus, Multiple "RESOLVED MY ISSUE" posts may be, "Clicked as having resolved."

    In addition - would it not "prove effective" for the "originating poster - w/in the body of their "thank you post" - to "copy/paste:"

    • that earlier code block which the "Resolving post" supplied to "fix" the issue
    • any writing which described/detailed the "non-code" method(s) which likewise - "fixed" the issue

    This appears an issue of "understanding" - requiring greater clarity - which (hopefully) our posts have (now) provided.      (maybe - yet this guidance is certain to "rotate away into forum oblivion" - never (ok rarely) to be seen w/in such "LIKE-less forum" again...)