Author Topic: Flashing from Linux  (Read 382 times)

Flashing from Linux

« on: April 19, 2017, 04:37:34 AM »
Open quickbuttons

ToyKeeper

Posts: 5

Offline
  • *
  • Newbie
    • View Profile
Hi, just wondering if anyone has flashed an Atmegatron from Linux?

I figure I can do it with avrdude if I find the right options to specify the programmer and port, shouldn't be much different than when I flash attiny chips.  I haven't used a FTDI cable like this before though, so it might take me a bit to get it to communicate.

Re: Flashing from Linux

« Reply #1 on: April 19, 2017, 09:59:04 PM »
Open quickbuttons

paulsoulsby

Posts: 171

Offline
  • Administrator
  • *****
  • Full Member
    • View Profile
Ooh you're the first person to ask about Linux! Easy Uploader is written in Qt and I know that can create Linux executables.  I just don't have a Linux boot to install Qt onto to create the file. I'll look into it once I'm back from Superbooth.
Paul

Re: Flashing from Linux

« Reply #2 on: April 20, 2017, 05:27:38 AM »
Open quickbuttons

ToyKeeper

Posts: 5

Offline
  • *
  • Newbie
    • View Profile
After a little experimenting, I found the right options to use.  I had thought it needed a USB-specific device, since "arduino" is configured as a legacy serial device while "arduino-ft232r" seemed more appropriate for this TTL-232R cable, but here is what actually worked:

Code: [Select]
avrdude -c arduino -P /dev/ttyUSB0 -p m328p -Uflash:w:atmegatron_2.4/AtmegatronV2-4.hex:i
I also had to experiment a little to discover that the atmegatron actually needs to be connected to its normal power supply in order to flash.  On my other devices, the only power at flash time comes from the flashing cable itself.

No special drivers or anything are needed.  Just avrdude.  This was in debian/testing with "apt install avrdude".  I may also have other relevant stuff installed since I use other little Atmel chips regularly, but I don't think any of the other packages are relevant for merely swapping firmware on the atmegatron.

To install factory presets, avrdude has other options to read/write eeprom.  I'll figure that out later.  :)

Re: Flashing from Linux

« Reply #3 on: April 22, 2017, 06:15:39 AM »
Open quickbuttons

paulsoulsby

Posts: 171

Offline
  • Administrator
  • *****
  • Full Member
    • View Profile
Yes, the 5V rail from the FTDI to the Atmegatron is cut.  I didn't fancy the USB cable trying to power all those LEDs!!  It might draw too much current from the USB.

AVRDUDE command line looks correct.  That's all Easy Uploader is doing via a graphical interface.

The EEPROM read and writes is harder.  The Atmegatron uses the Arduino Optiboot bootloader. This has no implementation for those AVRDUDE EEPROM commands to save space.  So the way that Easy Uploader does it is to:
  • Read a copy of the flash and save to a temp .hex
  • Write a serial->Eeprom .hex application
  • Receive the Eeprom data via serial and write to Eeprom
  • Write the original software from the temp .hex file back into flash
So quite a process!! 
I will look into compiling Easy Uploader for Linux once I'm back from Superbooth.