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.

CC1352P: Sensor Controller TDC or GPIO

Part Number: CC1352P

Hi, 

A customer has a use case as below.

The plan is to use one IO in sensor controller to measure the frequency of PWM which is the range of 100Hz~500KHz.

Does TDC support 500KHz?

They have tried GPIO and Timer event trigger. The counter was increased for each falling edge, then it counts the number of edge while one second timer expired. 

However  "event handle B" below only run less than 10 times in one second. 

Would you let me know if there is any issue in the following code? Thanks!

Initializing:

// Do not drive the reference high

gpioClearOutput(AUXIO_O_LED);

gpioClearOutput(AUXIO_O_LED_2);

 

////// Schedule the first execution

evhSetupTimer1Trigger(0, 1, 5);

 

 

////// Schedule the first execution

//evhSetupTimer0Trigger(1, 1, 6);

evhSetupGpioTrigger(1, AUXIO_I_BTN_15, BUTTON_PRESSED, EVH_GPIO_TRIG_ON_EDGE);

 

 

 

    event handle A (One second timer):

state.ledStatus ^= 1;

if(state.ledStatus > 0){

gpioClearOutput(AUXIO_O_LED);

}else{

gpioSetOutput(AUXIO_O_LED);

}

output.fallingEdgeNewCnt =output.fallingEdgeSumCnt - output.fallingEdgeCnt;

output.fallingEdgeCnt =output.fallingEdgeSumCnt;

// Schedule the next execution

// 1 sec

evhSetupTimer1Trigger(0, 1024/1, 2);

 

 

 

     event handle B (Detect GPIO falling edge):

state.led2Status ^= 1;

 

if(state.led2Status > 0){

gpioClearOutput(AUXIO_O_LED_2);

}else{

gpioSetOutput(AUXIO_O_LED_2);

}

 

output.fallingEdgeSumCnt = output.fallingEdgeSumCnt + 1;

 

// The "Event Handler Code" state machine shall first wait for the button to be pressed

evhSetupGpioTrigger(1, AUXIO_I_BTN_15, BUTTON_PRESSED, EVH_GPIO_TRIG_ON_EDGE);

Regards,

Yonghua

  • Hi, 

    The TDC supports up to 2.4 MHz. You can find a code example in SCS help viewer for pulse width measurement. 

    It is also possible to use Timer2 which has pulse width measurement built in (TIMER2_CCMODE_PER_PULSE_WIDTH_MEAS). See the SCS help viewer for more information. 

    -Simon