Page 1 of 1

Help, unable to program and verify

Posted: Mon Sep 08, 2008 9:04 am
by snookie
Anytime I download a program that is bigger than some unknown size, I always get a timeout error. I'm using an STK500 with a USB to serial convertor (GUC232A from iogear).

Here is a sample output:

Snookie$ avrdude -c stk500v2 -P /dev/cu.PL2303-0B2 -p m32 -b 115200 -U flash:w:main.hex:i

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.10s

avrdude: Device signature = 0x1e9502
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "main.hex"
avrdude: writing flash (8016 bytes):

Writing | ################################################## | 100% 52.37s

avrdude: 8016 bytes of flash written
avrdude: verifying flash memory against main.hex:
avrdude: load data flash data from input file main.hex:
avrdude: input file main.hex contains 8016 bytes
avrdude: reading on-chip flash data:

Reading | | 0% 0.00savrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
Reading | ## | 3% 12.04savrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
Reading | ### | 6% 24.07savrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
Reading | ##### | 9% 36.10savrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
Reading | ###### | 12% 48.13savrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
Reading | ######## | 15% 60.17savrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
Reading | ########## | 19% 72.20savrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
Reading | ########### | 22% 87.55savrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
Reading | ############# | 25% 99.58s^C

I'm extremely frustrated. Also, programming is extremely slow, much slower than windows ever was. I can say with confidence that despite the inability to verify, the program doesn't seem to work.

If I program the ucontroller with a simple app, blink LED's. It works (download, verification, and runtime)

I also played with the fuses as I saw in some threads it could be that, but I tried everything.

Thanks.

Snookie

Solution

Posted: Wed Sep 10, 2008 8:16 am
by snookie
I found the answer on the avrdude forums. Absolutely ridiculous.

You have to go into the avrdude terminal. avrdude -t

Then you have to set the bit period. The bit period is the time of one clock cycle. Since all the stk500's in unix use 115200, it's one over that. 1/f = period. So one over that is 8.67 us.

That also fixed the download speed too.

You'd think the software would be smart enough to do the math itself and fix it.... Anyways, hope this helps all the other people having trouble with this.

If I find the website of the original answer, I'll post it here.

Thanks,
Snookie