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.

TCA6507 - Driving two LEDs using two separate PWMs

Other Parts Discussed in Thread: TCA6507

Hi all,

We are using TCA6507 in one of our designs. Here, LED0 is connected to Blue LED & LED1 is connected to Red LED.
We want to blink both the LEDs once in 4 second period but want to have 1 second delay between the Blue & Red LED blink.

To achieve this we thought of using two separate PWMs - PWM0 to drive Blue LED & PWM1 to drive Red LED.
Below is the sequence of register writes we followed.

# Configure Blue LED to work with PWM0 & Red LED with PWM1

REG 0x00 - 0x01
REG 0x01 - 0x03
REG 0x02 - 0x03

# PMW0 settings -  ON period - 256ms , OFF period - 4.096s

REG 0x03 - 0x00
REG 0x04 - 0x44
REG 0x05 - 0x00
REG 0x06 - 0x00
REG 0x07 - 0x0C

Delay of 1 secs 

#Setting PWM1 off period

REG 0x07 - 0xCC

Basically, both PWM0 & PWM1 timings are same,but we are delaying the setting of PMW1 timing registers which should help us in providing the required delay between Red & Blue LED blinks.
This is working first few times , but if we execute the same code repeatedly, then the time difference between Red & Blue LED blink varies. Even though the blink period of 4 secs remains unchanged, the timing relationship between the Red & Blue vary randomly.

What can be the reason for this behavior ?
Are we missing out something in the register configurations ?

Please suggest.
We look forward to your response.

Thanks,
Suresha N S

 

  • Hi Suresha,

    Thanks for the question. I believe that you are trying to start this blinking action by delaying. However, this is a nominal time delay, and it's possible that there will be overlap in the blinking.

    Please look at the LED pattern diagram below.

    I believe that you should set your A1 and A2 register (0x03) to delay rather than setting it to 0x00. This will allow for the LEDs to turn off and on alternately.

    Thanks,

    Siby

     

  • Hi Siby,

    Thanks a lot for your response.

    Actually varying A1 & A2 will add delays which will result in alternate blinking of the same LED.

    But our requirement is to blink two LEDs driven by two PWM's with the fixed delay in between them.
    Please refer to the below diagram for details of our requirement.

    We have configured LED0 (Blue LED) to be driven by PWM0 & LED1 (Red LED) to be driven by PWM1. 
    We are not facing any issues with the turn ON & turn OFF times of individual LEDs i.e. every time we execute the I2C register writes, the timing parameters of 256mS & 4.096S remains the same for both PWM0 & PWM1.

    But the timing between two PWMs i.e. 1 secs delay , changes every time we execute the register writes. Sometimes both PWM0 & PWM1 will be active at same time , sometime there will be 2 secs delay instead of 1 secs delay between the two.

    What is the reason for this behavior ? 
    How to maintain a constant time delay between PWM0 & PWM1 ?

    We look forward to your support.

    Thanks,
    Suresha N S

  • Hi Suresha,

    Thanks for providing these diagrams. I seemed to have forgotten about the initialization register. Take a look at the tables below that I've snipped. We should be varying these blinks from Blue to Red by having the device initialize at the start of A1 and A2.

    Thanks,

    Siby

  • Hi Siby,

    Thanks for your response.
    We are able to make it work by using the initialization registers as per your suggestions.

    Thanks,
    Suresha N S