Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avrdude fails at communicating with ATMEL-ICE in ISP mode with libusb-win32 device driver -- correct driver is Windows native HID driver #1617

Closed
dzalf opened this issue Jan 14, 2024 · 14 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@dzalf
Copy link

dzalf commented Jan 14, 2024

In line with an issue I raised in the avrdudess GUI repo I must report that avrdude cannot communicate with ATMEL-ICE in ISP mode despite multiple resintallations of the libusb32 drivers

However, the platformio avrdude version does work without a problem

Using the avrdude that comes with the GUI from avrdudess I am unable to communicate with the programmer

image

While when changing the avrdude target to the executable from pio the MCU gets detected without any problems:

image

Any ideas?

@mcuee mcuee added the unconfirmed Maybe a bug, needs to be reproduced by someone else label Jan 16, 2024
@mcuee
Copy link
Collaborator

mcuee commented Jan 16, 2024

Please use the official avrdude 7.2 release version to see if that helps.
https://github.com/avrdudes/avrdude/releases/tag/v7.2

@ZakKemble
Copy link

Please use the official avrdude 7.2 release version to see if that helps. https://github.com/avrdudes/avrdude/releases/tag/v7.2

This is the version that avrdudess currently ships with.

@mcuee
Copy link
Collaborator

mcuee commented Jan 17, 2024

@dzalf

Please do not use the GUI but rather use the command line and post the debug output using -vvvv. Thanks.

Or you can still use the GUI but use the highest verbosity level and then post the output.

@mcuee
Copy link
Collaborator

mcuee commented Jan 17, 2024

@dzalf

Yet the other debugging option -- use an alternative avrdude 7.2 binary and see if that helps. The following is my build using MSYS2 MinGW64.
https://github.com/mcuee/avrdude/releases/download/v7.2/avrdude-v7.2_mingw64.zip

The official avrdude 7.2 uses Windows MSVC64 build which may have issues with USB Compisite device.

@dzalf
Copy link
Author

dzalf commented Jan 18, 2024

@mcuee

Thanks for your input.

I tried using different official versions from Avrdude without any success. I am simply trying to "detect" the device however I cannot communicate with the programmer.

I will try in the command line and report back.

One thing that I noticed is that pio uses an old version from back in 2016 (I was unable to determine exactly which one)

@mcuee
Copy link
Collaborator

mcuee commented Jan 19, 2024

@dzalf

One more try -- are you using the official driver from Microchip/Atmel? I do not have Atmel ICE so I do not know.

It seems to me Microchip/Atmel is now using WinUSB driver more often for the tools (other than those USB HID devices). But I am not so sure about older tools like Atmel ICE.

@mcuee
Copy link
Collaborator

mcuee commented Jan 19, 2024

@dzalf

It seems to me that Atmel ICE should use native USB HID driver for AVR programming. Please use the Windows default USB HID driver and not libusb-win32 driver. Older version of avrdude does not support hidapi and that was why libusb-win32 driver was used. You should NOT use that if it is an USB HID device.

Similar issues:

Reference:
https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-ICE_UserGuide.pdf

The Atmel-ICE communicates primarily using a standard HID interface, and does not require a special
driver on the host computer. To use the advanced Data Gateway functionality of the Atmel-ICE, be sure to
install the USB driver on the host computer. This is done automatically when installing the front-end
software provided free by Atmel. See www.atmel.com for further information or to download the latest
front-end software.

@mcuee mcuee changed the title avrdude fails at communicating with ATMEL-ICE in ISP mode. Correct drivers installed avrdude fails at communicating with ATMEL-ICE in ISP mode with libusb-win32 device driver Jan 19, 2024
@mcuee mcuee changed the title avrdude fails at communicating with ATMEL-ICE in ISP mode with libusb-win32 device driver avrdude fails at communicating with ATMEL-ICE in ISP mode with libusb-win32 device driver -- correct driver is Windows native HID driver Jan 19, 2024
@mcuee mcuee added invalid This doesn't seem right and removed unconfirmed Maybe a bug, needs to be reproduced by someone else labels Jan 19, 2024
@mcuee mcuee closed this as completed Jan 19, 2024
@mcuee
Copy link
Collaborator

mcuee commented Jan 19, 2024

I will close this issue for now. Please reopen this issue if you still encounter the issue with the correct Windows native HID driver.

@mcuee
Copy link
Collaborator

mcuee commented Jan 19, 2024

@dzalf
Copy link
Author

dzalf commented Jan 20, 2024

@dzalf

One more try -- are you using the official driver from Microchip/Atmel? I do not have Atmel ICE so I do not know.

It seems to me Microchip/Atmel is now using WinUSB driver more often for the tools (other than those USB HID devices). But I am not so sure about older tools like Atmel ICE.

I have to report that on a new PC I could run the programmer without any issues on avrdude 7.2 using the stock driver from Microchip Studio.

However, on the original PC where I ran my initial tests, I cannot revert back to HID or WinUSB driver. The device simply cannot be detected. I have tried MULTIPLE solutions I found online without any success.

No matter what I do to try to uninstall the libusbK or libusb-win32 Windows 11 reverts back to those after uninstalling and replugging the programmer.

I have updated Microchip Studio and repaired it however I am unable to find the right driver.

Installing the WinUSB driver from Zadig doesn't help either.

Any ideas?

@mcuee
Copy link
Collaborator

mcuee commented Jan 20, 2024

WInUSB driver is also not the correct driver due to the following known bug, which is of lower priority to fix since the correct driver is USB HID.

You have to revert to the default Windows USB HID driver.

@mcuee mcuee added duplicate This issue or pull request already exists bug Something isn't working and removed duplicate This issue or pull request already exists invalid This doesn't seem right labels Jan 20, 2024
@mcuee
Copy link
Collaborator

mcuee commented Jan 20, 2024

BTW, I have changed the label to bug to be in line with Issue #1221. But then it is a duplicate.

@dzalf
Copy link
Author

dzalf commented Jan 20, 2024

Dear @mcuee

I truly appreciate your continuous support on this.

After several attempts to remove drivers and not being able to find the HID drivers online, I suddenly made it work. However, I cannot pinpoint what the solution was. Right now, I can only see "Interface 1" under a libusb-win32 driver, however, the CMSIS-DAP was fortunately (and magically) configured by Windows under the HID driver:

image image

Something that I did to make it possible to continue working on my project with VSCode+ pio while using the latest version of avrdude was to replace the stock old version that comes by default with the pio environment with the latest version available here. This way, I can use either pio, avrdude or the GUI tool at the same time.

Just to be clear, the reason why I jump between different ways of flashing my MCUs is that for quick debugging purposes I flash a test hex into my board and the easiest way to do that is via avrdudess (simply by loading the hex file) while for regular flashing of new code, I do it directly from VSCode.

Previously, my workflow demanded using the drivers from Zadig, however, based on this issue and your kind explanations I have learnt that the way to manage the drivers with the latest revision is by NOT using the Zadig drivers anymore. I have even read that one should avoid at all costs using them since Zadig's tool does not offer the option to revert back to the HID driver (which is true).

I will try to replicate this on another PC to make sure that the issue is fully solved. In the future I will slap myself to remind me not to install any alternative drivers with new avrdude versions 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants