Daisy-chaining 7 IC's

Well, I knew that, but I figured "Somewhere between 0 and 16 mhz" wasn't very helpful.

This might be: Under "normal" circumstances I'm sending 20 events a second, and each event has 128 parameters. I still don't know how fast that is exactly but it's a start.

So slow it down to 10 events a second, if things suddenly dramatically improve then you know you have too much going on.
You have to send out 192s/device * 7 devices = 1344 bits of data.
Say the SPI clock was running at 1/4 speed, or 4 MHz. Then each bit takes 250uS x 1344 bits = 0.336mS
You are sending data out 20 times/second, or 50mS. So there's 49.6 mS for the code to do whatever it does, which seems like a lot of time.

Just tried that. Even at 1 event per second it's not working properly. Most of the LED's respond properly but a few scattered over the entire display (not just one chip anymore) don't listen. Weirder yet, they switch even when I don't tell them anything. LED's aren't flickering; they're just randomly deciding to change state. I'm not touching the wires or anything. It just happens.

I'm pretty sure it's not a clocking issue. The library supports "infinite" tlc5940's chained together. I think the speed limit is set within the library so even if I tried to send more than they can handle it wouldn't happen. On top of that, they have 30 mhz clocks. Finally, the events are not evenly spaces. They're sent as fast as the library will allow. What I'm getting at is, if it was a clock issue, it'd have been showing its self when I added the first chip.

I'm thinking about the speed of transmission as well, if it is 8MHz maybe that's too fast for the long wires and breadboards or whatever you are using.

You can lower the speed of the SPI port, I can't remember what register to write into but I'll have a look. Maybe someone else knows of the top of their head.

I thought about using transistors. 2N2222 claims to only run up to 300 mhz but I tried it anyway.

The 5490 is only rated at ~30MHz, so the transistor is 10x faster. Your problem was more likely the inversion caused by the transistor.

I read some of the library files, I can see no mention of 1GHz anywhere, can you point to the reference?. Anyway, trust us, there is no way on God's earth this sort of thing runs at that speed.

EDIT:

it'd have been showing its self when I added the first chip.

Not necessarily, more chips + more wires + more breadboards = more capacitance = slower clocks required.

You can send data once a week but if you send it too fast that can still be a problem.


Rob

My bad, I meant 300 hz, not mhz, for the 2N2222. Got so used to typing "mhz" that I didn't notice. My bad.

I already pointed to the reference. "\note The default of 8192 means the PWM frequency is 976.5625Hz */".

EDIT: I'd still like to try using transistors. Inversion makes sense since I have the "BLANK" line going through it. Is there a magical way to fix inversion? Do I just hang the chip up-side down? (Canned laughter here, please.)

976.5625Hz is less than 1000 Hz. Not sure how GHz came out of that.

Use 2 transistors to make non-inverting buffer.

...There I misread "hz" as "mhz". See above.

I don't have ten 2N2222's. Would it be 'kay if I mixed them with transistors of a different type that run at 150 hz? Or is that pushing things?

As your signals are relatively slow, I think mixing transistors would probably be fine.

Instead of daisy chaining control signals, you might also try feeding each one direct from the source.

I'll try getting transistors happy then, but it'd help if I knew what wires to stick where. I'm Googling stuff but it's bringing up not-so-useful results.

I can't control each IC directly. I'd need a total of 28 PWM pins to do that. (4 PWM pins per IC, 7 IC's).

No, instead of daisy chaining, make like a star-distribution from the control pin to the 7 end points.

Can't help you with the buffer, you need to look up the data sheets for your transistor and determine the base/emitter/collector. No mind readers here!

Yes, getting rid of the daisy-chained clock may help, and try adding this to your setup()

SPCR |= 3;

That should slow down the transmission speed.

But don't do both at once :slight_smile:


Rob

Ah. Okay, I can try that. I should have /just/ enough wires and a spare breadboard somewhere.. If that don't work I'll try changing the SPI's speed.

But what do I hook where? Do I stick the second transistor's collector to the first's emitter and tie the second's base to a constant +5v source?

I still doubt you need buffering at all, but I don't think it can be any clearer than Crossroad's schematic except there's no R values.


Rob

I LOVE YOU GUYS. o_o...

I thought of doing a bus/star formation earlier but thought it was a stupid idea. I guess I severely underestimated how much wires can screw with data. It works perfectly now! Even my tests that do far more than I'd ever do when sequenced with music (Just constant events, no delays anywhere) don't throw them off now! Gosh. Wow.

For future reference, what kinda wire should I be buying? Larger or smaller gauge? Solid or stranded?

Good stuff, remember you still have the option to slow the speed. That may allow you to go back to a daisy chain if that's easier to wire.

For breadboarding I use solid, for permanent I use stranded normally, I doubt the gauge matters for the data.


Rob

Stranded is easier to work with.
I use these when I prototype.
http://www.nkcelectronics.com/breadboard-jumper-wire-70pcs-pa70.html

Stranded's easier to work with, but is solid better for not running into the situation I was just in?

I might slow it down, I don't know if I can get this to reach all the way down to the end of my second breadboard.. Hopefully it'll keep up. I've already found out that 57600 baud is barely enough for 20 events/second and that's the fastest the software controlling it allows. How much slower would setting SPCR to 3 make things? Still enough for 57600?

The solid ends on the stranded jumper wire make for nice connections.

I knew that. I have some of those wires you linked to and I agree, they're far nicer than just plain stranded wire when you're trying to get them into a breadboard, but what carries a signal better?

How much slower would setting SPCR to 3 make things?

Probably better to use the official API

[How much slower would setting SPCR to 3 make things?](http://How much slower would setting SPCR to 3 make things?)

You can adjust it to 7 different speeds. So

SPI.setClockDivider(SPI_CLOCK_DIV2);

Is probably the default (8MHz) and i would think what you are current using.

SPI.setClockDivider(SPI_CLOCK_DIV4);

would give you 4MHz etc etc.

You do the maths :slight_smile:

but what carries a signal better?

At these slow speeds I doubt it matters.


Rob