You are not logged in.

#1 2024-09-29 15:38:20

jole
Member
Registered: 2020-06-10
Posts: 15

avrdude and usb port

I wanna use avrdude from the command line in a Makefile, with the Atmel-ICE programming device to program various AVR-chips, atmega328p for instance.

The question I have in this regard is: how do I find the name of the usb port I'm using, so that I can specify it to avrdude with the -P switch? Is there a command I can use in terminal to list my usb ports?

I have tried lsusb

[0][jole@isachsenfonna-arch ~]
  $ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 003: ID 27c6:6594 Shenzhen Goodix Technology Co.,Ltd. Goodix USB2.0 MISC
Bus 003 Device 004: ID 04f2:b7c0 Chicony Electronics Co., Ltd Integrated Camera
Bus 003 Device 005: ID 058f:9540 Alcor Micro Corp. AU9540 Smartcard Reader
Bus 003 Device 006: ID 8087:0033 Intel Corp. AX211 Bluetooth
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

The output from lsusb does not change when I connect the Atmel-ICE programmer, which to me, indicates is is not assigned a port.

I have also tried dmesg

[0][jole@isachsenfonna-arch ~]
  $ sudo dmesg | grep tty
[    0.092665] printk: console [tty0] enabled
[  349.501399] systemd[1]: Created slice Slice /system/getty.
[  350.789348] cdc_acm 3-1:1.0: ttyACM0: USB ACM device
[ 9775.207662] cdc_acm 3-1:1.0: ttyACM0: USB ACM device
[ 9858.320186] usb 3-1: FTDI USB Serial Device converter now attached to ttyUSB0
[ 9877.552385] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[ 9883.344269] usb 3-1: FTDI USB Serial Device converter now attached to ttyUSB0
[ 9902.511248] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[ 9954.721895] cdc_acm 3-1:1.0: ttyACM0: USB ACM device
[10380.371518] cdc_acm 3-1:1.0: ttyACM0: USB ACM device
[10617.587046] cdc_acm 3-7:1.0: ttyACM0: USB ACM device

Which also don't change output when I connect the Atmel-ICE.

Is there anyone who has had the same issue, and solved it? I could use some help here :-)

Best regards
/Jon

Offline

#2 2024-09-29 18:17:16

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,177

Re: avrdude and usb port

It is going to be listed in the device nodes.   It is probably going to be /dev/ttyUSB0, but it could be /dev/ttyACM0.   If you have other things connected like an Arduino or anything else that emulates a serial port over USB there could be more than one ttyUSB or ttyACM.

ttyUSB usually map serial port like things that talk over USB (like FTDI USB to serial converters)
ttyACM usually map serial port like things the talk over USB that respond to AT commands (like Arduinos or modems)

look at the output of ls -l /dev/ttyUSB* and of ls -l /dev/ACM*


Edit:   But, what what you probably want is the -c switch.  I believe avrdude will find the programmer.  I am not certain the Atmel ICE shows up as a serial port.

Edit:  For reference, my jtag3 shows up on the USB bus, but does not map to a /dev/tty* node.

ewaller@odin/~% lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 13d3:56ea IMC Networks USB2.0 HD UVC WebCam
Bus 001 Device 003: ID 8087:0026 Intel Corp. AX201 Bluetooth
Bus 001 Device 004: ID 03eb:2140 Atmel Corp. AVR JTAGICE3 (v3.x) Debugger and Programmer
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
ewaller@odin/~% 

Edit:  Check to see if the kernel you are running is the same as the one installed:
compare the versions reported by uname -a and pacman -Q linux

Last edited by ewaller (2024-09-29 18:30:32)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2024-09-29 20:20:42

jole
Member
Registered: 2020-06-10
Posts: 15

Re: avrdude and usb port

Thanks for the reply ewaller, much appreciated. I'll look into it and let you know if it solved my issue.

For the record; my device lists as /dev/ttyACM0.

I have used this approach earlier, and I specified both port and programmer (back then I had a Dell laptop, I have since gotten a Thinkpad P14sG4). Maybe I don't need both?

Excerpts from an earlier Makefile:

PORT            = usb-0000
DEVICE          = atmega328p
PROGRAMMER      = atmelice_isp
BAUD            = 115200

...

upload:
        avrdude -v -p $(DEVICE) -c $(PROGRAMMER) -P $(PORT) -b $(BAUD) -U flash:w:$(OUTPUTFILE).hex:i

Edit: Seems the kernel issue is just the lts and non-lts are different versions (as one would expect).
And also my kernels are not the same:

[0][jole@isachsenfonna-arch ~]
  $ uname -a
Linux isachsenfonna-arch 6.6.52-1-lts #1 SMP PREEMPT_DYNAMIC Wed, 18 Sep 2024 19:02:04 +0000 x86_64 GNU/Linux
[0][jole@isachsenfonna-arch ~]
  $ pacman -Q linux
linux 6.10.10.arch1-1

I'll look into that using this as guide/starting point: https://bbs.archlinux.org/viewtopic.php?id=275628

Last edited by jole (2024-09-29 20:36:47)

Offline

#4 2024-09-30 13:32:21

jole
Member
Registered: 2020-06-10
Posts: 15

Re: avrdude and usb port

I solved the issue, thanks a lot ewaller.

It turned out to be the usb-cable. I replaced it, and then the device showed up with lsusb:

[0][jole@isachsenfonna-arch ~]
  $ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 27c6:6594 Shenzhen Goodix Technology Co.,Ltd. Goodix USB2.0 MISC
Bus 003 Device 003: ID 04f2:b7c0 Chicony Electronics Co., Ltd Integrated Camera
Bus 003 Device 004: ID 058f:9540 Alcor Micro Corp. AU9540 Smartcard Reader
Bus 003 Device 005: ID 8087:0033 Intel Corp. AX211 Bluetooth
Bus 003 Device 006: ID 03eb:2141 Atmel Corp. ICE debugger
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

Offline

Board footer

Powered by FluxBB