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.

SPI based LED driver

Other Parts Discussed in Thread: MSP430F67641

Hello sir,

I am working on MSP430f67641 controller. In my project i interface spi based led driver to msp430.

LED driver :- STP04CM05 

Contoller:- msp430f67641

i inteface with it but not getting the output and i confuse regarding how set the colour and brightness.

have you any sample code of it, so please forward me...

  • Hello,

    There are no specific code examples for interfacing the MSP430F67641 with LED drivers but TI does provide a few simple SPI examples for this device: www.ti.com/.../slac647

    Pay special attention to the CTLW0 register as you must properly set the UCCKPL to zero (clock inactive state low) and UCCKPH to one (data captured on the first UCLK edge) in accordance with the STP04CM05 datasheet. 3-bit SPI mode (UCMODEx = 0x00) should be utilized and master mode (UCMST = 1) along with synchronous mode (UCSYNC = 1) set. Ensure that the UCSWRST bit is set to keep the state machine in reset mode while making these changes.

    Any specific SPI communication questions involving the MSP430 can be addressed on this forum, but questions regarding setting the color and brightness using the STP04CM05 LED driver should be addressed by ST.

    Regards,
    Ryan
  • Hi Chintan,

    What is the output off the MSP that you are not getting? is the SPI not working as you expect it to?

    Regards,
    Charles O
  • >LED driver :- STP04CM05

    >i inteface with it but not getting the output and i confuse regarding how set the colour and brightness.

    Did you read datasheet of the chip? It says: The STP04CM05 contains a 4-bit serial IN, parallel OUT shift register that feeds a 4-bit Dtype storage register. So it means that chip does not control brightness, it is just programmable 4-channel on/off switch. To control brightness, you shall use PWM. SPI is fast enough so it is possible with your setup.

    To get output, you shall 0) read datasheet, then see that you need to: 1) shift data in, 2) assert LE, 3) pull ~OE down (actually it can be tied to GND all the time)

  • Hello sir,

    Thank you very much .
    STP04cm05 based led on msp430f67641 working fine. It is working with red , green and blue led blink ok.

    I have some confusion for color combining the RGB and generating different color of combination of led light.
    I tried with sending the different combination of frame but it blink with only one color means not getting the parallel output.

    i send the
    0x01 --> LED_OFF
    0x02 --> LED_RED
    0x04 --> LED_BLUE
    0x08 --> LED_GREEN
    it is working fine with sending this byte.

    problem

    1>
    it is blink when i send the

    0x0E --> for RED + GREEN + BLUE = WHITE

    but it is not show white color , it shows only red.

    2>
    brightness of the RED led is very low.

    once again thank you very much for your reply

    waiting for the solution of the above my problem...
  • Either sending is wrong (you think you are sending some data but in fact you are not) or your circuit is wrong somehow. You shall debug - check that SPI signals are OK, clock polarity right and LE is also working. Check using scope or logic analyzer. Then check your driver and leds.
  • Hello sir,
    Thank you very much.

    I send the
    for on RED led send --> 0x02
    for on BLUE led send --> 0x04
    for on GREEN led send --> 0x08
    it is working fine.

    while send the ( 0x02 | 0x04 | 0x08 ) for white color
    but it show red color of led only, means the problem in color combination

    i am not find what is the problem.
    waiting for your reply...
  • Hello sir,
    Thank you very much for giving support.
    It is working fine with single as well different color combination.
    Also it working fine brightness control by taking the OE pin as pwm.

    solution:- applying anode of led to directly 3.3 V (as per schematics), so that brightness increase as well as i showing different color combination.

    once again thanks a lot...
  • >It is working fine with single as well different color combination.

    Glad you made it.

    >Also it working fine brightness control by taking the OE pin as pwm.

    Good idea! On the other hand it still gives only 7 color combinations (R,G,B,RB,RG,BG,RGB). You can increase number of colors by individually applying PWM to each LED. Easiest way (to show idea): you continuously set 0x02 then 0x06 then 0x02 and so on - in result you are running red at 100% duty cycle PWM and blue - at 50%.

**Attention** This is a public forum