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.

LP5521 issues with ramps on mixed colors

Other Parts Discussed in Thread: LP5521

Hello,

I am trying to create a "soft white" breathing effect using the LP5521 driver.  Using the program pasted below, I would expect to see a white light ramping up, then ramping down, and repeating forever. However, what I see instead is a white light ramping up, ramping down, and on subsequent ramps it gets less white and other colors get in there. It's as if the different colors are not in sync. I've attached a video of what I'm seeing, and below is the program. Notice the video ending on blue--I don't expect to see blue if I have all 3 colors ramping with the same timing--the mix should be even, creating white. Are the colors not running at exactly the same time?

Is this expected behavior, or is there an error in he program (as pasted below)?

My setup:

HW: LP5521 Demo Rev 2.1

SW: lp5521x4.exe (version 1.0.0)

My program:

.RED
    wait 999
    set_pwm 0
    ramp    510, 25
    ramp    510, 25
    ramp    510, 25
    ramp    510, -25
    ramp    510, -25
    ramp    510, -25
    set_pwm 0
    start
    
.GREEN
    wait 999
    set_pwm 0
    ramp    510, 20
    ramp    510, 20
    ramp    510, 20
    ramp    510, -20
    ramp    510, -20
    ramp    510, -20
    set_pwm 0
    start

.BLUE
    wait 999
    set_pwm 0
    ramp    510, 10
    ramp    510, 10
    ramp    510, 10
    ramp    510, -10
    ramp    510, -10
    ramp    510, -10    
    set_pwm 0

    start

Thank you,

Katie

  • Hi Katie,

    The compiler will try to fit a ramp command into the register shown below. You can refer to section 7.5.3.1 for more detail information.

    Depending on number of steps and ramp time, the actual time will not be exact due to rounding error. In your example, if all the steps are 25 instead of 25, 20 and 10, then it will sync up nicely since whatever rounding done by the compiler will be the same for all 3.

    Even if the rounding error is small, eventually they will be out of sync over time. To get around this problem, you can use trigger wait and trigger send to sync up all 3 engines. See example below.

    .RED
        wait 999
        trigger sgb
        set_pwm 0
        ramp    510, 25
        ramp    510, 25
        ramp    510, 25
        ramp    510, -25
        ramp    510, -25
        ramp    510, -25
        set_pwm 0
        start
       
    .GREEN
        trigger wr
        set_pwm 0
        ramp    510, 25
        ramp    510, 25
        ramp    510, 25
        ramp    510, -25
        ramp    510, -25
        ramp    510, -25
        set_pwm 0
        start

    .BLUE
        trigger wr
        set_pwm 0
        ramp    510, 20
        ramp    510, 20
        ramp    510, 20
        ramp    510, -20
        ramp    510, -20
        ramp    510, -20
        set_pwm 0
        start

    Hope this helps

    H L

  • Still no answers...is anyone able to answer this question?

  • oops, sorry, now I see the answer and I'm trying that suggestion now, thanks!