SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on the software and hardware for Atmel's STK standard.
By dwrenne

I bought a few 20 pin tiny2313 and few mega168 (28 pin) processors, the corresponding olimex boards and both a usb jtag programmer and an isp programmer from sparkfun ... ucts_id=12 ... ucts_id=14

I have used avrstudio 4, bascom avr and ponyprog and none of them recognise the chips or boards or give any indication that there is anything on the cable. I am using the serial programmer as the olimex borads do not have a JTAG interface.
Is there some voodo that I have to do. Are there ANY step by step instructions other than a brezzy "works with ponyprog".
Should I buy an stk500 or would that not help?


Last edited by dwrenne on Mon Dec 11, 2006 3:49 pm, edited 1 time in total.
By dwrenne

Actually I lie. I just tried it again with ponyprog , the 20 pin board with a tiny2313 and the power LED dimmed a few times in a second. so the software is seeing the board but thows up a "device missing or unknown device (-24)" error.

Hoping this helps

By stevech
one of the folks on forum will know
By dwrenne

David Carne of Sparkfun sorted this for me. I used avrdude.exe in winavr (not the gui) and the following
C:\WinAVR\bin>"avrdude" -p attiny2313 -c ponyser -P com6 -U flash:w:"C:\blinky\blinky.hex":a -U flash:v:"C:\blinky\blinky.hex":a

The critical thing here is the programmer is ponyser. Also the 20 pin board would not program with the LED jumper connected. I used the Blinky.c program and the make file from WINAVR, copied them to c:\blinky, renamed the files to be all lower case, and modified the make file to reference the blinky.c file. I modified blinky.c to look like this
Code: Select all
// Blinky.c
#include <avr/io.h>
#include <avr/delay.h>
int main (void)
// set PORTD for output
DDRB = 0xFF;
while(1) {
for(int i = 1; i <= 128; i = i*2)
PORTB = i;
for(int i = 128; i > 1; i -= i/2)
PORTB = i;
return 1;
so that it uses port B.

Make looked like this
Code: Select all
# MCU name
MCU = attiny2313

# Processor frequency.
#     This will define a symbol, F_CPU, in all source code files equal to the 
#     processor frequency. You can then use this symbol in your source code to 
#     calculate timings. Do NOT tack on a 'UL' at the end, this will be done
#     automatically to create a 32-bit value in your source code.
#     Typical values are:
#         F_CPU =  1000000
#         F_CPU =  1843200
#         F_CPU =  2000000
#         F_CPU =  3686400
#         F_CPU =  4000000
#         F_CPU =  7372800
#         F_CPU =  8000000
#         F_CPU = 11059200
#         F_CPU = 14745600
#         F_CPU = 16000000
#         F_CPU = 18432000
#         F_CPU = 20000000
F_CPU = 10000000

# Output format. (can be srec, ihex, binary)
FORMAT = ihex

# Target file name (without extension).
TARGET = blinky

# Object files directory
OBJDIR = obj

# List C source files here. (C dependencies are automatically generated.)
SRC = blinky.c
The blinky.c reference in the makefile was not in the file as it came from winavr examples. That took me a bit to figure out.

Changing the code and make file for the mega168 worked fine but the led port in C (AFAICR). make runs in under a second. The programming takes a few minutes. I am using a comfile FBID based usb to serial converter , and it works fine.
Notice that I am using com6. When connected first, the virtual com port was number 30 something so I forced that to com6 in XP control panel.

Thanks again to Dave


By dwrenne
I have started using Bascom-avr to see how that is and it allows an external programmer to be used

3. Open Bascom AVR
4. Click Options>>Programmer
5. Select "External programmer" in Programmer
6. Browse to C:\winavr\bin\avrdude.exe in Program
7. Enter -p attiny2313 -c ponyser -P com6 -U flash:w:"{FILE}":a in Parameter
8. Enable 'Use HEX file'

Change as appropriate for your processor and com port