Ubuntu / AVR ISP mkII + Arduino IDE - Electronics Forums

Author Topic: Ubuntu / AVR ISP mkII + Arduino IDE  (Read 10548 times)

haddorp

  • Trusted Member
  • *
  • Posts: 4
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Ubuntu / AVR ISP mkII + Arduino IDE
« on: October 19, 2012, 03:12:20 PM »
Hello,

I would like to program an ATTINY using Arduino IDE. Therefore I've bought an AVR ISP mkII adapter. OS is Ubuntu 1204.

Problem is that there is no new serial or USB port when plugin the AVR ISP mkII. Compared the the original Arduino board that is working without any trouble.

The AVR ISP mkII is recognized as shown by "lsusb".
Code: [Select]
Bus 005 Device 004: ID 03eb:2104 Atmel Corp. AVR ISP mkII

THe adapter is also recognizes in the log as can seen via "dmesg".
Code: [Select]
[ 3911.916033] usb 5-3: new full-speed USB device number 4 using ohci_hcd

I've read that special rule settings have to be applied. Therefore I've added a new rules file.
/etc/udev/rules.d/42-atmel_usb.rules
Code: [Select]
# Atmel AVR ISP mkII
SUBSYSTEM=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2104", GROUP="plugdev", MODE="0660"
# Atmel AVR JTAG ICE mkII
SUBSYSTEM=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2103", GROUP="plugdev", MODE="0660"
# Atmel AVR DRAGON
SUBSYSTEM=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2107", GROUP="plugdev", MODE="0660"

The command "groups" shows that my user should be in the access group.
Code: [Select]
adm dialout cdrom plugdev lpadmin admin sambashare

All attempts accessing the AVR ISP mkII adapter run on an error.
Code: [Select]
avrdude -c avrispmkII -p m644p -P usb -e -U flash:w:bacnet.hex
avrdude: usb_open(): cannot read serial number "error sending control message: Connection timed out"
avrdude: usb_open(): cannot read product name "error sending control message: Connection timed out"
avrdude: usbdev_open(): error setting configuration 1: could not set config 1: Connection timed out
avrdude: usbdev_open(): did not find any USB device "usb"

The AVR ISP mkII clone I'm using is a Diamex ALL-AVR.
I have no idea about what is going wrong...

Thanks, JC

Electronics Forums

Ubuntu / AVR ISP mkII + Arduino IDE
« on: October 19, 2012, 03:12:20 PM »

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Ubuntu / AVR ISP mkII + Arduino IDE
« Reply #1 on: October 19, 2012, 04:43:12 PM »
JC, check out a small update I posted today on the Ubuntu 12.04 specifics: http://elabz.com/atmel-avrisp-mkii-programmer-in-ubuntu-12-04/

Apparently, these issues all have to do with the change in the usb driver permissions in the new version and udev configuration needed small changes. Additionally, one prerequisite package is missing in 12.04 and needs to be installed - uisp

One other thing: I did not see you describe restarting udev after changing its rules - it needs to be restarted to pick up the changes. It is perhaps a moot point now - you have probably shut your PC down and turn it back on, but just in case - be sure you restart udev after making any changes:

Code: [Select]
sudo service udev restart
So, check out that new post and if you're still experiencing issues, please post your updates here.

Cheers!

haddorp

  • Trusted Member
  • *
  • Posts: 4
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Ubuntu / AVR ISP mkII + Arduino IDE
« Reply #2 on: October 19, 2012, 06:54:17 PM »
Unluckily this doesn't change anything. "usip" has been installed already and is up-to-date.

Perhaps I will have more success after the next Ubuntu update... One question. Is the number/naming of the rules file important or how is it defined?

Is it possible that the programmer is defect or the wiring to the ATTINY not correct? Or should this look different?

Cheers, JC

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Ubuntu / AVR ISP mkII + Arduino IDE
« Reply #3 on: October 19, 2012, 07:29:25 PM »
No, this error is definitely something that has to do with the computer not able to talk to the programmer via USB, not an issue with the programmer's connection to the chip.
This is what the bad connection to the chip looks like (I just turned the chip's power off)

Code: [Select]

avrdude: stk500v2_command(): command failed
avrdude: stk500v2_program_enable(): bad AVRISPmkII connection status: Target not detected
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

So, are you able to use avrdude as user root yet not able to use it as your normal user?

see if you can browse to the arduino folder, then /hardware/tools and try to start avrdude there:
Code: [Select]
sudo avrdude -c avrispmkII -p m644p -P usb_device -e -U flash:w:test.hex
Note the sudo in front to run as a root. The test.hex file does not have to exist, neither should the device type be the right one (-p m644p ). If the root can use the programmer, you will see useful output even without the actual binary dump, if not - you'll see errors.

As far as the numbering conventions for udev - my understanding is that it has to go
xx-something-descriptive.rules where the lower xx rules execute first. Anything higher than 60 can be overridden by default rules. So, in theory, you may want to name yours something like 41-avrisp.rules to prevent any conflicts with the stuff that loads later. Take that with a grain of salt, too: I am not a Linux USB developer, I only learned what makes my USB-attached devices work, so there may also be some nuances I'm not paying attention to.
« Last Edit: October 19, 2012, 07:53:02 PM by ElectroNick »

haddorp

  • Trusted Member
  • *
  • Posts: 4
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Ubuntu / AVR ISP mkII + Arduino IDE
« Reply #4 on: October 19, 2012, 08:01:37 PM »
I just see errors ;-)

Code: [Select]
jhaddorp@Athlon:~$ sudo avrdude -c avrispmkII -p m644p -P usb_device -e -U flash:w:test.hex
[sudo] password for jhaddorp:
avrdude: usb_open(): cannot read serial number "error sending control message: Connection timed out"
avrdude: usb_open(): cannot read product name "error sending control message: Connection timed out"
avrdude: usbdev_open(): error setting configuration 1: could not set config 1: Connection timed out
avrdude: usbdev_open(): did not find any USB device "usb_device"
jhaddorp@Athlon:~$ avrdude -c avrispmkII -p m644p -P usb_device -e -U flash:w:test.hex
avrdude: usb_open(): cannot read serial number "error sending control message: Connection timed out"
avrdude: usb_open(): cannot read product name "error sending control message: Connection timed out"
avrdude: usbdev_open(): error setting configuration 1: could not set config 1: Connection timed out
avrdude: usbdev_open(): did not find any USB device "usb_device"
jhaddorp@Athlon:~$

And the log again...

Code: [Select]
[21793.820251] usb 5-3: new full-speed USB device number 9 using ohci_hcd
[21807.961079] usb 5-3: usbfs: USBDEVFS_CONTROL failed cmd avrdude rqt 128 rq 6 len 255 ret -110
[21808.961043] usb 5-3: usbfs: USBDEVFS_CONTROL failed cmd avrdude rqt 128 rq 6 len 255 ret -110
[21823.217001] usb 5-3: usbfs: USBDEVFS_CONTROL failed cmd avrdude rqt 128 rq 6 len 255 ret -110
[21824.216956] usb 5-3: usbfs: USBDEVFS_CONTROL failed cmd avrdude rqt 128 rq 6 len 255 ret -110
[21919.156185] udevd[3902]: starting version 175
[21928.868485] usb 5-3: usbfs: USBDEVFS_CONTROL failed cmd avrdude rqt 128 rq 6 len 255 ret -110
[21929.868585] usb 5-3: usbfs: USBDEVFS_CONTROL failed cmd avrdude rqt 128 rq 6 len 255 ret -110

It's strange... There must be something basically wrong. A clear / understandable error message would be fine...

Have you ever used the programmer under Windows 7? I think I've got something like "avrdude: stk500v2_xxx" using Windows 7. Will check again...

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Ubuntu / AVR ISP mkII + Arduino IDE
« Reply #5 on: October 19, 2012, 09:32:03 PM »
Sorry JC, not a Windows user since many years ago, not sure how it would work under Win 7.
Another idea has just struck me: see if installing avrdude system-wide will change things around a bit. Come to think of it, I myself did a system-wide install before this started working though I did not think it had affected anything. Perhaps it  did, try it:

Code: [Select]
sudo apt-get install avrdude

 

haddorp

  • Trusted Member
  • *
  • Posts: 4
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Ubuntu / AVR ISP mkII + Arduino IDE
« Reply #6 on: October 20, 2012, 01:06:46 PM »
Hello, I've verified the installation of "avrdude". It has been already installed system-wide.

I also tried running "avrdude" as root via sudo. Unluckily no change.

What I'm wondering... Shouldn't be there a new device under /dev? Another serial port or and USB device?

However there is one positive point. After fixing the wiring I have been able to upload first script using Windows. So, at least I know the programmer is working and I'm on the right way... Now just get Ubuntu running ;-)

 

Related Topics

  Subject / Started by Replies Last post
22 Replies
20418 Views
Last post December 04, 2012, 11:37:03 PM
by ElectroNick
2 Replies
33839 Views
Last post July 29, 2013, 01:51:24 PM
by Akshay
9 Replies
21517 Views
Last post December 16, 2015, 12:03:18 PM
by PaulBailey
0 Replies
1129 Views
Last post July 11, 2017, 04:41:56 AM
by mishmalik
0 Replies
1231 Views
Last post July 11, 2017, 05:07:13 AM
by mishmalik