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.

Timer1, in Modulo mode, compare mode , can't output a pwm signal on P0_3 of CC1110.

Other Parts Discussed in Thread: CC2530

 I want to generate a pwm signal on p0_3 with timer1 without interrupt. but it does not work. I don't kown why. the following  is the program i used:

 CLKCON = (CLKCON & ~CLKCON_TICKSPD) | TICKSPD_DIV_2;  //13M
 //
 PERCFG = 0x01;     //==01TEST spi: alt2, t1: alt1
 P2DIR |= 0x80;      //set the peripheral priority:  Timer 1 channel 1 has priority on Port 0
 //
 P0SEL |= 0x0a;  
 P0 = 0x00;      
 P0DIR |= 0x7F;  //
 // 
 P1SEL |= 0xEA;  //E8==TEST
 P1 = 0x70;  
 P1DIR |= 0xBE; 
 //
 P2SEL = 0x01;        //00=TEST
 P2 = 0x0f;
 P2DIR |= 0x01;       
 //
 T1CTL &= ~T1CTL_OVFIF;
 T1CNTL = 0x00;
 //
 T1CC0L = 0x03;  
 T1CC0H = 0x00;
 T1CC1L = 0x00;  
 T1CC1H = 0x00;
 //
 T1CCTL1= 0x14;  //Interrupt disabled, Toggle output mode,Compare mode
 T1CTL =  0x00;   //Tick frequency/1, Operation is suspended/Modulo mode
 //
 TIMER1_RUN(TRUE);   //#define TIMER1_RUN(value)      (T1CTL = (value) ? T1CTL|0x03 : T1CTL&~0x03)

 I hope  TI 's engineer or someone  give me some advice , thanks!

  • Hi

    Please take a look at the code example called t1_mod.c found here: http://www.ti.com/lit/zip/swrc117

    BR

    Siri

  • Thank you  for your  reply!  Before  I  write my own program,  I have refered  some codes include that you mentioned.  I have  compared  the codes   from mine  and  samples time and time , but  I havn't found any  mistake . and it still doesn't work properly!

  • I have tested t1_mod.c and it works as expected (P0_3 is toggling). I would therefore recommend that you use this example as it is, and then do the changes you which one at the time. There must be a difference somewhere since this code example works and your code does not.

    BR

    Siri

  • Thank you very much. But I have given up using timer1 to generate clock  instead of using timer4. and it works well.

  • Hi All,

    This is Karthik and i am being working on cc2530ZDK now and i need to generate the four different pwm signals at the same time at four different GPIO ..I am posting the code below

     /* setup P1.0 as PWM output of CCR channel 2 */
      PERCFG |= 0x40; // T1CFG = 1: Timer 1 Alternative 2 location
      P1DIR |= 0x01; // P1.0 set to output
      P1SEL |= 0x01; // set P1.0 to peripheral function

      /* setup timer module */
      T1CC0H = HI_UINT16(MAX_PWM_VAL);
      T1CC0L = LO_UINT16(MAX_PWM_VAL);
      T1CTL |= 0x06 ; // 0000 01 10 -> 32MHz/8 = 4MHz, mode=modulo
      T1CCTL2 = 0x34; // 00 110 1 00 -> no interrupt, ch 2 compare = 6, compare mode, no capture

    #ifdef ZDO_COORDINATOR
      // set ADC module reference
      HalAdcSetReference(HAL_ADC_REF_AVDD);  
    #endif

    As Mentioned above P1.0 is been used to generate the pwm signal using timer 1.It is Successful and i am able to see the output at IO_LED1 (Green LED) it just toggles  that is P1.0

    Similarly i am doing it for P1.1 and P1.4 but i am unable to generate the pwm signal .

    I would like to have some detailed information regarding this issue.

    Expecting the solution asap,

    Advance Thanks for the help

    Regards,

    KARTHIK V

  • Hi KAERHIK V,

    I have shown you an example to output PWM on P1_4 of CC2530 at this thread.