AVARICE with libusb

Go To Last Post
44 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all,

I'm having problems while trying to communicate to Atmel-ICE over Avarice and for some reason I'm constantly getting "avarice has not been compiled with libusb support" error message.

Since I couldn't get Avarice to work I have tried to first enable the avrdude. After small playing around with libusb drivers I have managed to use the avrdude with Atmel-ICE. After that I have switched to Avarice again and no matter what I do or where I paste the libusb files the Avarice won't compile with libusb support (Avarice compiles but constantly prints the error for missing libusb on "avarice --mkII -j usb" cmd). 

Things that I have done before compiling the Avarice:

  • copied the libusb-1.0 header file to /usr/include/libusb-1.0/ under cygwin
  • copied the libusb-1.0.a and libusb-1.0.dll.a files to lib /gcc/x86_64-pc-cygwin/6.4.0/ under cygwin
  • untared avarice-2.13 in home folder and created a specific "obj-avr" directory within
  • set flags for libusb:
    • export CPPFLAGS=-I/usr/include/libusb-1.0/
    • export CFLAGS=-I/usr/include/libusb-1.0/
    • export LDFLAGS="-static -L/lib/gcc "
  • "../configure --prefix=$PREFIX" cmd
  • then I have appended "-lusb-1.0" in LIBS variable under Makefile
  • after that I have applied the patches mention by TT_ZX from here
  • then I needed to modify the jtagrw.cc file under line 134 to "NULL". For some reason it was returning boolean value.
  • now I was able to execute make and make install cmds

After doing all steps above I was able to get the avarice.exe file but it was still saying that Avarice wasn't compiled with libusb support. Does anyone have any idea what am I missing here?

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I do not have any experience with Atmel ICE but had a similar problem with the Atmel Dragon.  Avrdude would work with libusb but not the Dragon. 

 

What solved my problem was to install libusb_win32 https://sourceforge.net/projects/libusb-win32/  Both Avarice 2.12 and Avrdude 6.1 do not object to the Dragon with that driver.   However, I do see you are using the 64 bit version of Windows so I'm not sure that fix would work for you. 

 

Alan

Last Edited: Sat. Sep 30, 2017 - 08:31 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Would Zadig catch all?

[Zadig icon]

Zadig

USB driver installation made easy

http://zadig.akeo.ie/

(the Windows XP version is via Download, Other versions)

 

Edit : expand Zadig

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Sat. Sep 30, 2017 - 08:45 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi alllano and gchapman,

thank's for the advice. I have installed the libusb-win32-1.2.6.0 driver with zadig but it didn't help. At least Now I know how to easily install the driver.

 

After some time of digging for solution online I have finally managed to compile the Avarice with libusb support. Turns out that I don't need to specify CPPFLAGS, CFLAGS and LDFLAGS to point to libusb files but rather to bfd.h and libbfd.a files.

 

But now I was getting the  "did not find any USB device "usb"" error. Well I found out that jtag2usb.cc files specifies the PID of the device "#define SB_DEVICE_JTAGICEMKII 0x2103" while my Atmel-ICE pid is 2141. So that's the reason of the aforementioned error message. And I have recompiled the Avarice with corrected PID value but then happened another error. 

 

"USB bulk write error: libusb0-dll:err [submit_async] submitting request failed, win error: The parameter is incorrect."

 

This Avarice just won't cooperate. I'll keep trying to get it work. If anyone has any more ideas please share.

 

//geronimo

Last Edited: Sun. Oct 1, 2017 - 04:54 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all,

5 years ago geronimo had the same kind of issue, that I suffer from today...but with Linux rather than Win.

I went into this thread, but finally, there is no solution at all at the end.

- Didn't you find a solution how to compile avarice with libusb?

- I guess the solution should be stated here, if there was any.

 

kr, sepp2gl

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But in those 5 years Microchip has purchased Atmel and has then added AVR support to their multi-platform IDE: MPLABX

 

So long gone are the days of having to fiddle about with avr-gdb/avarice/simulavr/etc as it's all done professionally inside MPLABX. 

 

Suggest you visit microchip.com and get the installer for MPLABX. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Welcome!

 

AVaRICE is current in Debian though at testing.

Debian Package Tracker - avarice

Debian -- Details of package avarice in bookworm (near bottom for libusb)

 

libusb is conditional in the configure.

https://github.com/avrdudes/avarice/blob/main/configure.ac#L74

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sepp2gl wrote:

Hi all,

5 years ago geronimo had the same kind of issue, that I suffer from today...but with Linux rather than Win.

I went into this thread, but finally, there is no solution at all at the end.

- Didn't you find a solution how to compile avarice with libusb?

- I guess the solution should be stated here, if there was any.

 

kr, sepp2gl

 

Any reason you're not using Bloom? Bloom was built for Linux users, uses hidapi & libusb, and it supports the Atmel-ICE. See https://bloom.oscillate.io/

Nav

Last Edited: Sat. Aug 27, 2022 - 08:20 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Dear all,

good to see, that this forum is alive!
Thank you for response.

 

@navnav:

I wasn't aware about Bloom. A first look into sourceforge reveals quite a big number of "Bloom"s, none with this scope of work.

Second view reveals https://bloom.oscillate.io. Nice page, downloaded rpm-package "other" for openSuSE.
I will report progress on Bloom.

 

@clawson:

Maybe MPLABX is more up to date, but...

I have an ATmelICE, and I know, that it should work.

So the fault is with the settings at my PC, and I need to fix it.

Otherwise the same might happen with MPLABX, or?

 

@gchapman:

thanks for your input.

I do not blame avarice to be misfunctional.

I strongly believe, that there is something wrong with the ".config"-uration.

You stated above, that libusb can be included, with linking to the configure.ac of the respective github-page.

My question: how do I need to parameterize ./configure to include it?

 

Thanks again
sepp2gl

Last Edited: Sun. Aug 28, 2022 - 04:40 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sepp2gl wrote:

A first look into sourceforge reveals quite a big number of "Bloom"s, none with this scope of work.

 

Bloom's source is hosted on GitHub, not SourceForge: https://bloom.oscillate.io/source.

 

sepp2gl wrote:

downloaded rpm-package "other" for openSuSE

 

Don't think I have many openSUSE users. Keen to see how it goes.

 

Oh and BTW, please be sure to use a recent version of (avr-)GDB. Any version predating 8.1 will likely fail due to old bugs in GDB. The most recent version is 12.1, but version 10.1 or later should be fine. Given that you're using an RPM-based package manager, I fear that you may have problems locating a pre-built package of GDB. The last time I checked, the latest GDB version in the pre-built packages was 7.[something], which is far too old to work with Bloom. You may have to build avr-gdb from source, unless you have a way of installing Debian or Arch packages on your machine.

Nav

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@navnav:

The installation process revealed a security-signature issue, which I decided to ignore and to continue installation.

First run of bloom gave me an error message about missing bloom.json, which I fixed with "Bloom init".

Next run gave me following error-message:

"2022-08-28 18:53:46 CEST [MT] [1]: [INFO] Bloom configuration file (bloom.json) created in working directory.
2022-08-28 18:53:46 CEST [MT] [2]: [INFO] Shutting down Bloom
sepp2gl@PC192-168-2-100:~/Arduino/sketchbook> bloom                  
2022-08-28 18:53:55 CEST [MT] [2]: [INFO] Selected environment: "default"
2022-08-28 18:53:55 CEST [TC] [6]: [INFO] Starting TargetController
2022-08-28 18:53:55 CEST [TC] [7]: [INFO] Connecting to debug tool
2022-08-28 18:53:55 CEST [TC] [8]: [ERROR] The TargetController encountered a fatal error. See below for errors:
2022-08-28 18:53:55 CEST [TC] [9]: [ERROR] Failed to open USB device - error code -3 returned.
2022-08-28 18:53:55 CEST [TC] [10]: [INFO] Shutting down TargetController
2022-08-28 18:53:55 CEST [MT] [12]: [ERROR] TargetController failed to startup.
2022-08-28 18:53:55 CEST [MT] [13]: [INFO] Shutting down Bloom
2022-08-28 18:53:55 CEST [SH] [18]: [INFO] Shutting down SignalHandler
"

 

This looks like the same issue, that I have with avarice:
there is something odd with the usb-handling, which drives me mad...

 

The usb-connection of ATmelICE is represented by /dev/usb/hiddev0

and avrdude goes along with it.

 

There seems to be a simple, but hidden issue, that the non-nerd-me cannot find...

 

looking forward to your responde

sepp2gl

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@navnav:

Looking at the gdb-versions:

the standard installed gdb is 11.1

the avr-gdb is 7.9.1

I guess, it might be a future issue, after the usb-issue is fixed,

and I would love to be at that point. But I am not.

 

How does bloom interface usb?
Do you use an external avarice?

 

kr, sepp2gl

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hmm, this may be a permissions issue. What do your UDEV rules look like? You can find them in /etc/udev/rules.d/.

 

As part of Bloom's installation, 99-bloom.rules should have been created in that directory. Can you confirm this by running 

 

ls -al /etc/udev/rules.d/

And post the output here.

 

And if 99-bloom.rules exists in that directory, can you post the contents of that file in here also:

 

cat /etc/udev/rules.d/99-bloom.rules

 

sepp2gl wrote:

Do you use an external avarice?

 

Not quite. Bloom implements its own set of user-space device drivers, using libusb and hidapi. So it's independent of avarice.

Nav

Last Edited: Sun. Aug 28, 2022 - 05:27 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Also, have you disconnected and reconnected the tool since installing Bloom? This is required if the tool was connected whilst you installed Bloom (as the UDEV rules are only applied at the point of connection).

Nav

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And what happens if you run Bloom as root? I don't recommend this as a solution, but would be good to know if it works.

Nav

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@navnav:

Whow! That's fast response...

 

Concering your above question about rules.d:

-rw-r--r-- 1 root root   1007 27. Aug 14:20 45-atmel.rules
-rw-r--r-- 1 root root 257841 25. Feb 2021  55-libsane.rules
-rw-r--r-- 1 root root  69323 25. Feb 2021  56-sane-backends-autoconfig.rules
-rw-r--r-- 1 root root    628  6. Jan 2022  70-persistent-ipoib.rules
-rw-r--r-- 1 root root    445 27. Aug 11:20 70-persistent-net.rules
lrwxrwxrwx 1 root root     45 28. Aug 19:06 99-bloom.rules -> /opt/bloom/resources/UDevRules/99-bloom.rules

 

 

- unfortunately the *.rules cannot be attached, so I need to past them into this window.

- I have a rules file "45-atmel.rules", looking like this:

#
# 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"

# Atmel Corp. JTAG ICE MKII
ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2103", MODE="0660", GROUP="dialout"
# Atmel Corp. AVR ISP MKII
ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2104", MODE="0660", GROUP="dialout"
# Atmel Corp. Dragon
ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2107", MODE="0660", GROUP="dialout"
# Atmel Corp. ATmelIce
# von https://www.avrfreaks.net/forum/...
# ATTR{idVendor}=="03eb", SYSFS{idProduct}=="2141", MODE="660", GROUP="dialout"
ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2141", MODE="660", GROUP="dialout"

LABEL="atmel_rules_end"
"

There is also a link to your "99-bloom.rules" into the installation directory /opt/bloom/..... looking like this:

# Linux udev rules for Bloom - see https://bloom.oscillate.io.
# THIS IS AN AUTOMATICALLY GENERATED FILE - ANY CHANGES MADE WILL LIKELY BE LOST!

SUBSYSTEM=="usb_device", GOTO="bloom_add_usb_device_rules"
SUBSYSTEM!="usb", GOTO="bloom_end"

LABEL="bloom_add_usb_device_rules"

# Microchip Atmel-ICE
ACTION=="add", ATTR{idVendor}=="03eb", ATTR{idProduct}=="2141", MODE="0666"

# Microchip Power Debugger
ACTION=="add", ATTR{idVendor}=="03eb", ATTR{idProduct}=="2144", MODE="0666"

# JTAGICE3
ACTION=="add", ATTR{idVendor}=="03eb", ATTR{idProduct}=="2140", MODE="0666"

# EDBG - debugger on Xplained Pro
ACTION=="add", ATTR{idVendor}=="03eb", ATTR{idProduct}=="2111", MODE="0666"

# mEDBG - debugger on Xplained Mini
ACTION=="add", ATTR{idVendor}=="03eb", ATTR{idProduct}=="2145", MODE="0666"

# PKOB nano (nEDBG) - debugger on Curiosity Nano
ACTION=="add", ATTR{idVendor}=="03eb", ATTR{idProduct}=="2175", MODE="0666"

# MPLAB PICkit 4 In-Circuit Debugger
ACTION=="add", ATTR{idVendor}=="03eb", ATTR{idProduct}=="2177", MODE="0666"

# MPLAB Snap In-Circuit Debugger
ACTION=="add", ATTR{idVendor}=="03eb", ATTR{idProduct}=="2180", MODE="0666"

LABEL="bloom_end"
 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hmm, those udev rules look fine to me.

 

Try running Bloom as root. See if that works. If it doesn't, then it may not be a permissions issue.

Nav

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@navnav:

YES, it makes a difference:

2022-08-28 19:59:16 CEST [MT] [2]: [INFO] Selected environment: "default"
2022-08-28 19:59:16 CEST [TC] [6]: [INFO] Starting TargetController
2022-08-28 19:59:16 CEST [TC] [7]: [INFO] Connecting to debug tool
2022-08-28 19:59:16 CEST [TC] [9]: [INFO] Debug tool connected
2022-08-28 19:59:16 CEST [TC] [10]: [INFO] Debug tool name: Atmel-ICE
2022-08-28 19:59:16 CEST [TC] [11]: [INFO] Debug tool serial: J41800031961
2022-08-28 19:59:16 CEST [TC] [12]: [INFO] Activating target
2022-08-28 19:59:20 CEST [TC] [14]: [ERROR] The TargetController encountered a fatal error. See below for errors:
2022-08-28 19:59:20 CEST [TC] [15]: [ERROR] Failed to activate debugWire physical interface - check target connection and DWEN
fuse bit. Bloom can manage the DWEN fuse bit automatically. For instructions on enabling this function, see https://bloom.osc
illate.io/docs/debugging-avr-debugwire                                                                                         
2022-08-28 19:59:20 CEST [TC] [16]: [INFO] Shutting down TargetController
2022-08-28 19:59:20 CEST [TC] [17]: [INFO] Deactivating target
2022-08-28 19:59:20 CEST [TC] [18]: [INFO] Closing debug tool
2022-08-28 19:59:20 CEST [MT] [20]: [ERROR] TargetController failed to startup.
2022-08-28 19:59:20 CEST [MT] [21]: [INFO] Shutting down Bloom
2022-08-28 19:59:20 CEST [SH] [26]: [INFO] Shutting down SignalHandler

 

As root Atmel-ICE is recognized. The attached Arduino Leonardo with atmega32u4 is not yet recognized.

So it must be a permission issue.

My user is currently registered as member of tty, dialout, audio, mysql, and a couple of vbox-groups.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

P.S.: after sudoing bloom, the yellow led of the Arduino starts blinking fast for ~5seconds,

then ramping up and down 15 times.

 

P.S.2: The Atmel-ICE connector to Arduino is a 6-pin ISP-connector, rather than JTAG-connector.

Last Edited: Sun. Aug 28, 2022 - 06:14 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ah ok, that's good to know.

 

Can you set the "updateDwenFuseBit" parameter in your target config to true, so that your bloom.json looks something like:

 

{
  "environments": {
    "default": {
      "debugTool": {
        "name": "atmel-ice",
        "releasePostDebugSession": true
      },

      "target": {
        "name": "avr8",
        "physicalInterface": "debug-wire",
        "updateDwenFuseBit": true
      },

      "debugServer": {
        "name": "avr-gdb-rsp",
        "ipAddress": "127.0.0.1",
        "port": "1442"
      }
    }
  },

  "insight": {
    "enabled": true
  }
}

Then, run Bloom (as root) again. But be sure the target is connected via ISP, so that Bloom can use the ISP interface to update the DWEN fuse bit. It's possible that Bloom will fail to connect after updating the DWEN fuse bit - this is because the target power needs to be cycled. So after running Bloom again, cycle the target power and then try running Bloom (as root) one more time - it should successfully connect to the target. 

 

Once we've got a working debug session, we can look further into the permissions issue.

Nav

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh wait, the ATmega32u4 is not a debugWire enabled target. It employs the JTAG interface, so that would be the problem here. You need to configure Bloom to use the JTAG interface instead of debugWire. Use this bloom.json config:

 

{
  "environments": {
    "default": {
      "debugTool": {
        "name": "atmel-ice",
        "releasePostDebugSession": true
      },

      "target": {
        "name": "atmega32u4",
        "physicalInterface": "jtag"
      },

      "debugServer": {
        "name": "avr-gdb-rsp",
        "ipAddress": "127.0.0.1",
        "port": "1442"
      }
    }
  },

  "insight": {
    "enabled": true
  }
}

Let me know how that goes.

Nav

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

the modified bloom.json resulted in:

2022-08-28 20:18:34 CEST [MT] [2]: [INFO] Selected environment: "default"
2022-08-28 20:18:34 CEST [TC] [6]: [INFO] Starting TargetController
2022-08-28 20:18:34 CEST [TC] [7]: [INFO] Connecting to debug tool
2022-08-28 20:18:34 CEST [TC] [9]: [INFO] Debug tool connected
2022-08-28 20:18:34 CEST [TC] [10]: [INFO] Debug tool name: Atmel-ICE
2022-08-28 20:18:34 CEST [TC] [11]: [INFO] Debug tool serial: J41800031961
2022-08-28 20:18:34 CEST [TC] [12]: [INFO] Activating target
2022-08-28 20:18:37 CEST [TC] [14]: [WARNING] Failed to activate the debugWire physical interface - attempting to access targe
t via the ISP interface, for DWEN fuse bit inspection.                                                                         
2022-08-28 20:18:37 CEST [TC] [15]: [ERROR] The TargetController encountered a fatal error. See below for errors:
2022-08-28 20:18:37 CEST [TC] [16]: [ERROR] Failed to access/update DWEN fuse bit via ISP interface - Insufficient target info
rmation for ISP interface - do not use the generic "avr8" target name in conjunction with the ISP interface. Please update you
r target configuration.                                                                                                        
2022-08-28 20:18:37 CEST [TC] [17]: [INFO] Shutting down TargetController
2022-08-28 20:18:37 CEST [TC] [18]: [INFO] Deactivating target
2022-08-28 20:18:37 CEST [TC] [19]: [INFO] Closing debug tool
2022-08-28 20:18:37 CEST [MT] [21]: [ERROR] TargetController failed to startup.
2022-08-28 20:18:37 CEST [MT] [22]: [INFO] Shutting down Bloom
2022-08-28 20:18:37 CEST [SH] [27]: [INFO] Shutting down SignalHandler

 

I guess, this is due to the physical interface "debug-wire".

The atmega32u4 doesn't support that protokoll.

How is the keyword for ISP?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


 

sepp2gl wrote:

I guess, this is due to the physical interface "debug-wire".

 

Yeah that's the problem. You need to use the JTAG interface. See my previous post with the JTAG config for bloom.json.

 

Also, you need to make sure the Atmel-ICE is connected to the Atmega32u4 via the JTAG connection, not via ISP. So you can't use the ISP header on the Arduino Leonardo board.

 

Here's a pinout for the board:

 

 

And here's a pinout of the Atmel-ICE JTAG connector:

 

 

See https://onlinedocs.microchip.com... for more.

 

Nav

Last Edited: Sun. Aug 28, 2022 - 06:31 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

with the latest bloom.json, I sudoed bloom again,

then cycled the target power, and sudoed bloom:

2022-08-28 20:30:27 CEST [MT] [2]: [INFO] Selected environment: "default"
2022-08-28 20:30:27 CEST [TC] [5]: [INFO] Starting TargetController
2022-08-28 20:30:27 CEST [TC] [7]: [INFO] Connecting to debug tool
2022-08-28 20:30:27 CEST [TC] [9]: [INFO] Debug tool connected
2022-08-28 20:30:27 CEST [TC] [10]: [INFO] Debug tool name: Atmel-ICE
2022-08-28 20:30:27 CEST [TC] [11]: [INFO] Debug tool serial: J41800031961
2022-08-28 20:30:27 CEST [TC] [13]: [INFO] Activating target
2022-08-28 20:30:28 CEST [TC] [30]: [ERROR] The TargetController encountered a fatal error. See below for errors:
2022-08-28 20:30:28 CEST [TC] [31]: [ERROR] AVR8 Activate physical interface command failed - Failure reason: Target not found
2022-08-28 20:30:28 CEST [TC] [32]: [INFO] Shutting down TargetController
2022-08-28 20:30:28 CEST [TC] [33]: [INFO] Deactivating target
2022-08-28 20:30:28 CEST [TC] [34]: [INFO] Closing debug tool
2022-08-28 20:30:28 CEST [MT] [36]: [ERROR] TargetController failed to startup.
2022-08-28 20:30:28 CEST [MT] [37]: [INFO] Shutting down Bloom
2022-08-28 20:30:28 CEST [SH] [42]: [INFO] Shutting down SignalHandler

 

Now the yellow LED only blinks once, and thats it.

Nevertheless, we came further down the road, than ever before...

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sepp2gl wrote:

Nevertheless, we came further down the road, than ever before...

 

Looks like it's just the JTAG connection now. See the images posted in my previous post. Ensure that the Atmel-ICE is connected to the target via JTAG, then try Bloom again. Should work :)

Nav

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Concerning the JTAG-interface...how can I connect a 10-pin JTAG-plug to an Arduino 6-pin ISP-Jumper?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


sepp2gl wrote:

Concerning the JTAG-interface...how can I connect a 10-pin JTAG-plug to an Arduino 6-pin ISP-Jumper?

 

You need to use the 10-pin female connector on the 10/6-pin cable that should have been included with your Atmel-ICE:

 

You'll have to use some jumper wires to connect that to the Arduino.

Nav

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

...yes, I know. It is already in use...

It is part of the Atmel-ICE package.

Sorry, misunderstanding from my side.

 

Now that we have tackled the usb-issue...

...can it be, that we now have an issue with my avr-gdb version?

There is still this error-message:

2022-08-28 21:02:16 CEST [MT] [2]: [INFO] Selected environment: "default"
2022-08-28 21:02:16 CEST [TC] [6]: [INFO] Starting TargetController
2022-08-28 21:02:16 CEST [TC] [7]: [INFO] Connecting to debug tool
2022-08-28 21:02:16 CEST [TC] [9]: [INFO] Debug tool connected
2022-08-28 21:02:16 CEST [TC] [10]: [INFO] Debug tool name: Atmel-ICE
2022-08-28 21:02:16 CEST [TC] [11]: [INFO] Debug tool serial: J41800031961
2022-08-28 21:02:16 CEST [TC] [13]: [INFO] Activating target
2022-08-28 21:02:17 CEST [TC] [30]: [ERROR] The TargetController encountered a fatal error. See below for errors:
2022-08-28 21:02:17 CEST [TC] [31]: [ERROR] AVR8 Activate physical interface command failed - Failure reason: Target not found
2022-08-28 21:02:17 CEST [TC] [32]: [INFO] Shutting down TargetController
2022-08-28 21:02:17 CEST [TC] [33]: [INFO] Deactivating target
2022-08-28 21:02:17 CEST [TC] [34]: [INFO] Closing debug tool
2022-08-28 21:02:17 CEST [MT] [36]: [ERROR] TargetController failed to startup.
2022-08-28 21:02:17 CEST [MT] [37]: [INFO] Shutting down Bloom
2022-08-28 21:02:17 CEST [SH] [42]: [INFO] Shutting down SignalHandler

 

Last Edited: Sun. Aug 28, 2022 - 07:03 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sepp2gl wrote:

...can it be, that we now have an issue with my avr-gdb version?

There is still this error-message:

 

Have you connected the Atmel-ICE to the JTAG pins of the ATmega32U4? That error suggests that there is a broken connection between the Atmel-ICE and the target.  

Nav

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yes, so I did for sure.

Did we blow up the JTAG-interface on the Arduino (or even "better" the Atmel-ICE)?

The atmega32u4 is still up and working. I can still upload an executable via USB by Arduino-IDE.

 

Maybe I try another Arduino, e.g. an UNO. I haven't got further Leonardos.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hmm, maybe the JTAGEN fuse bit needs programming. But before we get into that, can you take a photo of the connection between the Atmel-ICE and your Arduino board and post it here? Please ensure that the photo clearly captures the jumper wire connections.

Nav

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

here it is

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


 

Ah, you're still using the 6-pin ISP connection. You can't use that ISP header. You must use jumper wires to connect the 10-pin female connector (on the Atmel-ICE ribbon cable) to the JTAG pins on the Arduino board (using the pinout diagrams I posted in a previous post).

 

Did your Atmel-ICE come with a 10-pin female -> female (50-mill -> 100-mil) cable? Like this:

If so, you may want to use that cable as the 100-mil female connectors are more accommodating of jumper wires.

 

This may also help:

 

Nav

Last Edited: Sun. Aug 28, 2022 - 07:41 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

???

I am using exactly the cable, that you shew at your post at 6:42 PM?

 

Yes, I have got also that 10-jumper-cable above. But: what do you want me to do with it?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

sepp2gl wrote:

???

I am using exactly the cable, that you shew at your post at 6:42 PM?

 

Yes, I have got also that 10-jumper-cable above. But: what do you want me to do with it?

 

 

You can use either cable, but the 50-mil -> 100-mil will be easier, as most jumper wires can be used with the 100-mil connectors.

 

Here's an example of what you need to do:

The jumper wires connect the Atmel-ICE to the target. You need to do the same, using the pinout for the pin sockets on the Arduino Leonardo board.

 

So connect pin 1 (on the 10-pin female connector) to pin A3 (TCK) (on the Arduino Leonardo board), then pin 2 to GND, then pin 3 to A1 (TDO), and so on, for all 10 pins (except pin 7, which can be left disconnected).

 

Once you've done that, the Atmel-ICE will be able to interface with the 32U4 target and you should be able to begin a debug session in Bloom.

 

Keep in mind that ISP and JTAG are two different interfaces. ISP only supports programming - you cannot perform debugging operations via ISP. This is why you need to connect to the target's JTAG interface for debugging.

 

Nav

Last Edited: Sun. Aug 28, 2022 - 08:13 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Holy sh..!

I think, I got the point.

So what you trying to tell me, is...

...Leonardo cannot be JTAG-debugged via the ISP interface.

Did I catch your point finally?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sepp2gl wrote:

Holy sh..!

I think, I got the point.

So what you trying to tell me, is...

...Leonardo cannot be JTAG-debugged via the ISP interface.

Did I catch your point finally?

 

Yes exactly. ISP cannot be used for debugging. This applies to all AVRs, not just the one on the Arduino Leonardo board. ISP can only be used for programming. But BTW, JTAG can also be used for programming, so once you've got the JTAG connection sorted, you can use Bloom to program the target and then you won't need to bother with ISP again.

Nav

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I need to think about it.

Normally the Leonardo is embedded into an application-specific board.

So I doubt, that I have the needed additional pins available for JTAG.

I will double check by tomorrow, what I can do about it.

 

Nevertheless: thanks a lot for your support, advice (and patience).

Bloom brought me quite far down the road, far enough to realize,

that I had wrong expectations about debugging with ISP.

Maybe I need to consider to replace Arduino for the project by compatible boards with JTAG-header.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sepp2gl wrote:

Nevertheless: thanks a lot for your support, advice (and patience).

Bloom brought me quite far down the road, far enough to realize,

that I had wrong expectations about debugging with ISP.

 

No problem!

Nav

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sepp2gl wrote:

My question: how do I need to parameterize ./configure to include it?

No as libusb exists before configure.

AVaRICE is somewhat rare in distributions.

 

Build log for avarice (2.14+svn427-1) on amd64

[immediately before mid-page]

	./configure --build=x86_64-linux-gnu --prefix=/usr --includedir=\${prefix}/include --mandir=\${prefix}/share/man --infodir=\${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --disable-option-checking --disable-silent-rules --libdir=\${prefix}/lib/x86_64-linux-gnu --runstatedir=/run --disable-maintainer-mode --disable-dependency-tracking

via Debian Package Tracker - avarice (right column for logs)

 

https://pkgs.org/search/?q=avarice

Show CrossToolchain:avr / avarice - openSUSE Build Service

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

@navnav:

In parallel I was in contact with a guy from openSuSE about avarice.

He included Bloom into the openSuSE cross-AVR repository.

see https://build.opensuse.org/packa...

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@gchapman:

I tried your ./configure sequence above.

--disable-maintainer-mode cause an error-message, so I skipped it.
The rest went through, see attached log-files.

But after make/make install there was still the same message "...was not compile with libusb...".

I have libusb-1_0-devel and libhidapi-devel installed.

 

No idea, what is wrong...

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@gchapman:

sorry, pls. find the respective log-files here...

Attachment(s): 

Last Edited: Tue. Aug 30, 2022 - 05:55 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sepp2gl wrote:

I tried your ./configure sequence above.

... which I copied from Debian (pedantic)

sepp2gl wrote:

No idea, what is wrong...

Am also at a loss for ideas; I'm confused by the few libusb that exist (guess is "wrong" libusb is installed or installed into a "different" directory)

Alternatively, AVaRICE is in an openSUSE package that was rebuilt as of yesterday.

Show CrossToolchain:avr / avarice - openSUSE Build Service

 

"Dare to be naïve." - Buckminster Fuller