Possible error in Stk500protocol

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
lcoenegr

Possible error in Stk500protocol

Post by lcoenegr » Wed May 14, 2008 4:39 pm

I tried to build a minimal version of AVR-Doper. Everything works fine till the applications become bigger. A certain combination of characters in the hex-file causes the programmer to crash in CDC-mode (integrated in avr-studio. When i put a couple of bytes extra in the hex-file everything works fine.

The same hex-file programs fine using AVRdude in HID-mode.
If necessary, I can send you the hex file causing the programmer to crash.

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Thu May 15, 2008 2:56 pm

Did you try this on a different host? CDC mode may be unreliable, depending on MANY factors. The data length and content may be one of them.

If you can reproduce this with a USB 2.0 hub inserted and with a different host, then please send us the offending hex file to the feedback address.

Guest

Post by Guest » Fri May 16, 2008 10:01 am

Every host i try has the same problem. When I let avrstudio log what's happening I get the following result (excerpt of the last few lines).

Sending packet 05/16/2008 09:35:16.868
(5000ms) > 1B 1B 00 4A 0E
(5000ms) > 13 00 40 A1 0A 40 4C 20 FF 00 40 00 40 00 FE 1F
> FE 1F FE 1F FE 1F 00 0E 00 1E 00 10 00 10 00 10
> FE 1F FE 0F FE 1F FE 1F E0 00 B0 01 18 03 0C 06
> 06 0C 02 18 00 10 FE 1F FE 1F 00 10 00 10 00 10
> 00 10 00 10 00 10 FE 1F FE 1F
(5000ms) > 3F
Sequence number 27, message size 74, checksum 63
CMD_PROGRAM_FLASH_ISP

Receiving packet 05/16/2008 09:35:17.879
(5000ms) (expected 5 more bytes but timed out)
Sequence number n/a, message size n/a, checksum n/a
No data in packet
Returned status: Client: Total timeout exceeded (PC side gave up)

Sending packet 05/16/2008 09:35:22.887
(1000ms) > 1B 1C 00 03 0E
(1000ms) > 11 01 01
(1000ms) > 1B
Sequence number 28, message size 3, checksum 27
CMD_LEAVE_PROGMODE_ISP

Receiving packet 05/16/2008 09:35:25.891
(1000ms) (Error number: 128692)
(expected 5 more bytes but timed out)
Sequence number n/a, message size n/a, checksum n/a
No data in packet
Returned status: Client: Total timeout exceeded (PC side gave up)
Port closed
Returned status: Command succeeded


When I use a port monitor to spy what's going on in the communication, I get a the following response
Status $C00000001
as the reply on the data of packet with sequencenumber $1B

Guest

Possible error in stk-protocol

Post by Guest » Fri May 16, 2008 3:17 pm

Dear,
It is not a problem with the STK-protocol, but a timing problem in the code for 16MHz. I tried exactly the same hardware, but compiled for 12 MHz and that works fine.

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Tue Jun 10, 2008 8:28 pm

OK, I finally had the time to try this myself. It works well with my computer (a Macbook Pro) and as you reported, it depends on the AVR's clock rate.

The problem is therefore very likely not an implementation bug in AVR-Doper, but the well known reliability problem of CDC mode.

It's still not known whether the transmission errors in CDC mode are caused by a driver bug or by communication errors. Anybody who captures a USB trace of such an error is welcome to submit it to us (obdev). See http://forums.obdev.at/viewtopic.php?t=1360&start=15 for an example. This example reveals a problem on the host side, though, not in our driver.

Post Reply