Problem using avrdude 6.0.x to program 9x/9xr

Help with any software/desktop related issues. e.g. companion9x, eePe, etc
Post Reply
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Problem using avrdude 6.0.x to program 9x/9xr

Post by rperkins »

Hi

Has anyone tried to use avrdude 6.0.x to program their radios? I am getting mismatch errors trying to load er9x.hex into a 9x/9xr using avrdude 6. Thanks for any insight on this issue.

summary of avrdude output. complete output at end of post. The mismatch repeats every 0x100 bytes

Code: Select all

avrdude: verification error, first mismatch at byte 0x0100
         0xff != 0x3d
Why use avrdude 6 ?
  1. avrdude 6 has been released as of this post. It is not beta software
    http://savannah.nongnu.org/forum/forum. ... um_id=7719
  2. I am working on a bootable .iso that has open source RC tools on it. Mainly to help users on win8/win7 that have trouble installing usbasp drivers. the KKmulitcopter flash tool is one of the apps I plan on including and that tool has already been using avrdude 6 because of the additional programmers it supports
Affected versions of avrdude
  1. Using the latest svn of avrdude -r 1275
  2. I have also tried the tagged release of svn://svn.sv.gnu.org/avrdude/tags/RELEASE_6_0_1
  3. I have compiled on 64bit Fedora19 and TinyCore 4.7.7
  4. Have also used the avrdude binaries (6.0.1) compiled by kkmulticopter flash tool at http://lazyzero.de/en/modellbau/kkmulticopterflashtool
Hex files used for testing
  1. er9x.hex rev 809 as downloaded through eepe. attached here
  2. er9x.hex rev 809 in a 32 byte format. attached here
    • created by uploading file to target(tx) using avrdude 5.11
      then read the data back to file .
    • avrdude uses 32 byte format to store data read from target (tx)
    • this file made it possible to to a diff of the mismatch to highlight the pattern of mismatch
Hardware considerations
  1. Can repeatedly successfully write hexfile using avrdude 5.11 and repeatedly fails in a consistent manner using avrdude 6.0.x utilizing the same hardware
  2. Programmers
    • usbasp with stock 2011 firmware binary supplied from http://www.fischl.de/usbasp/ .
    • usbasp with modified 2009 usbasp firmware in popular use on this forum.
    • My first fear was a change in avrdude that didnt work with the modified 2009 usbasp firmware. I dont think that is the case as I loaded stock 2011 usbasp firmware and got the same results.
  3. Targets
    • Turnigy 9x with m64 mcu
    • Turnigy 9xr with m64 mcu
Other observations
  1. I want to post this here before reporting on the avrdude-devel mailing list as I am probably overlooking something
  2. I can use avrdude 6 to program smaller target like m328 or m8 without an issue
  3. If anyone knows a good editor , byte length converter for intel hex files, please let me know. Linux, shell script, windows, whatever.
  4. avrdude 6 is coming and I would like to get to the bottom of this now. Am especially worried about the patched 2009 usbasp firmware not working in avrdude 6. I ship that firmware on my usbasp's

Details of recurring mismatch
  1. every 0x100 bytes 0x10 bytes are at FF
  2. My asssumption is these bytes are not being written after a chip/page erase
  3. output of head -n 40 avrdude_6_failed_write_m64.diff follows
  4. entire diff of error is attached as avrdude_6_failed_write_m64.diff
This error pattern repeats for the entire hex file. see attached file

Code: Select all

--- er9x_32byte_format.hex	2014-02-10 18:57:04.211676270 -0500
+++ er9x_32byte_avrdude_6_failed_write.hex	2014-02-10 18:59:24.148587317 -0500
@@ -9 +9 @@
-:200100003D663F66416646664A6656665A66626669666D666F6673667566776679667D6686
+:20010000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF69666D666F6673667566776679667D6625
@@ -17 +17 @@
-:200200007920746F20736B697000032D2D2D783E30783C307C787C663E30663C307C667CC3
+:20020000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF30783C307C787C663E30663C307C667C66
@@ -25 +25 @@
-:200300004348313343483134434831354348313633504F5347563120475632204756332029
+:20030000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF33504F53475631204756322047563320FB
@@ -33 +33 @@
-:2004000000000000000000000000000000000000000000000000000000000080C0E0E0F0EC
+:20040000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000080C0E0E0F0FC
@@ -41 +41 @@
-:2005000031313171616161E1C1C1C18100000080E0F8FCFFFFFFFF2F170F038180C0E0F0D6
+:20050000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0F8FCFFFFFFFF2F170F038180C0E0F032
@@ -49 +49 @@
-:20060000000000000000000000000000000000000101010101030707070301000000E0FCDD
+:20060000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0101010101030707070301000000E0FCED
@@ -57 +57 @@
-:2007000000000000000000000000000000000000000000000000000000C0F8BFFFFFFF1F46
+:20070000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000C0F8BFFFFFFF1F56
@@ -65 +65 @@
-:200800003A2032322E30312E3230313400564552533A2056312E3130342D4D696B650022DD
+:20080000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF533A2056312E3130342D4D696B6500221C
@@ -73 +73 @@
-:20090000004D656D6F7279205761726E696E670044656661756C74205377005468726F74A8
+:20090000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF44656661756C74205377005468726F7427
@@ -81 +81 @@
-:200A00006B657220506974636800566F6C756D65000A4265657065722020202050695370AB
+:200A0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000A42656570657220202020506953708D
@@ -89 +89 @@
-:200B0000204578697420446F776E20202055705269676874204C656674004449414700126E
+:200B0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF69676874204C6566740044494147001267
@@ -97 +97 @@
-:200C000072696D7300537769746368000003464C204D4F444500015245544100032D2D2D16
+:200C0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF204D4F444500015245544100032D2D2DE8
@@ -105 +105 @@
-:200D0000203843482031304348313243483134434831364348001375530011755365630098

complete avrdude output of mismatch

Code: Select all

./avrdude -C ./avrdude.conf -c usbasp -p m64 -U flash:w:/home/rperkins/src/eepe-read-only/er9x.hex:i

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9602
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 "/home/rperkins/src/eepe-read-only/er9x.hex"
avrdude: writing flash (54410 bytes):

Writing | ################################################## | 100% 17.48s

avrdude: 54410 bytes of flash written
avrdude: verifying flash memory against /home/rperkins/src/eepe-read-only/er9x.hex:
avrdude: load data flash data from input file /home/rperkins/src/eepe-read-only/er9x.hex:
avrdude: input file /home/rperkins/src/eepe-read-only/er9x.hex contains 54410 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 9.80s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0100
         0xff != 0x3d
avrdude: verification error; content mismatch

avrdude: safemode: Fuses OK (E:FF, H:C9, L:0E)

avrdude done.  Thank you.
Attachments
avrdude_6_failed_write_m64.diff
diff -u0 er9x_32byte_format.hex er9x_32byte_avrdude_6_failed_write.hex
(35.48 KiB) Downloaded 681 times
er9x_32byte_format.hex
er9x rev 809 in 32 byte record format
(126.21 KiB) Downloaded 728 times
er9x.hex
er9x rev 809
(149.47 KiB) Downloaded 696 times

User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Problem using avrdude 6.0.x to program 9x/9xr

Post by rperkins »

Tried to flash opentx using avrdude 6 and got a similar error.

It flashed fine using avrdude 5.11. Can even verify the flash using avrdude 6.
Just can not write flash using avrdude 6.

I looked at the m64 sections of the avrdude.conf files for both versions of avrdude. Didnt see anything jump out at me as different.

attached the opentx hex file that failed to flash to target using avrdude 6
Attachments
opentx-9x-heli-templates-en.hex
opentx-9x-heli-templates-en=2940
(142.26 KiB) Downloaded 713 times
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Problem using avrdude 6.0.x to program 9x/9xr

Post by rperkins »

This was posted on the avrdude-devel mailing list and has been reported as a possible bug affectinglinux versions of avrdude 6 only

https://savannah.nongnu.org/bugs/index.php?41561
http://lists.nongnu.org/archive/html/av ... 00007.html

I have also compiled avrdude 5.11 on the same build environment ( Fedora 19) and verified that 5.11 compiles and does not show this error
Last edited by rperkins on Wed Dec 17, 2014 1:48 am, edited 1 time in total.
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Problem using avrdude 6.0.x to program 9x/9xr

Post by rperkins »

Please upvote this bug within avrdude
https://savannah.nongnu.org/bugs/?41561#votes
User avatar
Kilrah
Posts: 11107
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Problem using avrdude 6.0.x to program 9x/9xr

Post by Kilrah »

Isn't 7 out now?

User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Problem using avrdude 6.0.x to program 9x/9xr

Post by rperkins »

no
avrdude 6.x was released Tue 17 Sep 2013. Linux distros are distributing it now.
https://savannah.nongnu.org/forum/forum ... um_id=7719

The good news for windows users is Eepe and companion are still using 5.x versions
https://code.google.com/p/eepe/source/b ... essentials
https://github.com/opentx/opentx/tree/n ... ts/windows
User avatar
Kilrah
Posts: 11107
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Problem using avrdude 6.0.x to program 9x/9xr

Post by Kilrah »

Ah yes sorry it's dfu-util that got updated.
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Problem using avrdude 6.0.x to program 9x/9xr

Post by rperkins »

This issue has been confirmed
It has been resolved in avrdude rev1343
Many thanks to joerg_wunsch for his work on our behalf

My next steps will be to check into reporting some bugs on linux distros and creating some .debs to assist users in the interim . If you need something along this line just contact me

taken from http://svn.savannah.nongnu.org/viewvc/t ... e&view=log

bug #41561: AVRDUDE 6.0.1/USBasp doesn't write first bytes of
flash page
* usbasp.c (usbasp_spi_paged_write): Remove USBASP_BLOCKFLAG_LAST.
It is no longer needed, as we always write full pages now in paged
write mode.

This prevents each flash page from being written twice, where the
second attempt on older devices (ATmega64/128) signalled an immediate
"ready" condition when polling (likely a silicon bug) even though they
were still in progress. This caused the USBasp firmware to proceed,
and fill the page buffer anew which eventually caused the data
corruption.
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Problem using avrdude 6.0.x to program 9x/9xr

Post by rperkins »

Here is an updated .deb file for Ubuntu that fixes this bug. It is for a 64 bit install.
The build was on Ubuntu 14.04.1 LTS.
I could probably make a 32 bit and maybe even some Redhat /Fedora builds if requested.
A windows or Mac build would be stretching it for me though :)
I used this guide to create the .deb
http://www.guyrutenberg.com/2011/12/17/ ... d-version/

The forum wouldnt accept a .deb extension. So I zipped up a .deb and feel foolish for doing so
avrdude_6.1+svn1343_amd64.deb.zip
latest avrdude svn which fixes usbasp bug. needs unzipped
(254.65 KiB) Downloaded 450 times
2m0ybr
Posts: 1
Joined: Tue Apr 07, 2015 10:05 am
Country: -

Re: Problem using avrdude 6.0.x to program 9x/9xr

Post by 2m0ybr »

Hi, I'm new to the forum and er9x/eepe. I was having the same problem and found this post. I am running Linux Mint (based on Ubuntu 14.04) and to update avrdude to 6.1 I followed the instructions on this page.

Install avrdude using a ppa

I hope this helps someone else, just another option to update avrdude if you are having this problem on a Ubuntu based distro.

Cheers,

Greg
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Problem using avrdude 6.0.x to program 9x/9xr

Post by rperkins »

avrdude 6.2 has been released. This is the first release within the 6.x series of avrdude that does not have this bug. versions 5.11.x is good for 9x/x9r programming also.

http://lists.nongnu.org/archive/html/av ... 00015.html

Thanks to Joerg Wunsch for chasing down this bug, fixing it, and releasing a new version of avrdude

Post Reply

Return to “Software”