AVR jtagice3 unter Linux

Gast #3729080
Lesenswert?

Hallo zusammen,

ich habe hier einen recht neuen Atmel AVR jtagICE3 liegen, funktioniert 
prima unter Windows, möchte diesen aber sehr gerne auch unter Linux 
(Ubuntu 14) mit avrdude benutzen. Avrdude habe ich installiert, der 
jtagICE3 findet sich auch in der Liste der unterstützten 
Programmieradapter, aber anscheinend fehlt mir ein Treiber dafür. Naja, 
und auch die Erfahrung das alleine zum laufen zu bekommen.

Habe dmesg bemüht um zu erfahren ob Linux das Gerät erkennt:

[95491.766209] usb 3-4: USB disconnect, device number 5
[95540.740259] usb 3-4: new high-speed USB device number 6 using 
xhci_hcd
[95540.757154] usb 3-4: New USB device found, idVendor=03eb, 
idProduct=2140
[95540.757160] usb 3-4: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[95540.757165] usb 3-4: Product: JTAGICE3 CMSIS-DAP
[95540.757169] usb 3-4: Manufacturer: Atmel Corp.
[95540.757172] usb 3-4: SerialNumber: J302000234
[95540.757365] usb 3-4: ep 0x84 - rounding interval to 128 microframes, 
ep desc says 255 microframes
[95540.757371] usb 3-4: ep 0x3 - rounding interval to 128 microframes, 
ep desc says 255 microframes
[95540.758611] hid-generic 0003:03EB:2140.0005: hiddev0,hidraw3: USB HID 
v1.11 Device [Atmel Corp. JTAGICE3 CMSIS-DAP] on 
usb-0000:00:14.0-4/input0

In dev wird der jtagICE3 als /dev/hidraw3 eingebunden.

Kann mir jemand erklären wie ich darauf jetzt per avrdude zugreifen 
kann? Flashen reicht mir schon, debuggen muss nicht sein.

Vielen Dank für eure Hilfe!

Jan
Moderator Persönliche Seite #3730001
Lesenswert?

Wie wäre es mit dem Lesen der Manpage?
1
           -P port
2
3
                   For the JTAG ICE mkII and JTAGICE3, if avrdude has been
4
                   configured with libusb support, port can alternatively be
5
                   specified as usb[:serialno].  This will cause avrdude to
6
                   search the programmer on USB.  If serialno is also speci‐
7
                   fied, it will be matched against the serial number read
8
                   from any JTAG ICE mkII found on USB.  The match is done
9
                   after stripping any existing colons from the given serial
10
                   number, and right-to-left, so only the least significant
11
                   bytes from the serial number need to be given.

Das Posten der von dir verwendeten Kommandozeile mitsamt der
Fehlermeldung, die du bekommst, wäre auf jeden Fall hilfreich gewesen.
Gast #3730009
Lesenswert?

Entschuldigung, arbeite an meinem Stil, ich hoffe damit könnt ihr mir 
weiterhelfen:

Laut http://www.nongnu.org/avrdude/user-manual/avrdude_6.html gibt 
folgende Eingabe in der Kommandozeile eine Liste der angeschlossenen 
jtagICE3:

jan@Jan-Lenovo:~$ sudo avrdude -c jtag3 -p m328p -P usb:xx -v

avrdude: Version 6.0.1, compiled on Oct 21 2013 at 17:07:18
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/home/jan/.avrduderc"
         User configuration file does not exist or is not a regular 
file, skipping

         Using Port                    : usb:xx
         Using Programmer              : jtag3
avrdude: usbdev_open(): did not find any (matching) USB device "usb:xx"


Ich denke das Problem liegt beim '-P usb:xx', oder?
Gast #3730033
Lesenswert?

Hier die Ausgabe von lsusb -v:

Bus 003 Device 016: ID 03eb:2140 Atmel Corp.
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 ?
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x03eb Atmel Corp.
  idProduct          0x2140
  bcdDevice            1.01
  iManufacturer           1
  iProduct                2
  iSerial                 3
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           64
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              4
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      55
         Report Descriptors:
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              5
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval             255
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval             255
Moderator Persönliche Seite #3730076
Lesenswert?

Jan schrieb:

> Ich denke das Problem liegt beim '-P usb:xx', oder?

Nein.  Die "xx" ist hier nur ein Platzhalter für eine garantiert nicht
existierende Seriennummer, und zusammen mit der Option -v listet er
dann alle Geräte, die er unter diesem VID/PID-Paar findet.

Dein Problem ist das hier:

> avrdude: Version 6.0.1, compiled on Oct 21 2013 at 17:07:18
> ^^^^^^^^^^^^^^^^^^^^^^

zusammen mit einer neuen Firmware, die sich darin ausdrückt:

Jan schrieb:
> Bus 003 Device 016: ID 03eb:2140 Atmel Corp
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Diese Firmware implementiert das CMSIS-DAP-Protokoll, und dafür brauchst
du ein AVRDUDE 6.1.  Das ältere AVRDUDE implementierte nur das
Atmel-eigene Protokoll, und suchte entsprechend nur nach der dafür
benutzten PID 2111.
Gast #3730147
Lesenswert?

Vielen Dank an euch alle, jetzt klappt es!

jan@Jan-Lenovo:~$ sudo avrdude -c jtag3isp -p m328p -P usb:49:34 -v

avrdude: Version 6.1, compiled on Jul 18 2014 at 11:08:27
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/usr/local/etc/avrdude.conf"
         User configuration file is "/home/jan/.avrduderc"
         User configuration file does not exist or is not a regular 
file, skipping

         Using Port                    : usb:49:34
         Using Programmer              : jtag3isp
avrdude: usbdev_open(): did not find any (matching) USB device 
"usb:4934" (0x03eb:0x2110)
avrdude: usbdev_open(): Found JTAGICE3 CMSIS-DAP, serno: J40240224934
avrdude: Found CMSIS-DAP compliant device, using EDBG protocol
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page 
Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages 
MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ 
----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0 
3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256 
4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0 
4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0 
4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0 
4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0 
4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0 
0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0 
0     0 0x00 0x00

         Programmer Type : JTAG3_ISP
         Description     : Atmel AVR JTAGICE3 in ISP mode
         Vtarget         : 4.9 V
         SCK period      : 1.54 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 
0.19s

avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as FD

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as FD
avrdude: safemode: Fuses OK (E:FD, H:DA, L:FF)

avrdude done.  Thank you.


Vielen Dank nochmal und schonmal ein schönes Wochenende!
Moderator Persönliche Seite #3730270
Lesenswert?

Jan schrieb:
> jan@Jan-Lenovo:~$ sudo avrdude -c jtag3isp -p m328p -P usb:49:34 -v

Wenn du nur ein JTAGICE3 in deinem gesamten System hast, musst du
die Seriennummer nicht angeben; »-P usb« ist dann völlig ausreichend.

Das Feature mit der Seriennummer ist dafür da, dass man mehrere
gleichartige Programmieradapter auseinander halten kann.

p.s.: Für eine hinreichende Bugfreiheit für den Betrieb als root
würde ich nicht garantieren wollen.  Bau dir lieber dein System so
um, dass du als normaler Nutzer auf die Geräte zugreifen kannst.

Auf einem Linux, mit dem ich arbeite, benutze ich das hier:
1
# Atmel VID: 03eb
2
# Atmel AVR ISP mkII:      PID 2104
3
# Atmel AVR JTAG ICE mkII: PID 2103
4
# Atmel STK600:            PID 2106
5
# Atmel AVR DRAGON:        PID 2107
6
# Atmel JTAGICE3:          PID 2110
7
# Atmel JTAGICE3 CMSIS-DAP PID 2140
8
# Atmel-ICE                PID 2141
9
#
10
# By matching any PID, any Atmel product will be recognized, leaving
11
# room e.g. for software USB implementations
12
SUBSYSTEM=="usb", ATTR{idVendor}=="03eb", GROUP="plugdev", MODE="0660"
13

14
# CMSIS-DAP devices
15
KERNEL=="hidraw*", ATTRS{busnum}=="1", ATTRS{idVendor}=="03eb", GROUP="plugdev", MODE="0660"
16

17
# Atmel SAM-ICE (aka. Segger J-Link)
18
SUBSYSTEM=="usb", ATTR{idVendor}=="1366", ATTR{idProduct}=="0101", GROUP="plugdev", MODE="0660"
19

20
# USBtinyISP (3rd party programmer)
21
SUBSYSTEM=="usb", ATTR{idVendor}=="1781", ATTR{idProduct}=="0c9f", GROUP="plugdev", MODE="0660"
22

23
# USBasp
24
SUBSYSTEM=="usb", ATTR{idVendor}=="16c0", ATTR{idProduct}=="05dc", GROUP="plugdev", MODE="0660"

als /etc/udev/rules.d/42-atmel_usb.rules

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren