AVR Freaks

AVR GCC forum - avarice under linux

gramlich - Jan 18, 2008 - 12:13 AM
Post subject: avarice under linux
All:

I am running Kubuntu 7.10 (Gusty Gibbion) and I am trying to establish communication with my AVR-Dragon via avarice. It attempts to open /dev/avrjtag, which does not exist. I can not find any documentation that explains what to link /dev/avrjtag to. There are no, /dev/ttyS? devices. Here is my "lsusb":

lsusb
Bus 007 Device 001: ID 0000:0000
Bus 006 Device 001: ID 0000:0000
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 003: ID 03eb:2107 Atmel Corp.
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000

So the device is there.

I suspect this problem has a real simple solution, but I've spent the last hour or so Google'ing for a hint and have come up empty.

Any help would be appreciated.

-Wayne
zoltanvoros - Jan 18, 2008 - 03:06 AM
Post subject: RE: avarice under linux
I haven't used avarice, but I haven't had any problems with avrdude. You could try that out to see if that works.
You can also create a symbolic link pointing from the device corresponding to your Dragon and /dec/avrjtag, so when avarice is looking for it, it will find it through the link.
I hope, this solves your problem.
Zoltan
uidzer0 - Jan 18, 2008 - 03:30 AM
Post subject: RE: avarice under linux
Hey Wayne, I don't have any experience with the Dragon under linux either but I suspect that a required module is not loaded for the device. lsusb will list any device on the bus whether the operating system has access to it or not. I would suggest escalating to root privileges and running tail -f /var/log/messages prior to plugging in the device to see any log entries that may help you discover the underlying issue.

Good luck!

Ben
gramlich - Jan 18, 2008 - 04:20 AM
Post subject: Re: RE: avarice under linux
zoltanvoros wrote:
I haven't used avarice, but I haven't had any problems with avrdude. You could try that out to see if that works.
You can also create a symbolic link pointing from the device corresponding to your Dragon and /dec/avrjtag, so when avarice is looking for it, it will find it through the link.
I hope, this solves your problem.
Zoltan


Your suggestion to try avrdude is a ood one. The "help" command for avrdude as a little more informative.

Apparently, for USB devices, -P usb is specified instead of -P /dev/avrjtag for avrdude) and for avarice -j usb instead of -j /dev/avrjtag.

I now consistently get:

avrdude: usb_open(): cannot read serial number "error sending control message: Operation not permitted"
avrdude: usb_open(): cannot read product name "error sending control message: Operation not permitted"
avrdude: usbdev_open(): error setting configuration 1: could not set config 1: Operation not permitted
avrdude: usbdev_open(): did not find any USB device "usb"

Definitely progress, but I am not there yet.

-Wayne
gramlich - Jan 18, 2008 - 04:27 AM
Post subject: Re: RE: avarice under linux
uidzer0 wrote:
Hey Wayne, I don't have any experience with the Dragon under linux either but I suspect that a required module is not loaded for the device. lsusb will list any device on the bus whether the operating system has access to it or not. I would suggest escalating to root privileges and running tail -f /var/log/messages prior to plugging in the device to see any log entries that may help you discover the underlying issue.

Good luck!

Ben


Ben:

My first problem is that when I compiled avarice, it needs libusb and I did not have that installed. Now I get a different error message.

The suggestion to do a tail -f /var/log/messages is an excellent one. When I plugged the AVR-Dragon back in again, the log message was benign.

I think to code is starting to talk to the AVR-Dragon, but something else is not happy. It appears to be choking on the usb_set_configuration() routine call in jtag2usb.cc.

Thanks for your suggestion though,

-Wayne
gramlich - Jan 18, 2008 - 05:05 AM
Post subject: Re: avarice under linux
gramlich wrote:
All:

I am running Kubuntu 7.10 (Gusty Gibbion) and I am trying to establish communication with my AVR-Dragon via avarice. It attempts to open /dev/avrjtag, which does not exist. I can not find any documentation that explains what to link /dev/avrjtag to. There are no, /dev/ttyS? devices. Here is my "lsusb":

I suspect this problem has a real simple solution, but I've spent the last hour or so Google'ing for a hint and have come up empty.

Any help would be appreciated.

-Wayne


OK, I've got it working. There were three issues:

1) Be sure that libusb-dev is installed on the system before compiling avarice.

2) Use -j usb to talk to the USB device.

3) Run the avarice command as root to enable access to the AVR-Dragon.

Thus, for me,

sudo avarice -g -j usb -P atmega324p -r

successfully read the fuse bits from a blank part.

Thank goodness for open source, it would have taken much longer if the source code was not available for inspection.

Thanks for all the help,

-Wayne
dl8dtl - Jan 18, 2008 - 09:27 AM
Post subject: RE: Re: avarice under linux
> 3) Run the avarice command as root to enable access to the AVR-Dragon.

The better solution would be to have your system assign the respective
/proc/bus/usb/... device node (what a horrible place for device nodes!)
to a group you are member of. I think that's going to work with
something called "udev", but I'm not very fluent in Linux administration.
gramlich - Jan 18, 2008 - 04:21 PM
Post subject: Re: RE: Re: avarice under linux
dl8dtl wrote:
> 3) Run the avarice command as root to enable access to the AVR-Dragon.

The better solution would be to have your system assign the respective
/proc/bus/usb/... device node (what a horrible place for device nodes!)
to a group you are member of. I think that's going to work with
something called "udev", but I'm not very fluent in Linux administration.


That would be much better. I'll do a little homework and see if I can figure out how to do it. This stuff just needs to get written down somewhere (probably the AVRFreaks Wiki.)

I'll be joining the appropriate avarice source forge mail list soon to send in a few recommended code patches.

I have avrdude working with my AVR-Dragon, but avarice dumps core on me when I try to program. I'll track it down tomorrow. (Too busy today.)

-Wayne
sunge - Mar 24, 2008 - 09:06 AM
Post subject:
> 3) Run the avarice command as root to enable access to the AVR-Dragon.

Maybe you can install avarice as root and setuid?

-rwsr-xr-x 1 root root 690631 10月 4 16:31 /usr/local/AVR/bin/avarice
dl8dtl - Mar 24, 2008 - 10:08 AM
Post subject:
> Maybe you can install avarice as root and setuid?

Don't. Tweak your udev configuration instead, so you can use
these tools as mortal users. They have not undergone any form of
security audit to ensure running them as root does not have any
harmful side effects (like buffer overflow exploits etc.).
dbc - Mar 24, 2008 - 05:28 PM
Post subject:
Wayne,
I'm pretty sure this is a permissions issue -- sounds similar to something I went through, but too long ago to remember exactly. IIRC there is a udev configuration file somewhere that sets the permissions for a device when it connects. Also, IIRC Ubuntu is one of those Linux's that adheres to the "every user in his own group" insanity that seems popular these days. (What wrong with 'users'????) You might need to create a group for programming devices and/or assign the device to a group and/or add yourself to a group.

-dave
gramlich - Mar 24, 2008 - 06:03 PM
Post subject:
dl8dtl wrote:
> Maybe you can install avarice as root and setuid?

Don't. Tweak your udev configuration instead, so you can use
these tools as mortal users. They have not undergone any form of
security audit to ensure running them as root does not have any
harmful side effects (like buffer overflow exploits etc.).


For Ubuntu, editing udev is probably the better way to to go. I posted the solution on 27Jan2008 under "Avarice issue". I will repost here:

The following file does the trick for Linux Ubuntu 7.10:

# udev rules file for atmel usb devices (for udev 0.98 version)
#
SUBSYSTEM!="usb_device", GOTO="atmel_rules_end"
ACTION!="add", GOTO="atmel_rules_end"

ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2103", MODE="0660", GROUP="plugd
ev"
ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2107", MODE="0660", GROUP="plugd
ev"

LABEL="atmel_rules_end"

It turns out that there was an avarice.rules file, but that it
did not include the dragon.

------------------------------

Upon rereading the message, it is a little terse. Sorry. Create a file called /etc/udev/rules.d/45-atmel.rules that contains the content above. It worked for me.

I posted a bug with Ubuntu asking them to add Dragon support for Ubuntu avarice package.

-Wayne
All times are GMT + 1 Hour
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits