Hello again, So I'm working with some TLC5917s for an LED matrix which is working fine with a mega2560. When I tried one of the SPI examples ( the last one on the SPI hardware page) I noticed that it doesn't work as expected.
// Use SPI port number 1
HardwareSPI spi(1);
void setup() {
// Turn on the SPI port
spi.begin(SPI_4_5MHZ, MSBFIRST, 0);
pinMode(9,OUTPUT); // this line is always here
pinMode(10,OUTPUT); // this line is always here
}
void loop() {
digitalWrite(9,LOW); // this line was added later
digitalWrite(10,LOW); // this line was added for 1 run
spi.write(random(255));
digitalWrite(10,HIGH); // this line was added for 1 run
digitalWrite(9,HIGH); // this line was added later
}
there is a screen dump at the following link to illustrate the results https://drive.google.com/file/d/0B1ghmDU_EL2BME1Pd28yb0p1d1E/edit?usp=sharing
Running the 2 variations of the program with my logic analyser gives these 2 results. Notice how the CLK((7) and MOSI (6) don't line up with the SS(5) as you would expect or my indicator (4 pin9) and when I remove the SS toggle it doesn't get activated by the SPI library but the CLK and MOSI still fire. So what am I doing wrong or are there problems with the library?
Cheers
Mike