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.

CCS/LAUNCHXL-CC1352R1: PWM Driver usage in Z-Stack 3.0 examples

Part Number: LAUNCHXL-CC1352R1
Other Parts Discussed in Thread: Z-STACK, SYSCONFIG

Tool/software: Code Composer Studio

Dear Support,

 I am having issues with the PWM driver when using the CC1352R1-Lauchpad along with simplelink_cc13x2_26x2_sdk_3_10_00_53, namely the z-stack zw_light example for CCS.

The PWM_Open() function is returning a NULL pointer, thus I am unable to use the driver to implement Level Control Cluster commands. Is there any configuration required other than the PWM driver initialization? I followed the function calls used in pwmled2 example. Is there any Z-stack example using PWM (besides TI-RTOS pwmled2)?

Thanks in advance.

Regards,

Angel

  • Hi Angel,

    There are no PWM driver implementations inside of the Z-Stack examples.  Can you please provide your full code changes?

    Regards,
    Ryan

  • Thanks Ryan,

    I simply tried the following code snippet at zclSampleLight_initialization(). It was originally copied from pwmled2 example.

    PWM_init();

    PWM_Params_init(&params);
    params.dutyUnits = PWM_DUTY_US;
    params.dutyValue = 0;
    params.periodUnits = PWM_PERIOD_US;
    params.periodValue = pwmPeriod;
    pwm1 = PWM_open(Board_PWM0, &params);

    if (pwm1 == NULL) {
    /* Board_PWM0 did not open */
    while (1);
    }

    PWM_start(pwm1);
    PWM_setDuty(pwm1, duty);

    The code is stuck in the while statement. PWM driver header was included and variables were declared. Is there any sort of Timer dependency that is not automatically managed in Z-Stack? 

    Regards,

    Angel

  • Hi,

    This is due to a conflict in pin resources: both examples attempt to access the red LED.

    To fix this, avoid any simultaneous access to pin resources.

    A quick option is to change the pin associated with Board_PWM0:

    /* PWM Outputs */
    #define CC1352R1_LAUNCHXL_PWMPIN0               IOID_21 // CC1352R1_LAUNCHXL_PIN_RLED
    #define CC1352R1_LAUNCHXL_PWMPIN1               CC1352R1_LAUNCHXL_PIN_GLED
    #define CC1352R1_LAUNCHXL_PWMPIN2               PIN_UNASSIGNED
    #define CC1352R1_LAUNCHXL_PWMPIN3               PIN_UNASSIGNED
    #define CC1352R1_LAUNCHXL_PWMPIN4               PIN_UNASSIGNED
    #define CC1352R1_LAUNCHXL_PWMPIN5               PIN_UNASSIGNED
    #define CC1352R1_LAUNCHXL_PWMPIN6               PIN_UNASSIGNED
    #define CC1352R1_LAUNCHXL_PWMPIN7               PIN_UNASSIGNED

    As a side note, we actually have a new tool called SysConfig in the latest 3.30 SDK, which provides an intuitive GUI for you to select which pins are allocated for a given peripheral. The user is also notified of any pin conflicts. For more details, please see http://dev.ti.com/tirex/explore/node?node=AIouI6g4ejAMCyOe10iMKQ__pTTHBmu__LATEST

  • Thank you,

    I thought of the same and I tried earlier a random pin and a different PWM with same results, so I was wondering if there was a timer-dependency issue. I just did not notice that the “random” pin was already attached to a button, so same story.

    Thanks for the hint.

    Regards,

    Angel