Author Topic: avrdude  (Read 22779 times)

Offline fphil

  • Sr. Member
  • ****
  • Posts: 398
  • BHP: 6
avrdude
« on: June 15, 2014, 10:26:43 am »
Mattias has written a very useful explanation for the replacement of the AVR bootloader. To burn the fuses it is said to use avrdude and the // port or ISP cable.
I intended to do it with my Dell latitude (MY90 under NT4) which has a // port
What then the avdude.exe or Atmel programmer to install? I would to like to move things on the Dell as few as possible (no internet)  and there is no much space left on the disk. .
There is no MSDOS version of avrdude and WinAVR is quite big. I tried the mingw version which does not run because the hid.dll missing. Strande enough I got avrdude on the other computer where VT is installed.
Thanks for hints
Philippe

Offline VEMS

  • Administrator
  • Sr. Member
  • *****
  • Posts: 487
  • BHP: 22
Re: avrdude
« Reply #1 on: June 15, 2014, 10:46:44 am »
Hello Phil,

I have elaborated a bit on which software version(s) to use on the bootloader upgrade page, see: http://vems.hu/vt/help/v3/general/bootloader_upgrade.html.
If you have any further questions, feel free to ask.

Best regards, Dave

Offline fphil

  • Sr. Member
  • ****
  • Posts: 398
  • BHP: 6
Re: avrdude
« Reply #2 on: June 16, 2014, 07:29:30 pm »
Thanks Dave. I am going to buy a cable.
When you say to download avrdude 6.1, what version ? I do not find a windows version. Do we have to run the unix version under using cgwin?
Philippe

Offline VEMS

  • Administrator
  • Sr. Member
  • *****
  • Posts: 487
  • BHP: 22
Re: avrdude
« Reply #3 on: June 16, 2014, 09:14:35 pm »
Hi Phil,

The Avrdude 6.1 in the bootloader_upgrade.html page is a clickable link to: http://download.savannah.gnu.org/releases/avrdude/avrdude-6.1-mingw32.zip
Which contains the mingw32 version of avrdude, this runs on Windows (tested personally on Windows 7) from command prompt.

Best regards, Dave

Offline fphil

  • Sr. Member
  • ****
  • Posts: 398
  • BHP: 6
Re: avrdude
« Reply #4 on: August 09, 2014, 11:21:39 pm »
Hi,

avrdude failed writing 0x3C in the lock register, after (silly?) attempts I end up with lock bits being 0x00 (terminal says d lock 0000 00).

Following the doc, the lock bits are now programmed and there is no more write or read access to memory. However I can still dump part of the flash memory  (d flash 0 16) ?? I am confused.

Is the only possibility left is to erase the chip?. But what next?
Thanks for your hints

Philippe

Hereafter part of the avrdude log

avrdude: Version 6.1, compiled on Mar 13 2014 at 00:09:49
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\avrdude\avrdude.conf"

         Using Port                    : usb
         Using Programmer              : usbasp
avrdude: seen device from vendor ->www.fischl.de<-
avrdude: seen product ->USBasp<-
         AVR Part                      : ATmega128
         Chip Erase delay              : 9000 us
......
avrdude: verifying efuse memory against 0xff:
avrdude: load data efuse data from input file 0xff:
avrdude: input file 0xff contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: reading input file "0x3c"
avrdude: writing lock (1 bytes):

Writing |  ***failed; 
################################################## | 100% 0.08s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3c:
avrdude: load data lock data from input file 0x3c:
avrdude: input file 0x3c contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0x00 != 0x3c
avrdude: verification error; content mismatch

avrdude: safemode: lfuse reads as 2F
avrdude: safemode: hfuse reads as C4
avrdude: safemode: efuse reads as FF
avrdude: safemode: Fuses OK (E:FF, H:C4, L:2F)

avrdude done.  Thank you.

Offline VEMS

  • Administrator
  • Sr. Member
  • *****
  • Posts: 487
  • BHP: 22
Re: avrdude
« Reply #5 on: August 11, 2014, 10:14:02 am »
Hello Phil,

Exactly what command did you issue to get the result listed above ?

Best regards, Dave

Offline fphil

  • Sr. Member
  • ****
  • Posts: 398
  • BHP: 6
Re: avrdude
« Reply #6 on: August 11, 2014, 11:29:03 am »
Hi Dave

Thanks for your concern

avrdude -c usbasp -p m128 -U lfuse:w:0x2f:m -U hfuse:w:0xc4:m -U efuse:w:0xff:m -U lock:w:0x3c:m -v

At the first try  I had a write error ofr the lock register (fuses write are ok) message and a verify which says that lock register is 0x2c.

I tried several times to write 0x3C, always with error in writing and a verify which says that the lock value is 0x2C. Then I tried other values to write on and I always got writing errors.

I realized afterwards that the values are masked before being written and my silly play ends up with lock = 0x00 .
To be sure of that value I entered terminal mode and indeed "avrdude>dump lock " returns 0000 00.

Regards

Philippe

Offline mads b (dk)

  • Full Member
  • ***
  • Posts: 125
  • BHP: 4
Re: avrdude
« Reply #7 on: August 11, 2014, 12:11:09 pm »
Are you using a usb ISP cable ? This part of the string is only if you use usb   "usbasp"

Vw beach buggy 1.6 VNT turbo, Vems 3.1 no. 57

Offline fphil

  • Sr. Member
  • ****
  • Posts: 398
  • BHP: 6
Re: avrdude
« Reply #8 on: August 11, 2014, 02:13:46 pm »
yes, I am using an usbasp cable and driver;

btw avrdude.conf gives the masks avrdude uses for writing or reading :

memory "lock"
        size            = 1;
        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
                          "x x x x  x x x x   x x o o  o o o o";

        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
                          "x x x x  x x x x   1 1 i i  i i i i";

Avrdude with this configuration masks out bit 6 and 7 and I wrong in believing that the lock register is cleared.
It remains that avrdude returns bits 0-5 = 00 000 . I do not know why.
« Last Edit: August 11, 2014, 02:42:14 pm by fphil »

Offline VEMS

  • Administrator
  • Sr. Member
  • *****
  • Posts: 487
  • BHP: 22
Re: avrdude
« Reply #9 on: August 11, 2014, 04:28:05 pm »
Hi Phil,

Have you tried to initiate the bootloader upgrade procedure though VT  ? If so what is the message ?
Btw avrdude mask out top 2 bits of lock register because these don't have any function.

Best regards, Dave


Offline fphil

  • Sr. Member
  • ****
  • Posts: 398
  • BHP: 6
Re: avrdude
« Reply #10 on: August 12, 2014, 11:35:43 am »
Hello Dave,

Sorry for the delay to answer (waiting for my usb cable)

When connecting I get
"BootLoader Mode detected ...
 Stay reason unknown (0x71)"

What shall I do next? Whall I stay in the mode an upload a fw?

Regards

Philippe

Offline VEMS

  • Administrator
  • Sr. Member
  • *****
  • Posts: 487
  • BHP: 22
Re: avrdude
« Reply #11 on: August 12, 2014, 12:48:20 pm »
Hello Phil,

Follow the steps outlined on: http://vems.hu/vt/help/v3/general/bootloader_upgrade.html

1) upload 1.1.94_BootUpdate firmware (VT -> firmware -> firmware upload (not wizard) -> choose 1.1.94_BootUpdate)
2) start VT->firmware -> bootupgrade wizard

Please post its response here, if upgrade success that would be nice; If there is a problem we'll work from there.

Best regards, Dave

Offline fphil

  • Sr. Member
  • ****
  • Posts: 398
  • BHP: 6
Re: avrdude
« Reply #12 on: August 12, 2014, 07:24:30 pm »
Hello Dave,

1) Upload 1.1.94_BootUpdate firmware. I got the following widgets in order
- "Ecu Flash upload progress" -> good went to the end
- "Firmware verify" -> "Firmware verify has been finished. Results: Firmware different"
- "V3 detected with serial number 0. Please add number" I put 322 my serial number
- V3 main window fw 1.2.17, run ok with trigger tool input, serial number is 322-0 not 322-322 as before

2) I then went to "FBootloader upgrade" I got
- "you nedd bootlaoder upgrade"
- "firmware capable for bootloader NO"
- "you have to download newer firmwaree

Tried several time ->"Firmware verify " failed as well but I did not get the message "V3 detected with serial number 0" these times.

Tried to upload 1.2.11 fw, "Firmware verify " failed as well.

I understand that there is no write access to the chip?

Regards Philippe

Offline VEMS

  • Administrator
  • Sr. Member
  • *****
  • Posts: 487
  • BHP: 22
Re: avrdude
« Reply #13 on: August 13, 2014, 10:48:27 am »
Hello Phil,

When i was reviewing your applied lock=0x2C i suspected this as well. The applied lock (0x2C instead of 0x3c) does not allow further programming of the flash.

Unfortunately the only way to resolve this is to do a full chip erase and then upload bootloader (nhex again), we will prepare a package for you that has the required files, will get back to you in a few hours with link.

After downloading the required files follow steps from: http://www.vems.hu/wiki/index.php?page=MembersPage/MattiasSandgren/NickesBMW/AvrBootCode

Best regards, Dave


Offline fphil

  • Sr. Member
  • ****
  • Posts: 398
  • BHP: 6
Re: avrdude
« Reply #14 on: August 13, 2014, 01:19:31 pm »
Thanks Dave for your help. I sent a message to your box in case you like to use my private mail. Philippe