bugAVR Downloader/UploaDEr - Bugs: bug #27254, Cannot program ATXMega with...


You are not allowed to post comments on this tracker with your current authentication level.

bug #27254: Cannot program ATXMega with AVRDUDE using AVR911 AVROSP mode

Submitter:  Priyend Somaroo <priyend>
Submitted:  Fri 14 Aug 2009 09:45:29 PM UTC
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  None Privacy:  Public
Assigned to:  None Originator Name:  Priyend
Open/Closed:  Open Release:  None
Programmer hardware:  Device type: 

Jump to the original submission

Fri 21 Aug 2009 04:13:31 AM UTC, comment #13: 

> I wonder if AVRDUDE uses a customised serial port
> driver of its own and that may the issue.

AVRDUDE uses whatever your operating system refers to as "com8".
It just opens the port, and uses it, it doesn't have the
slightest idea about the underlying hardware or OS driver.

Joerg Wunsch <joerg_wunsch>
Group administrator
Thu 20 Aug 2009 09:45:16 PM UTC, comment #12: 

Hi Klaus

I have just completed tests with the clock set to 32MHz and to 11059200 Hz external clock and the same problem occurs; AVROSP works @115200bps while AVRDUDE does not!

Configuration for baud rate is correct. I am able to transfer 1MByte of data with no errors.

I wonder if AVRDUDE uses a customised serial port driver of its own and that may the issue.

By the way I am using M$ Window$ as my OS. I have not tested the issue with Linux to see if it exists in Linux. I will have to test that at some point when I get a chance.

Best regards

Priyend Somaroo <priyend>
Thu 20 Aug 2009 04:50:01 PM UTC, comment #11: 

Hi Priyend,

AVR1065 was the software that I used for my tests, but I did the Baudrate selection by my own (and used a ATMega16 instead) with a baudrate chrystal (7,3728 MHz). And sure, this is the right bootloader software for avr911.

This Baudrate calc:

shows the different Register settings and the resulting errors for the selected baudrate and chrystal. May be a good idea to double check with your configuration.

Good luck,

Klaus Leidinger <kllei>
Thu 20 Aug 2009 08:48:20 AM UTC, comment #10: 

Hi Klaus

I will try different clock speeds and see what happens.

When I drop to below 57600bps, then all works fine with AVRDUDE.
At 57600bps problems start and I get failures around 80% of the time.
At 115200 no programming can be done.
The CPU clock is 2MHz. I will try 32MHz and see if there is a difference.

One thing to note is that I am using the App note AVR1605 which is supposed to be the same as AVR911 but ported to work for the XMega. I wonder if there were problems with the porting from AVR911 to AVR1605. I will check it out and provide feedback as well.

Best regards

Priyend Somaroo <priyend>
Wed 19 Aug 2009 07:09:49 PM UTC, comment #9: 

again me,

I checked avrdude together with a high CPU load (running cpuburn with 100% CPU utilisation) I could see drastically slowing down the terminal output (avrdude -v -v -v -v) but did not loose synchronisation. So the load of the CPU seems not to have impact.


Klaus Leidinger <kllei>
Wed 19 Aug 2009 06:47:22 PM UTC, comment #8: 

Hi Priyend,

I just "ported" the Bootloader to a Mega16 (no Xmega so far) and "simulated" the programming. (throwing away the read bytes instead of writing to flash).

Everything works as expected with V24 direct connect (com1, Motherboard) and with a USB(2) to serial adapter at 115200 baud. I did several tests with no problems.

So one thing I could think is a "loose connection", which sometimes occours, just when testing avrdude. I know, sounds unlikely, but it sounds more unlikely to have a general avrdude transmission problem.

I also used avrdude 5.6 see log attached.
Verification failed, as I did not write anything in real.

At the End is the first part transmitting of your testfile.

Have you tried to slower down to 19200 for example to verify if the problem occours?


(file #18610)

Klaus Leidinger <kllei>
Wed 19 Aug 2009 12:15:24 PM UTC, comment #7: 

Hi All

Well I "spoke" too soon.
The AVRDUDE tool is also unstable at 57600 bps.
It works at that baud rate about 80% of the time.

Best regards

Priyend Somaroo <priyend>
Wed 19 Aug 2009 10:51:49 AM UTC, comment #6: 

Well then I am very confused.

If it is my hardware or o/s then why does AVROSP work without problems but AVRDUDE doesn't?

I would have expected both tools to fail because it the problem is beyond their control.

Priyend Somaroo <priyend>
Wed 19 Aug 2009 10:48:40 AM UTC, comment #5: 

Hardly an AVRDUDE thing, rather of your OS and/or the driver

Note that AVRDUDE has always been using 115200 Bd to talk to
an STK500 without any issues (this baud rate is hardwired
into the STK500 firmware).

Joerg Wunsch <joerg_wunsch>
Group administrator
Wed 19 Aug 2009 10:40:33 AM UTC, comment #4: 

Hi Klaus

I did a test and reduced the baud rate to 57600bps and AVRDUDE now works without problems.
When I set it back to 115200bps, then I get an error.

It seems that AVRDUDE can't keep up with processing at 115200 bps.

Best regards

Priyend Somaroo <priyend>
Wed 19 Aug 2009 10:18:22 AM UTC, comment #3: 

Hi Klaus

Many thanks for the reply.
Sorry for my late response.

1. I am not always using a USB serial adapter, but the built in COM port on my desktop motherboard (COM1) does the same thing. It has more than enough buffering for 115200.
2. I am using the AVROSP at 115200 baudrate and it works perfectly fine.
3. The bytes are correct, it start with 0x0c and does end with 0xbf after 512 bytes.

Do you think that AVRDUDE's timing might be a problem, it may be waiting for a response and the micro might have already sent it through but AVRDUDE may have missed the response?

I have attached the flash file (hex and bin versions) I am using.

Best regards

(file #18605, file #18606)

Priyend Somaroo <priyend>
Sun 16 Aug 2009 06:33:44 AM UTC, comment #2: 

another Question,

which Baudrate did you use for the Test with AVROSP? also 115200?

May be your USB-serial Adapter has not enough buffer for 115200 and 512 Bytes.


Klaus Leidinger <kllei>
Sat 15 Aug 2009 01:49:45 PM UTC, comment #1: 


the number of transmitted bytes is ok, avrdude sends:
B [42] . [02].[00]              F [46]  ; which means
[B]lock [02][00]=0x0200 Bytes  [F] = Flash Memory

the number of bytes transferred after this is 512
(starts with 0x0c, last Byte is 0xbf (whould you please check with the original hexfile?)

So the communication seems OK so far and avrdude is waiting for the response.

Are you able to trace the real traffic on com8? Portmon or "serial port Monitor" available?


Klaus Leidinger <kllei>
Fri 14 Aug 2009 09:45:29 PM UTC, original submission:  


I am able to program my ATXMega128A1 using the AVROSP command line programmer tool from Atmel but cannot program the same device using the AVRDUDE programmer.

I am using ver 5.6 of AVRDUDE.

Erasing the chip using AVRDUDE works properly.

It seems that AVRDUDE is sending the incorrect number of bytes for a 512 block size from the log attached.

Best regards

Priyend Somaroo <priyend>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #18610:  avrdude-log.txt added by kllei (12KiB - text/plain - logfile parts)
file #18605:  flash.hex added by priyend (17KiB - application/octet-stream)
file #18606:  FLASH.BIN added by priyend (6KiB - application/octet-stream)
file #18571:  log.txt added by priyend (11KiB - text/plain)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by joerg_wunsch (Posted a comment)
  • -email is unavailable- added by kllei (Posted a comment)
  • -email is unavailable- added by priyend (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.


    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-08-19 kllei Attached File- Added avrdude-log.txt, #18610
    2009-08-19 priyend Attached File- Added flash.hex, #18605
        Attached File- Added FLASH.BIN, #18606
    2009-08-14 priyend Attached File- Added log.txt, #18571

    Back to the top

    Powered by Savane 3.13-04b1.
    Corresponding source code