Pages: [1]   Go Down
Author Topic: Isolating SPI while uploading new code  (Read 785 times)
0 Members and 1 Guest are viewing this topic.
Colorado
Offline Offline
Edison Member
*
Karma: 47
Posts: 1562
Reviving dead brain cells with Arduinos.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Offline Offline
Full Member
***
Karma: 4
Posts: 187
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

From Idea To Invention

Colorado
Offline Offline
Edison Member
*
Karma: 47
Posts: 1562
Reviving dead brain cells with Arduinos.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Colorado
Offline Offline
Edison Member
*
Karma: 47
Posts: 1562
Reviving dead brain cells with Arduinos.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Full Member
***
Karma: 4
Posts: 187
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

>>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.  
Logged

From Idea To Invention

Offline Offline
Full Member
***
Karma: 4
Posts: 187
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

One more thing calculate all values of resistors RB RE RC etc for switching according to your case. smiley-cool
Logged

From Idea To Invention

Colorado
Offline Offline
Edison Member
*
Karma: 47
Posts: 1562
Reviving dead brain cells with Arduinos.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

One more thing calculate all values of resistors RB RE RC etc for switching according to your case. smiley-cool

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

Logged

Offline Offline
Full Member
***
Karma: 4
Posts: 187
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


* transistor-switch (1).png (15.39 KB, 440x487 - viewed 12 times.)
« Last Edit: January 12, 2013, 01:14:31 am by Cybernetician » Logged

From Idea To Invention

Colorado
Offline Offline
Edison Member
*
Karma: 47
Posts: 1562
Reviving dead brain cells with Arduinos.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 ...
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 484
Posts: 18764
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

http://www.gammon.com.au/forum/?id=10892&reply=3#reply3
Logged


Colorado
Offline Offline
Edison Member
*
Karma: 47
Posts: 1562
Reviving dead brain cells with Arduinos.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: