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 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.
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.
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?
winneymj:
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.
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.