using STK500 to program Atiny12

Aug 10, 2004 6 Replies

I am using the STK500 to program Atiny12. I have done the following:



1.) plugged in the ATtiny12 into SCKT3400D1.
2.) connected RST on PORTE to PB5 on PORTB.
3.) connected XTI on PORTE to PB3 on PORTB.

I am able to program the microprocessor once but when I try to re-program it, I got the following error:



Entering programming mode: Failed



Would you pls tell me how to solve this problem? Thanks.


For re-programming, you must first erase the device. That can be done automatically by checking the "erase before program" checkbox.

I did have some problems as well, but do not remember them exactly. I see I have configured my STK500 for high-voltage serial programming. Although this is not required for the tiny12, I think I did that when I had these problems. But I have also been programming tiny11's which do require high voltage serial. :-(

Anyway, you can give high-voltage serial a try. this requires a different connection for the prog-data connector (jumper wires) and enabling it in the STK500 software.

Stef (remove caps, dashes and .invalid from e-mail address to reply by mail) There's one fool at least in every married couple.

If you have selected the wrong fuse settings for the clock, you might end up with a situation where the micro gets no clock after programming. Without clock, the micro won't be able to talk through it's SPI port.

Meindert

You've probably disabled one of the inputs required for serial programming. RESET, for instance, has to be a RESET, not a GPIO. In order for serial programming to work, you must have:

  • A clock source (internal RC is OK but if you set the fuses for an ext clock, you need to provide that clock during programming)
  • RESET
  • MOSI, MISO and SCK

Thanks a lot for you guys' help!!

It turns out that if I select,

'CKSEL = 0010 Internal RC Oscillator'

instead of 'CKSEL=1111 External Crystal/Ceramic Resonator' in the fuse bit, I would be able to perform ISP. However, how come I cannot use the CKSEL=1111 option since I do have an external crystal at 2.45MHz on the STK500 with the proper oscel jumper and my Tiny12 is for 8MHz?

My second question is what are the steps to setup the micro-processor to use external crystal. Do I need to set the port direction by setting DDRB to 0 and PORTB to 1?

My last question is when I set the fuse bit to 'CKSEL = 0010 Internal RC Oscillator' and I assign OSCCAL to 0xFF in my code, it only give me a 1MHz clock. What do I need to do in order to have the maximum

2.5MHz?

Thanks again for your help, I greatly appreciate.

Regards, feilip

The xtal socket on the STK500 drives an oscillator circuit that connects to all the MCU sockets. "External clock" (not ext. crystal) is the correct option when sourcing clock from the STK500. Docs are a bit vague on this point.

"Note: In a real application with only one AVR connected to the crystal, there is no need for an external oscillator circuit. The STK500 has 8 different AVR sockets connected to the same clock system. The long signal lines in this system makes it difficult to drive a crystal with the on-chip oscillators on the AVR. "

Ah, thanks for the clarification.

-- Lewin A.R.W. Edwards (http://www.zws.com/) Learn how to develop high-end embedded systems on a tight budget! http://www.amazon.com/exec/obidos/ASIN/0750676094/zws-20

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required