Author Topic: [HELP] Trying to ISP program a board of mine using AVRdude.  (Read 5815 times)

0 Members and 1 Guest are viewing this topic.

Offline Traveler

  • Thread Starter
  • Posts: 280
[HELP] Trying to ISP program a board of mine using AVRdude.
« on: Wed, 14 March 2018, 14:41:33 »
Edit: Solved! Turns out the standard installation of avrdude doesn't include support for ArduinoISP out of the box. You need to add the lines listed below to your avrdude.conf file.

Code: [Select]
programmer
  id    = "arduinoisp";
  desc  = "Arduino ISP Programmer";
  type  = "usbtiny";
  connection_type = usb;
  usbvid     = 0x2341;
  usbpid     = 0x0049;
;

programmer
  id    = "arduinoisporg";
  desc  = "Arduino ISP Programmer";
  type  = "usbtiny";
  connection_type = usb;
  usbvid     = 0x2A03;
  usbpid     = 0x0049;
;




This is my first time starting a topic, so apologies for any mistakes I make

Alright, might want to grab yourself a drink. This will be a long post. I want to make sure that type down all of the info I've gathered.

So as the title states, I'm looking to do some ISP programming on a board of mine for the first time. It's a UK78 (AT90USB1286 chip) that I accidentally soft bricked by flashing a bad .hex. When I flashed said .hex I immediately got an "unknown device" notification on Windows and the board hasn't worked right since. The computer (usually) recognizes the board but the keys output nothing. The board will go into DFU mode but won't exit DFU mode. When I try to flash a new .hex I get the following:

Code: [Select]
Checking memory from 0x0 to 0x587F... Not blank at 0x1
(here is the full terminal window/steps I get in QMK Toolbox)

From what I've seen people have luck resolving this issue with ISP programming, so that's what I'm going for. I picked up this arduino ISP programmer, some wires, an IDC cable, and some pogo pins. I suck terribly at desoldering, so I'm trying to go for a solderless connection to my board. If I were to solder wires to the AVR connectors I would almost certainly destroy the PCB trying to get the wires out.

Here is an album picturing my connection points. Some of the wires going into the ISP programmer don't look right but they feel secure.

And here is a crude visualization of how I have things set up.

I'm a total n00b at this stuff, so I could have that wired wrong. Anyway, this is about the extent of what I've gotten. I'm trying to use AVRdude in Linux to program the board, but I'm constantly getting errors. I think my command arguments are all wrong. When I try to run the following, or any similar variants:

Code: [Select]
avrdude -c arduino -p usb1286 -v
I get this error:

Code: [Select]
avrdude: usbdev_open(): did not find any USB device "usb" (0x03eb:0x2104)
So I've ran some checks but I'm not sure how to make sense of them. I've ran:

Code: [Select]
tail -f /var/log/syslog
and received the following (Violet is my computer's name) :

Code: [Select]
Mar 13 20:07:20 Voilet kernel: [  204.834066] usb 5-1: New USB device found, idVendor=2a03, idProduct=0049
Mar 13 20:07:20 Voilet kernel: [  204.834069] usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Mar 13 20:07:20 Voilet kernel: [  204.834071] usb 5-1: Product: ArduinoISP 
Mar 13 20:07:20 Voilet kernel: [  204.834072] usb 5-1: Manufacturer: Arduino srl
Mar 13 20:07:20 Voilet mtp-probe: checking bus 5, device 2: "/sys/devices/pci0000:00/0000:00:1d.0/usb5/5-1"

When I run lsusb my ISP programmer shows up as so:

Code: [Select]
Bus 005 Device 003: ID 2a03:0049 dog hunter AG
I tried some stuff in Windows. The Arduino IDE showed my ISP programmer as an AVR ISP mkII. So with AVRdude I've tried "-c arduino", "-c avrisp2", and "-c avrispmkII" with no luck. Atmel Studio won't let me add my ISP programmer as a target. In Device Manager in Windows my ISP programmer doesn't have proper drivers, but I believe it's showing up as COM 1 so I'm guessing it's working right there. I want to use AVRdude on Linux anyway, so I'm not too concerned at the moment.

So yeah, any help would be appreciated. I'm assuming my arguments are all wrong? Does using POGO pins not work and do I need to solder wires to the board? I'm pressing firmly on the pins and they seem to be making good contact.
« Last Edit: Mon, 19 March 2018, 17:41:07 by Traveler »

Offline a-c

  • Posts: 196
  • Location: USA
Re: [HELP] Trying to ISP program a board of mine using AVRdude.
« Reply #1 on: Wed, 14 March 2018, 16:34:19 »
Should be using
Code: [Select]
-c arduinoisp as the programmer according to this https://www.avrfreaks.net/forum/solved-avrdude-argument-arduinoisp-programmer

Not all avrdude has this as an option. Try
Code: [Select]
avrdude -cv to list all the programmers your version supports.

Offline Traveler

  • Thread Starter
  • Posts: 280
Re: [HELP] Trying to ISP program a board of mine using AVRdude.
« Reply #2 on: Thu, 15 March 2018, 08:40:04 »
Should be using
Code: [Select]
-c arduinoisp as the programmer according to this https://www.avrfreaks.net/forum/solved-avrdude-argument-arduinoisp-programmer

Not all avrdude has this as an option. Try
Code: [Select]
avrdude -cv to list all the programmers your version supports.

Hm. I've tried four different version of avrdude, three on Linux and one on Windows, and none of them have "arduinoisp" as a programmer.

So I tested every AVR ISP entry and noticed a slight difference when using "-c avrisp" and "-c avrisp". Instead of the "no usb" error I was getting I now get this:

Code: [Select]
avrdude: ser_open(): can't set attributes for device "/dev/ttyS0": Inappropriate ioctl for device
So I'm thinking I need to use one of those two (probably "avrisp"), but I will need to manually specify the port and I'm a bit stumped on that.

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Re: [HELP] Trying to ISP program a board of mine using AVRdude.
« Reply #3 on: Thu, 15 March 2018, 08:43:41 »
If you run the below just after plugging in the programmer it will give you kernel messages - the port should look something like /dev/tty???
Code: [Select]
dmesg | tail
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline Traveler

  • Thread Starter
  • Posts: 280
Re: [HELP] Trying to ISP program a board of mine using AVRdude.
« Reply #4 on: Thu, 15 March 2018, 20:14:30 »
If you run the below just after plugging in the programmer it will give you kernel messages - the port should look something like /dev/tty???
Code: [Select]
dmesg | tail

Unfortunately I don't see anything like that. All I see is the following:

Code: [Select]
[ 1621.168084] usb 5-2: new low-speed USB device number 3 using uhci_hcd
[ 1621.352134] usb 5-2: New USB device found, idVendor=2a03, idProduct=0049
[ 1621.352140] usb 5-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1621.352144] usb 5-2: Product: ArduinoISP 
[ 1621.352147] usb 5-2: Manufacturer: Arduino srl

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Re: [HELP] Trying to ISP program a board of mine using AVRdude.
« Reply #5 on: Fri, 16 March 2018, 05:10:06 »
Ok, remembered that wrong...

Instead of guessing I've actually read what's going on (:-[) and wonder have you tried using --force on the dfu-programmer flash command?  Sounds like it's designed for exactly your problem:
Code: [Select]
  flash: ... Use --force to ignore warning when data exists in target memory region. ..
If that doesn't work I'll have to work out an adapter to connect my Teensy via ISP and have a play...
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline pr0ximity

  • Posts: 2705
  • Location: Maine
Re: [HELP] Trying to ISP program a board of mine using AVRdude.
« Reply #6 on: Fri, 16 March 2018, 05:38:34 »
Did you try a different (known good) USB cable?

You could also try sudo, your user might not have access to the device.
| Flickr | KMAC 1.2 | Koala | GSKT-00-Z | GSKT-00-AEK | GON NerD60 | Jane V2 CE | Whale | J80S | Ibis | Pro2 | Pro1 | 356mini | 356CL DGE | G80-5000 HAMDE | IBM 1390120 | IBM F AT | IBM F122 | IBM 3101 | Zenith Z-150

Offline Traveler

  • Thread Starter
  • Posts: 280
Re: [HELP] Trying to ISP program a board of mine using AVRdude.
« Reply #7 on: Fri, 16 March 2018, 08:46:26 »
Ok, remembered that wrong...

Instead of guessing I've actually read what's going on (:-[) and wonder have you tried using --force on the dfu-programmer flash command?  Sounds like it's designed for exactly your problem:
Code: [Select]
  flash: ... Use --force to ignore warning when data exists in target memory region. ..
If that doesn't work I'll have to work out an adapter to connect my Teensy via ISP and have a play...

I have used --force in the past, yep. And it kinda worked, but there were issues where keystrokes on my keyboard would just stop entirely until it was unplugged and replugged back in. After two or three flashes with --force I'm at the point now to where I can't type anything before it stops responding.

Don't worry about working out an adapter for your Teensy; that sounds like a lot of work and I don't want to inconvenience anyone. I appreciate the offer though.

Did you try a different (known good) USB cable?

You could also try sudo, your user might not have access to the device.

I've tried a known good USB cable, but only one. I guess trying different cables and ports couldn't hurt. Sudo is how I'm getting my "did not find any USB device" and "can't set attributes for device "/dev/ttyS0": Inappropriate ioctl for device" errors. Before sudo I was just getting simple permission errors.



Does anyone know if the avrdude dev(s) are still active? I might contact them and see what I'm missing. I'm beginning to wonder if my ArduinoISP programmer isn't supported by avrdude or something. It's so hard to find info on that device for anything outside of Arduino IDE programming. I might have to hit up their forums, or maybe just break down and buy a Teensy to program as an ISP like most people do. Which would kinda suck since I wasted $20 on the ArduinoISP.

Offline a-c

  • Posts: 196
  • Location: USA
Re: [HELP] Trying to ISP program a board of mine using AVRdude.
« Reply #8 on: Mon, 19 March 2018, 17:28:58 »
Use the avrdude that comes with a recent Arduino IDE.

It looks like Arduino modified it. https://github.com/arduino/avrdude-build-script/blob/master/avrdude-6.3-patches/30-avrdude-6.3-added_arduinoisp.patch

Offline Traveler

  • Thread Starter
  • Posts: 280
Re: [HELP] Trying to ISP program a board of mine using AVRdude.
« Reply #9 on: Mon, 19 March 2018, 17:43:43 »
Use the avrdude that comes with a recent Arduino IDE.

It looks like Arduino modified it. https://github.com/arduino/avrdude-build-script/blob/master/avrdude-6.3-patches/30-avrdude-6.3-added_arduinoisp.patch

Oops, forgot to update my post. Yeah, the Arduino IDE uses a modified IDE file that supports the ArduinoISP, both the .cc and the .org variant. Just have to either use their packaged avrdude or add the two programmers from the Arduino IDE .conf file to the standard install's .conf file.