Pages: [1]   Go Down
Author Topic: SPI Programmer and how to isolate from ATtiny.....  (Read 2052 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
I am using the Arduino UNO and SPI to program a ATtiny84 on a breadboard.  My ATtiny is using the I2C interface to communicate with a real-time clock chip.  My problem is that I have to disconnect the ISP programming pins from the Arduino to the ATtiny to allow I2C to work.
I want to build a shield that I can plug into UNO and program the ATtiny (instead of breadboard) and leave the shield in place, for power etc, and still have the I2C interface work.  Not sure I am explaining this right but I am looking for the best way to isolate the programming pins from the UNO, so that I can run the ATtiny in-circuit.
It takes 4 pins to ISP program an ATTiny, so I could possible have a slider switch that I could switch over to disconnect the 4 pins after programming, but is there a better way or a more "electronic" way with a tact switch to isolate the pins.
Phew... Hope I am making sense.

Thanks
Mark Winney
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8856
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Typically you would put an ICSP header on the board to be programmed.  Plug in the programmer to program.  Unplug it to run your program.

An alternative, if you are using a DIP processor, is to unplug it from your board and plug it into a socket/board set up for programming.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

0
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the response.  I have seen that done, plugging, unplugging, but I was looking for a more elegant way.  For example if I want the ATtiny to communicate with UNO, I would be unplugging programmer pins between the Uno and ATtiny only the reconnect them again to the Uno in diff manner.  I would prefer to do neither and just hit a button/slide a switch and lo and behold by programmer pins are disconnected between Uno and ATtiny, and my shield is now running with ATTiny.
I would ideally like to program and run the ATTiny on a shield without all the plug/unplug.

Thanks
Logged

nr Bundaberg, Australia
Online Online
Tesla Member
***
Karma: 129
Posts: 8531
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You can use a MUX (say the 74CBT3257) to switch the SPI lines back and forth. I built an emulator that did just that and it worked fine.

This is just a solid state version of your switch idea.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8856
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you tried just setting the programming outputs from the UNO to inputs?  That should prevent them from interfering with the operation of the ATtiny.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

0
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Both are excellent ideas, I will give them a try.  Thanks for you help.

Mark
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 208
Posts: 12936
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you tried just setting the programming outputs from the UNO to inputs?

That should already be happening.  The ArduinoISP sketch keeps the SPI pins (and SS/RESET) as input / no pullup except when actively programming.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 208
Posts: 12936
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
My problem is that I have to disconnect the ISP programming pins from the Arduino to the ATtiny to allow I2C to work.

Once the Arduino has finished programming the ATtiny, there should be no interference.  The Arduino pins should be configured hi-Z (input / no pullup).

Are you using the ArduinoISP sketch?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Coding Badly,
I am using your new TinyISP that works with the 1.0 IDE, as you know the ArduinoISP does not work under 1.0.
So you are saying that the TinyISP sets the ISP pins to inputs after uploading the code to the ATtiny and that any connections on the ATtiny using those same pins (I2C) to a real-time clock should be able to function?


Thanks
Mark
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 208
Posts: 12936
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Mark,

So you are saying that the TinyISP sets the ISP pins to inputs after uploading the code to the ATtiny

Yes.  RESET is released after the SPI pins are reconfigured as INPUTs.  The target can only run if the SPI pins are INPUTs.  The code of interest is in end_pmode.

After uploading, it may be possible for the internal pull-up to be enabled on SCK or MOSI but that would indicate a problem with the SPI circuitry (very unlikely).    If the SPI circuitry includes separate output drivers then that situation is impossible.  With the exception of a loose wire on RESET and a stroke of very bad luck, I cannot think of any failures that would allow the target to run with the SPI pins configured as OUTPUTs.

If you're still concerned, put a series resistor (250 ohms or more) on MOSI and SCK.  In the event of a problem, the resistors will protect all the players from damage.


Quote
and that any connections on the ATtiny using those same pins (I2C) to a real-time clock should be able to function?

You may have to isolate the RTC during programming.  I have to idea how an I2C device reacts to "random" activity on the bus.

Does the RTC have a RESET?  Or an ENABLE?  You may be able to use that to keep the RTC quiet during programming.


In any case, there should be no need to disconnect / reconnect the programmer.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello, just looking for an update. Did you get the AtTiny85 working with the RTC? Thats what I am trying to do, but I am a newbie.
Logged

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 53
Posts: 1793
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm using the ATtiny85 under Arduino 1.0 without issues (at least for now!)  smiley-grin

Here is the boards and variants necessary:
http://hlt.media.mit.edu/?p=1695

I'm using Ladyada's Prototype ZIF board: http://www.adafruit.com/products/462

And I'm using Ladyada's modified Arduino code for the ISP:
https://raw.github.com/adafruit/ArduinoISP/master/ArduinoISP2.pde

- Ray


* Modified_Adafruit.jpg (397.77 KB, 1024x768 - viewed 34 times.)
Logged

Pages: [1]   Go Up
Jump to: