Problem cascading TLC5917 shift registers using ShiftPWM.


hello,

i'm working on project add aesthetic lighting set of stairs.

my brother saw post , shared me, sounded fun, thought i'd give go.
http://speedysignals.wordpress.com/2013/08/01/how-to-assemble-stair-lights/

my stairs have 13 steps, brother's has 15, thought make board universal since i'll installing him also.

i'm using modern device's rbbb board, 2 cascaded tlc5917 constant-current sink drivers, 5v leds sync current tip125 pnp darlingtons drive individual led strips.

the simple sketch below uses shiftpwm spi fade on outputs, fade them off, fades them on off sequentially. test/debug program.

the first shift register works expected, however, doesn't appear serial data being received correctly on second register.

i've double checked soldering.  i've popped out first chip , jumpered pins 2 & 13, outputs second chip work expected.

i've tried de-coupling caps v+ , latch pins no success.

at point i'm wondering if there issue library, or configuration i've missed tlc5917.

links:
shiftpwm: http://www.elcojacobs.com/shiftpwm/
ti tlc5917: http://www.ti.com/product/tlc5917
modern device rbbb: http://moderndevice.com/product/rbbb-kit/


code:
code: [select]

#include <spi.h>

const int shiftpwm_datapin=11; // serial data out (sdo/mosi)
const int shiftpwm_clockpin=13; // clock (sc/sck)
const int shiftpwm_latchpin=9; // latch (pwm!) (le/ss)
const bool shiftpwm_invertoutputs = false; // if invertoutputs 1, outputs active low. usefull common anode rgb led's.
const bool shiftpwm_balanceload = false; // allows distribute pwm 0 crossing moment each shift register.
// #define shiftpwm_nospi

#include <shiftpwm.h>   // include shiftpwm.h after setting pins!

const unsigned char maxbrightness = 64;
const unsigned char pwmfrequency = 75;
const int numregisters = 2; // num bits total in registers / 8

int numleds = 0;

const unsigned long brightness_sm_period = 2000; /* in ?s */

void setup()   {               
    pinmode(shiftpwm_latchpin, output); 
    spi.setbitorder(lsbfirst); // alternate value: msbfirst
    // spi_clock_div2 tiny bit faster in sending out last byte.
    // spi transfer , calculations overlap other bytes.
    spi.setclockdivider(spi_clock_div4);
    spi.begin();

    serial.begin(9600);
   
    /* turn on pullup resistor switch */
    for(int i=5; i<=8; i++) {
        pinmode(i, input_pullup);
    }
   
    delay(1); // allow inputs settle
   
    // read dip switches numleds
    for(int i=5; i<=8; i++) {
        numleds = numleds | (abs(digitalread(i)-1) << (i-5));
    }
    numleds++;
    serial.print("using ");
    serial.print(numleds);
    serial.println(" outputs.");
   
    shiftpwm.setamountofregisters(numregisters);
    shiftpwm.start(pwmfrequency,maxbrightness); 
    // print information interrupt frequency, duration , load on program
    shiftpwm.setall(0);
    shiftpwm.printinterruptload();

}

void loop() {   
    fadeblinkall();
    fadeblinkseries();
    delay(2500);
}

void fadeblinkall() {
    // fade in outputs
    unsigned long delaymillies = 2000 / maxbrightness;
    serial.println("fading on (all)");
    for(int j=0;j<maxbrightness;j++){
        shiftpwm.setall(j); 
        delay(delaymillies);
    }
    // fade out outputs
    serial.println("fading off (all)");
    for(int j=maxbrightness;j>=0;j--){
        shiftpwm.setall(j); 
        delay(delaymillies);
    }
}

void fadeblinkseries() {
    // fade in outputs
    unsigned long delaymillies = 1000 / maxbrightness;
    serial.println("fading (series)");
    for(int i=0; i<numleds; i++) {
        for(int j=0;j<maxbrightness;j++){
            shiftpwm.setone(i, j); 
            delay(delaymillies);
        }
        for(int j=maxbrightness;j>=0;j--){
            shiftpwm.setone(i, j); 
            delay(delaymillies);
        }
    }
}


and picture visualize, shown during fadeblinkall() function.


any appreciated!
thanks,
burton


i've popped out first chip , jumpered pins 2 & 13, outputs second chip work expected.


did mean "jumpered pin 14 (mosi) of socket pin 9 (qh*) of socket"? 


Arduino Forum > Using Arduino > LEDs and Multiplexing > Problem cascading TLC5917 shift registers using ShiftPWM.


arduino

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support