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/CC2652R: Microseconds accurate timer for Zigbee AC dimmer application

Part Number: CC2652R
Other Parts Discussed in Thread: CC2530

Tool/software: Code Composer Studio

Hello,

I am developing an AC dimmer switch with CC2652/CC1352.

The timer problem relate has been ask thousands here, i search across the forum but still not find a best solution.

I have try GPTimer26XX and Timer26XX driver with:

Power_setDependency(PowerCC26XX_XOSC_HF);

Power_setConstraint(PowerCC26XX_SB_DISALLOW );

But those driver not product accurate timer (GPT and Timer driver), it may cause but timing for the stack. The best I found is standard timer in util_timer, use in sample application, but it not accurate enough, the level transition not smooth as require. For example 5% some time will not change anything in the output waveform (in oscilloscope) because the timer not change with that small time: it is about dimming 100 microseconds.

The AC dimmer is detect Zero cross by interrupt and control the output for the dimmer (high and low). It could not be use PWM because AC line could not be sync.

So i just use timer and PIN_setOutputValue to control the triac.

So anyone here develop a similar product and the what is the option?

I use latest SDK 4.10.

  • We had tried to do similar thing on CC2530 but couldn’t make it. For your reference, we add an MSP430 dedicated to do this in the end. By using CC26xx, I think you can try to use sensor controller to do such detection.

  • Thank you, I will try

  • I have test sensor controller studio but it not work.

    I create a project base on GPIO Event Trigger to detect Zero Cross signal and set triac control.

    The output signal not change.

    1, Choose digital input pins: ZCD_IN for zero cross, digital output pins: DIMMER1 for triac control

    2, Choose Delay insertion, Task event handling: choose GPIO Event Trigger. Map ZCD_IN DIO25, DIMMER1 DIO11

    3, Innit code:

    // Select DIMMER1 Low
    gpioClearOutput(AUXIO_O_DIMMER1);
    
    // Set up the interrupt trigger
    evhSetupGpioTrigger(0, AUXIO_I_ZCD_IN, 0, EVH_GPIO_TRIG_ON_EDGE);

    Event Handler A Code:

        //turn off triac and dim
        gpioClearOutput(AUXIO_O_DIMMER1);
        //delay count by dimmer
        fwDelayUs(75*64); //dim 50% 64
        //turn triac on
        gpioSetOutput(AUXIO_O_DIMMER1);
        //delay 10us
        fwDelayUs(10); 
        //turn off triac
        gpioClearOutput(AUXIO_O_DIMMER1);
        // Set up the next interrupt trigger
        evhSetupGpioTrigger(0, AUXIO_I_ZCD_IN, 0, EVH_GPIO_TRIG_ON_EDGE);

    But the output have not produce any signal (on oscilloscope). I change some Pin but still the same.

  • Hello DzungPV,

    How to you read the AC input at safe voltage levels?

    Please refer to Trigger Timing for the Help Viewer for GPIO Event Trigger in Sensor Controller Studio. The latency can vary from 4 us to 215 (+code execution) depending on the power state and the state of the reference clocks.

    This will also not trigger on zero-crossing. Pins configured as digital inputs are Schmitt-triggered.

    I would investigate COMPA and keep Sensor Controller in active mode to reduce latency. This may increase average current consumption.

  • Maybe try to use a while loop to keep reading GPI status and do triac control right after you get the GPI status you want to control triac.