Uploading From Linux with avrdude

This forum is for discussing the process of updating the firmware, Please feel free to ask questions about this here, as the process of updating can be a little tricky the first time you do it, and your questions and responses will help others in the future.
Post Reply
jwatson
Posts: 3
Joined: Sat Sep 21, 2019 7:04 am

Uploading From Linux with avrdude

Post by jwatson » Sat Sep 21, 2019 7:17 am

Hello,

I'm looking to upgrade my firmware form 1.5 to 1.6. Recent restrictions at work prevent me from using my (work) Windows laptop to do this as I have done in the past so I was wondering if it's possible to perform the upgrade from my home Linux machine using the avrdude command from the terminal? I'm comfortable using the terminal and can determine some of the parameters but not the -U parameter. If it's possible to use avrdude from the command line, please could you provide an example of the complete command?

Many thanks

James

User avatar
admin
Site Admin
Posts: 179
Joined: Tue Mar 26, 2019 5:17 pm
Contact:

Re: Uploading From Linux with avrdude

Post by admin » Sat Sep 21, 2019 2:43 pm

Hi James,

I haven't done it on LInux, but here's the Avrdude command that the Arduino IDE uses on my Windows machine, which may be of some help:

avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -V -patmega32u4 -cavr109 -PCOM5 -b57600 -D -Uflash:w:C:\Users\Andrew\AppData\Local\Temp\arduino_build_329919/WARBL_1.6.ino.hex:i

You would replace the locations of the avrdude.conf file (probably wherever Avrdude is installed) and the hex file. The other key thing is that Avrdude is looking for an open serial port, but WARBL only opens a serial port when you double-click the programming button (that's because it can't be a class-compliant MIDI device if it keeps extra serial ports open all the time). So, you need to double-click the button just before you run the Avrdude command. Also, you need to know the name of the serial port that WARBL is going to open, so you can put that into the command ahead of time. To do that, you double-click the button first and use whatever tools Linus has to see the name of the new serial port that opens. On Windows you go into the Device Manager and watch the list of USB devices. I suspect Linux has something similar. Then you would take that port name and enter it into the command, double-click the button again, run the command, and cross-your fingers ;).

Hopefully that helps, but I'm happy to do more research if that doesn't work for you.

-A

jwatson
Posts: 3
Joined: Sat Sep 21, 2019 7:04 am

Re: Uploading From Linux with avrdude

Post by jwatson » Sat Sep 21, 2019 5:09 pm

Hello Andrew,

Many thanks for your quick response and help. I've upgraded my Warbl from v1.5 to v1.6 using a laptop running Fedora 30 using the following procedure.

1. Determine the programming port by comparing the output of the command 'ls /dev/' before and after setting the Warbl to programming mode by double-clicking the Warbl's program button.

2. Disable modem services (This may not be required but some online sources indicate that Modem Services can interfere with programming.)

Code: Select all

sudo systemctl stop ModemManager.service
3. Enter the command but don't hit enter just yet (Note the -P and -U parameters will need to be tailored to your own configuration.

Code: Select all

sudo avrdude -v -V -p m32u4 -c avr109 -P /dev/ttyACM1 -b 57600 -D -U flash:w:/home/jwatson/Downloads/WARBL_1.6.ino.hex 
4. Disconnect and reconnect the Warbl and double-click the programming button. Hit 'Enter' in the terminal to start the programming (see screen capture below).
5. Restart modem services.

Code: Select all

sudo systemctl start ModemManager.service
The following shows the output when running the update command;

Code: Select all

[jwatson@localhost ~]$ sudo avrdude -v -V -p m32u4 -c avr109 -P /dev/ttyACM1 -b 57600 -D -U flash:w:/home/jwatson/Downloads/WARBL_1.6.ino.hex 

avrdude: Version 6.3, compiled on Feb 17 2019 at 08:49:25
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/etc/avrdude/avrdude.conf"
         User configuration file is "/root/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM1
         Using Programmer              : avr109
         Overriding Baud Rate          : 57600
         AVR Part                      : ATmega32U4
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  9000  9000 0x00 0x00
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : butterfly
         Description     : Atmel AppNote AVR109 Boot Loader

Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
    Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
    Device code: 0x44

avrdude: devcode selected: 0x44
avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as CB
avrdude: reading input file "/home/jwatson/Downloads/WARBL_1.6.ino.hex"
avrdude: input file /home/jwatson/Downloads/WARBL_1.6.ino.hex auto detected as Intel Hex
avrdude: writing flash (22108 bytes):

Writing | ################################################## | 100% 1.81s

avrdude: 22108 bytes of flash written

avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as CB
avrdude: safemode: Fuses OK (E:CB, H:D8, L:FF)

avrdude done.  Thank you.

[jwatson@localhost ~]$ 

User avatar
admin
Site Admin
Posts: 179
Joined: Tue Mar 26, 2019 5:17 pm
Contact:

Re: Uploading From Linux with avrdude

Post by admin » Sat Sep 21, 2019 5:20 pm

Excellent! Thanks for reporting back with the procedure, and I’m glad it worked!

Post Reply