EmbeddedRelated.com
Forums

using STK500 to program Atiny12

Started by Koon August 10, 2004
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.
In comp.arch.embedded,
Koon <feilip@yahoo.com> wrote:
>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: >
For re-programming, you must first erase the device. That can be done automatically by checking the "erase before program" checkbox.
>Entering programming mode: Failed > >Would you pls tell me how to solve this problem? Thanks.
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.
"Koon" <feilip@yahoo.com> wrote in message
news:a704261c.0408100630.624466d0@posting.google.com...
> 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
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
> I am using the STK500 to program Atiny12. I have done the following: > I am able to program the microprocessor once but when I try to > re-program it, I got the following error:
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
> 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?
Did you connect both XTAL1 and XTAL2? I don't know, because I haven't used that option and don't have the docs in front of me, but I _think_ that the xtal socket on the STK500 is passively connected to the device sockets, in which case you need to use the xtal amp on the AVR chip being programmed.
> 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?
No. The fuse bits disable use of those pins as GPIOs.
> 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?
"The internal RC oscillator option is an on-chip oscillator running at a fixed frequency of 1 MHz in ATtiny11 and 1.2 MHz in ATtiny12." The OSCCAL reg is designed to trim the internal oscillator to that nominal speed. $FF can give you a value from 1.2MHz to 2.5MHz depending on the individual chip. The correct calibration byte to bring your specific chip to 1.2MHz is available in the signature area.
"Lewin A.R.W. Edwards" wrote:
> [...] I _think_ that the xtal socket on the STK500 > is passively connected to the device sockets, in > which case you need to use the xtal amp on the AVR > chip being programmed.
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. "
Richard wrote:

> "Lewin A.R.W. Edwards" wrote: > > [...] I _think_ that the xtal socket on the STK500 > > is passively connected to the device sockets, in > > The xtal socket on the STK500 drives an oscillator circuit that connects
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