RTOS/LAUNCHXL-CC1310: PWM function in the main thread not executing when it is running with ICALL and IDLE Task

Intellectual 880 points

Replies: 5

Views: 42

Part Number: LAUNCHXL-CC1310

Tool/software: TI-RTOS

Hi,

I have been trying to integrate my working PWM function in the sensor example. This function takes at least 4-5 seconds in order to play 50-60 different frequencies, however when I try to trigger it in between the task[when End-node is connected to the collector], this function is not getting executed. I believe the reason is that it gets switched to other tasks in my application. I tried to debug it using ROV and got to know that there are 3 tasks running -- Idle, My task and ICALL task. How do I make my PWM function block any other task so that it may get executed properly and then only release the other tasks? 

Regards

5 Replies

  • Hi Gaurav,

    You can reference the TI-RTOS User's Guide and API to further understand the Task Manager and Task_disable: http://dev.ti.com/tirex/explore/node?node=AKYko6nhUS6VIKPn2Ciybg__eCfARaV__LATEST

    You can also increase the priority of this task but intermittently pend/post semaphores (using timers) to allow the operation of other tasks so that you are not allocating all resources towards this function for a few seconds.  Look through the Real-Time OS SLA to get a better grasp of this concept: http://dev.ti.com/tirex/explore/node?node=AA1dHb2o2eEpxLiUf2GtEg__eCfARaV__LATEST

    Regards,
    Ryan

    To better aid the community, please click on the "This Resolved my issue" button whenever a post answers your question!

  • In reply to Ryan Brown1:

    So I tried to debug it one more time by applying breakpoints and found out that the execution is getting to pwm function is completing successfully but the pwm is not generating the frequency somehow. I am getting the handle and then it just moves on with the execution normally but no pwm signal on the pin. If I comment the function sensor_process() and try to execute it, the pwm function generates the frequency.There is something happening in the sensor_process of sensor example which is causing this. The program is not getting stuck anywhere. Neither it is giving any run-time errors in debugging.

    I am using PWM2 with a modified entry in board.c file 

    { .pwmPin = CC1350_LAUNCHXL_PWMPIN2, .gpTimerUnit = CC1350_LAUNCHXL_GPTIMER1A },       


     My pwm frequency generation function is this:-

    pwmPeriod = 2064;        //default - 3000

    PWM_init();

    PWM_Params_init(&params);

    params.dutyUnits = PWM_DUTY_US;

    params.dutyValue = 40;

    params.periodUnits = PWM_PERIOD_HZ;

    params.periodValue = pwmPeriod;

    pwm1 = PWM_open(Board_PWM2, &params);         //using timer 1A as mentioned above

    if (pwm1 == NULL) {

      /* Board_PWM0 did not open */

      while (1);

    }

    PWM_start(pwm1);

    int i=0;

    for(int i=12; i<35; i++).           //generating a ramp

    {

    PWM_setPeriod(pwm1,172*i);

    Task_sleep(1000);

    }

    PWM_stop(pwm1);

    Task_sleep(100000);

    PWM_start(pwm1);

    for(i=0; i<41; i++)

    {

    PWM_setPeriod(pwm1, 172*(freqArray_sonic_pay[i]));             //playing an array 

    Task_sleep(4000);

              }

    PWM_stop(pwm1);

    PWM_close(pwm1);

     

  • In reply to Gaurav Sharma23:

    What pin is your CC1350_LAUNCHXL_PWMPIN2 assigned to and what SDK version are you using?  I also recommend reading through TI-RTOS Thread Synchronization as provided in the TI 15.4-Stack User's Guide: http://dev.ti.com/tirex/explore/node?node=AIiYaZcKNsnEQVxayNDHxQ__eCfARaV__LATEST

    Regards,
    Ryan

    To better aid the community, please click on the "This Resolved my issue" button whenever a post answers your question!

  • In reply to Ryan Brown1:

    I am using simple link SDK 2_30_00_20. My PWM2 pin is assigned to DIO6.

  • In reply to Gaurav Sharma23:

    DIO6 is also connected to LED1/RLED to indicate when the sensor successfully connects to a PAN, please be sure that these pin functions are not conflicting.  It would also be good to upgrade to the newest SDK to avoid bugs fixes which have been implemented recently: http://dev.ti.com/tirex/explore/node?node=APOGBsjoYumhgDYmNExPQA__eCfARaV__LATEST 

    Regards,
    Ryan

    To better aid the community, please click on the "This Resolved my issue" button whenever a post answers your question!