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.

CC2745R10-Q1: Timers thread

Part Number: CC2745R10-Q1

I am using CC2745 controller with basic BLE code, Here i need to keep two different timers.

One with 1ms and other one with 10ms. I have configured two timers the information in the following

#define CONFIG_LGPTIMER_COUNT 2

/*
 *  ======== LGPTimerLPF3_objects ========
 */
LGPTimerLPF3_Object LGPTimerLPF3_objects[CONFIG_LGPTIMER_COUNT];

/*
 *  ======== LGPTimerLPF3_hwAttrs ========
 */
static const LGPTimerLPF3_HWAttrs LGPTimerLPF3_hwAttrs[CONFIG_LGPTIMER_COUNT] = {
  {
    .baseAddr           = LGPT0_BASE,
    .intNum             = INT_LGPT0_COMB,
    .intPriority        = 0x90,
    .powerID            = PowerLPF3_PERIPH_LGPT0,
    .channelConfig[0]   = {
        .pin     = GPIO_INVALID_INDEX,
        .pinMux  = GPIO_MUX_GPIO_INTERNAL,
        .nPin    = GPIO_INVALID_INDEX,
        .nPinMux = GPIO_MUX_GPIO_INTERNAL,
    },
    .channelConfig[1]   = {
        .pin     = GPIO_INVALID_INDEX,
        .pinMux  = GPIO_MUX_GPIO_INTERNAL,
        .nPin    = GPIO_INVALID_INDEX,
        .nPinMux = GPIO_MUX_GPIO_INTERNAL,
    },
    .channelConfig[2]   = {
        .pin     = GPIO_INVALID_INDEX,
        .pinMux  = GPIO_MUX_GPIO_INTERNAL,
        .nPin    = GPIO_INVALID_INDEX,
        .nPinMux = GPIO_MUX_GPIO_INTERNAL,
    },
  },
  {
    .baseAddr           = LGPT1_BASE,
    .intNum             = INT_LGPT1_COMB,
    .intPriority        = 0x70,
    .powerID            = PowerLPF3_PERIPH_LGPT1,
    .channelConfig[0]   = {
        .pin     = GPIO_INVALID_INDEX,
        .pinMux  = GPIO_MUX_GPIO_INTERNAL,
        .nPin    = GPIO_INVALID_INDEX,
        .nPinMux = GPIO_MUX_GPIO_INTERNAL,
    },
    .channelConfig[1]   = {
        .pin     = GPIO_INVALID_INDEX,
        .pinMux  = GPIO_MUX_GPIO_INTERNAL,
        .nPin    = GPIO_INVALID_INDEX,
        .nPinMux = GPIO_MUX_GPIO_INTERNAL,
    },
    .channelConfig[2]   = {
        .pin     = GPIO_INVALID_INDEX,
        .pinMux  = GPIO_MUX_GPIO_INTERNAL,
        .nPin    = GPIO_INVALID_INDEX,
        .nPinMux = GPIO_MUX_GPIO_INTERNAL,
    },
  },
};

/*
 *  ======== LGPTimer_config ========
 */
const LGPTimerLPF3_Config LGPTimerLPF3_config[CONFIG_LGPTIMER_COUNT] = {
    {   /* CONFIG_LGPTIMER_2 */
        .object      = &LGPTimerLPF3_objects[CONFIG_LGPTIMER_2],
        .hwAttrs     = &LGPTimerLPF3_hwAttrs[CONFIG_LGPTIMER_2]
    },
    {   /* CONFIG_LGPTIMER_1 */
        .object      = &LGPTimerLPF3_objects[CONFIG_LGPTIMER_1],
        .hwAttrs     = &LGPTimerLPF3_hwAttrs[CONFIG_LGPTIMER_1]
    },
};

const uint_least8_t CONFIG_LGPTIMER_2_CONST = CONFIG_LGPTIMER_2;
const uint_least8_t CONFIG_LGPTIMER_1_CONST = CONFIG_LGPTIMER_1;
const uint_least8_t LGPTimerLPF3_count = CONFIG_LGPTIMER_COUNT;

here i am not get the steps to start timer 

Also i try without configuration one timer is working but next one not working 

   void timerCallback(LGPTimerLPF3_Handle lgptHandle, LGPTimerLPF3_IntMask interruptMask) {
       // interrupt callback code goes here. Minimize processing in interrupt.
      Count_1ms++;
      if (Count_1ms>10){
        Count_1ms=0;
      }
   

   void taskFxn(void* arg0) {
 
   LGPTimerLPF3_Handle lgptHandle;
     LGPTimerLPF3_Params params;
     uint32_t counterTarget;
 
     // Initialize parameters and assign callback function to be used
     LGPTimerLPF3_Params_init(&params);
     params.hwiCallbackFxn = timerCallback;
 
     // Open driver
     lgptHandle = LGPTimerLPF3_open(0, &params);
 
     // Set counter target
     counterTarget = 48000 - 1;  // 1 ms with a system clock of 48 MHz
     LGPTimerLPF3_setInitialCounterTarget(lgptHandle, counterTarget, true);
 
    // Enable counter target interrupt
     LGPTimerLPF3_enableInterrupt(lgptHandle, LGPTimerLPF3_INT_TGT);
 
     // Start counter in count-up-periodic mode
     LGPTimerLPF3_start(lgptHandle, LGPTimerLPF3_CTL_MODE_UP_PER);
 
     // Generate counter target interrupt every 1 ms forever
    while(1);
   }


   void timerCallback2(LGPTimerLPF3_Handle lgptHandle_1, LGPTimerLPF3_IntMask interruptMask) {
       // interrupt callback code goes here. Minimize processing in interrupt.
      Count_10ms++;
      if (Count_10ms >100){
        Sec_count++;
        Count_10ms=0;
      }
  }
 
   void taskFxn2(void* arg0) {
 
   LGPTimerLPF3_Handle lgptHandle_1;
     LGPTimerLPF3_Params params_1;
     uint32_t counterTarget;
 
     // Initialize parameters and assign callback function to be used
     LGPTimerLPF3_Params_init(&params_1);
     params_1.hwiCallbackFxn = timerCallback2;
 
     // Open driver
     lgptHandle_1 = LGPTimerLPF3_open(CONFIG_LGPTIMER_1, &params_1);
 
     // Set counter target
     counterTarget = 4800 - 1;  // 10 ms with a system clock of 48 MHz
     LGPTimerLPF3_setInitialCounterTarget(lgptHandle_1, counterTarget, true);
 
    // Enable counter target interrupt
     LGPTimerLPF3_enableInterrupt(lgptHandle_1, LGPTimerLPF3_INT_TGT);
 
     // Start counter in count-up-periodic mode
     LGPTimerLPF3_start(lgptHandle_1, LGPTimerLPF3_CTL_MODE_UP_PER);

   }

Please give the guidence to complete it