Go Down

Topic: ATTiny85 port (work in progress) (Read 46287 times) previous topic - next topic

Fe2o3Fish

Sweet!    **THAT** is what I was looking for!  THANK YOU!!!
I 'preciate it!

Coding Badly

Quote
I pretty well have to pop the chip out to re-program it to prevent the target circuit connections from interfering with the programmer and vice-versa.

I have this problem as well.  I know a relay could be used to isolate the processor while it's programmed.  Is there another way?  Something like a TRIAC but for low-voltage DC?

graynomad

I've just done a circuit (on paper only) to do this, it uses a mux chip for the ISP signals and a relay for RST so I can do HV programming as well.

See here for a schematic  http://www.robgray.com\quub\docs\emulator_85.pdf

It's only a first draft but the general idea is that the programming signals come from the right connector (you plug a ribbon cable into the 8-pin socket on an STK500 but can change to make more generic) and another ribbon cable into a socket on the target.

Press a button to program and another to run, but also it should be able to auto detect the RST going low and change over automatically for low-voltage programming.

I'll be offline for the next few days or a week but can answer any questions when I get back.

Rob

Rob Gray aka the GRAYnomad www.robgray.com

Coding Badly


Two quick questions...

1. What is a "SN743257"?  I can't find any reference to it.

2. Which "G6HK2" do you plan to use?  I found dozens of variations.

foxbat

Thanks very much for your work, it is very helpful. I have one item of feedback. delayMicroseconds() in wiring.c doesn't work with the default chip settings because it assumes an 8Mhz clock. The devices come preset at 1Mhz.

graynomad

Quote
1. What is a "SN743257"?  I can't find any reference to it.

Full number is sn74cbt3257c from TI.

http://au.farnell.com/texas-instruments/sn74cbt3257cd/logic-mux-demux-fet-4bit-16soic/dp/1741545

Data sheet

http://focus.ti.com/lit/ds/symlink/sn74cbt3257c.pdf

Quote
2. Which "G6HK2" do you plan to use?  I found dozens of variations.

the G6HK-2100 5DC, DPDT latching (typo in schematic which probably didn't help)

http://au.farnell.com/omron-electronic-components/g6hk-2100-5dc/relay-pcb-dpco-latching-5vdc/dp/1181061?Ntt=G6HK-2100+5DC

Data sheet,

http://www.farnell.com/datasheets/13455.pdf

although the above PN (from the Farnel site) doesn't quiet gel with it.
Rob Gray aka the GRAYnomad www.robgray.com

graynomad

Updated schematic

http://www.robgray.com\quub\docs\emulator_85.pdf

with a few comments.

Note that the P3 and P1 connectors are 10-way IDC headers that connect to 10-way ribbon cable that in turn connect to small IDC10->DIP8 adapter PCBs. AFAIK you can't get 8-pin DIP plugs as used in the fancy emulators. These adaptors should plug into existing DIP8 sockets on both the target and the programmer.

Alternatively P2 is the standard 6-pin AVR ISP header and can be used with any programmer.

If using high-voltage programming with an STK500 to get that extra pin on the 85 P1 would plug into the DIP8 socket on the 500 and a few jumpers have to be run between headers on the 500.

The "controlling ATtiny85" is just a simple way of combining a few logic gates + allowing the possibility of auto detecting the programming.

Rob Gray aka the GRAYnomad www.robgray.com

ChineseJacklee

Hi Guys,

I am trying to make attiny85 to talk with Arduino via softserial, but I can't get attiny85 to send (tx) data correctly.

The code I have on 85:

// include the SoftwareSerial library so you can use its functions:
#include <SoftwareSerial.h>

#define rxPin 0  //ic pin 5
#define txPin 3  // ic pin 2

// set up a new serial port
SoftwareSerial mySerial =  SoftwareSerial(rxPin, txPin);

void setup()  {
 // define pin modes for tx, rx, led pins:
 pinMode(rxPin, INPUT);
 pinMode(txPin, OUTPUT);
 // set the data rate for the SoftwareSerial port
 mySerial.begin(4800);

}

void loop() {
  mySerial.println("Hi!");
}

The pin 2 (txPin) of attiny85 is directly connect to RX(pin 0) of Arduino. Above code is working for Arduino(send) to Arduino(receive) (I have two Arduinos), but does't work for attiny85(send) to Arduino(receive). Any ideas ?

Coding Badly


Is the '85 running from an external crystal?  Internal oscillator?  Something else?

Do you have access to an oscilliscope?

ChineseJacklee

No, the ATTiny85 uses internal oscillator (I think it is running at 8hz). Does it matter ?

graynomad

#70
Sep 22, 2010, 11:04 am Last Edit: Sep 22, 2010, 11:05 am by graynomad Reason: 1
Quote
(I think it is running at 8hz). Does it matter ?

If you are trying to talk serial the CPU clock speed matters a lot.
Rob Gray aka the GRAYnomad www.robgray.com

ChineseJacklee

#71
Sep 22, 2010, 02:36 pm Last Edit: Sep 22, 2010, 02:37 pm by ChineseJacklee Reason: 1
Hi guys, thanks for your reply. So you think the problem is caused by not having external crystal (so the ATTiny85 runs too slow) ?

Coding Badly

#72
Sep 22, 2010, 05:37 pm Last Edit: Sep 22, 2010, 05:40 pm by bcook Reason: 1
Quote
So you think the problem is caused by not having external crystal (so the ATTiny85 runs too slow) ?

The problem could be the oscillator.  Atmel guarantees ±10% (tunable to ±1%) accuracy which may be too much for serial communications to work...

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1264584005/8#8

Quote
No, the ATTiny85 uses internal oscillator (I think it is running at 8hz). Does it matter ?

It might.  Which is why I asked if you had access to an oscilliscope.

If you have another '85 processor, try it.  There is very likely some variation.

Or, if you have an external crystal, try running the processor from it.

But, before you do any of that, make certain you've wired everything correctly...

Quote
#define txPin [glow]3[/glow]  // ic pin [glow]2[/glow]
The pin [glow]2[/glow] (txPin) of attiny85

graynomad

Also check that the /8 fuse is set correctly, you may be running at 1MHz.
Rob Gray aka the GRAYnomad www.robgray.com

ChineseJacklee

Thank you guys. Can 1mhz  runs ? If answer is no, then why not ? and what is the minim speed ? 8mhz ?

Go Up