Go Down

Topic: Isolating SPI while uploading new code (Read 941 times) previous topic - next topic

KirAsh4

I use my SPI pins to control LED strings which don't have a slave select.  They simply take DATA and SCK to work.  But when uploading new code through a programmer connected to the same SPI pins, it sends the LED string into a psychedelic rainbow of colors.  After all, it's an SPI signal, and the LED string is interpreting it as well.  So my question is, is there a way to isolate whatever is connected to the SPI bus from getting affected by the programmer as it's uploading code?

Cybernetician

So my question is, is there a way to isolate whatever is connected to the SPI bus from getting affected by the programmer as it's uploading code?

Yes, by dip switch/any manual switch.

Which LED strings you are using?
From Idea To Invention

KirAsh4

Yeah, that's kinda hard to do in an enclosure.  They're regular WS2801 strings.  All they use is DATA and SCK (and VCC/GND)

retrolefty

You know an easy way to deal with this and cases where you need/want to use pins 0 and/or 1 (the serial pins) is to build your stuff to wire to a simple protoshield board. That way when you need to either upload via serial or perform ICSP programming with the SPI pins, you just pop the shield off, do your thing, then pop the shield back on. Proto boards in sheild format can be pretty inexpensive these days:

http://www.ebay.com/itm/Prototype-Prototyping-Shield-ProtoShield-For-Arduino-UNO-R3-/281028234209?pt=LH_DefaultDomain_0&hash=item416e968be1

http://www.ebay.com/itm/Assembled-Protoshield-for-Arduino-/120966868895?pt=LH_DefaultDomain_0&hash=item1c2a2fef9f

Lefty


KirAsh4

That won't work in an enclosure where I need to open the thing and pull the guts out just to pull the shield off to reprogram, etc., etc.  Uh, no.  So basically this tells me there is no easy way to do this, electronically at least, without physically handling the hardware.  Thanks.  I'll figure something else out.

Cybernetician

>>that's kinda hard to do in an enclosure.

Add a transistor between VCC and power source. Turn the transistor in Saturation through software but in that case one PIN resource need.  
From Idea To Invention

Cybernetician

One more thing calculate all values of resistors RB RE RC etc for switching according to your case. 8)
From Idea To Invention

KirAsh4

No need, the strips come prebuilt with everything on them.  Just connect SPI lines.  I'll try a transistor or FET to cut VCC from the strips.

retrolefty


One more thing calculate all values of resistors RB RE RC etc for switching according to your case. 8)


You intentions and idea my be good, but without a schematic drawing of what you are trying to say, it probably won't get much chance at being implemented.

Lefty


Cybernetician

#9
Jan 12, 2013, 06:58 am Last Edit: Jan 12, 2013, 07:14 am by Cybernetician Reason: 1
I don't know how to add picture here but i attach a schematic. If we can turn on and off the motor then we can also do that. If there is some thing wrong please let me know.
From Idea To Invention

KirAsh4

Oh, THOSE resistors.  Yeah I get what you're saying.  I need to figure out how to calculate those to begin with.  It's just switching 5V ...

Nick Gammon

You could connect the LEDs to the USART in SPI mode:

http://www.gammon.com.au/forum/?id=10892&reply=3#reply3
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

KirAsh4

Yes I could do that, except the library (FastSPI) used to drive them uses the native SPI port.  And I have no idea how to hack it to use a different port.

Go Up