Xplained Nano mEDBG no connection

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

Some days I got my new xplained nano board, but I have some problems with it.

I wanted to use avrdude to program the chip, but unfornately I the newest version for my fedora is not able to program a ATtiny416.

Threrefor I checked out the avrdude svn and built it myself, but this did not solve my problem completely.

 

I execute the following command I get this errors:

./avrdude -p t416 -c xplainedmini -n -C avrdude.conf #-n is used for testing

avrdude: usbdev_open(): WARNING: failed to set configuration 1: Device or resource busy
avrdude: jtag3_edbg_recv(): Inconsistent fragment number; expect 1, got 0
avrdude: failed to sync with the JTAGICE3 in ISP mode

 

When I use dmesg I get the following data:

[10506.212491] usb 1-1: new full-speed USB device number 28 using xhci_hcd
[10506.344894] usb 1-1: New USB device found, idVendor=03eb, idProduct=2145
[10506.344899] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[10506.344902] usb 1-1: Product: mEDBG CMSIS-DAP
[10506.344905] usb 1-1: Manufacturer: ATMEL
[10506.344907] usb 1-1: SerialNumber: ATML2795041800001259
[10506.347437] hid-generic 0003:03EB:2145.0018: hiddev96,hidraw0: USB HID v1.11 Device [ATMEL mEDBG CMSIS-DAP] on usb-0000:00:14.0-1/input0
[10506.347653] cdc_acm 1-1:1.1: ttyACM0: USB ACM device
[10509.939904] usb 1-1: usbfs: interface 0 claimed by usbhid while 'avrdude' sets config #1
[10524.652757] usb 1-1: usbfs: interface 1 claimed by cdc_acm while 'avrdude' sets config #1

 

I tried to fix this issue using the following udev rules, not all from me, some stuff is coppied from the internet

# Atmel Corp. xplained mini
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2145", MODE="0660", GROUP="uucp"

SUBSYSTEM=="input", GROUP="input", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2145", MODE:="666", GROUP="users"

SUBSYSTEMS=="usb", DRIVERS=="usbhid", ACTION=="add", ATTR{authorized}="0"

 

Nontheless these rules did not help, even after udev reload and restart of my computer.

I hope somebody nows what this problem is about or knows a better tool for programming the chip/board.

Last Edited: Sat. Mar 3, 2018 - 08:37 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think this object of this forum is for people who are implementing linux-based systems on Atmel ships - not for user-level support.

 

You would probably be better off asking in the AVR section: https://www.avrfreaks.net/forums/evaluation-and-development-kits-avr-related

 

A moderator will be able to move it ...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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

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

LehrCh wrote:
[10509.939904] usb 1-1: usbfs: interface 0 claimed by usbhid while 'avrdude' sets config #1
[10524.652757] usb 1-1: usbfs: interface 1 claimed by cdc_acm while 'avrdude' sets config #1
mEDBG is enumerating correctly then that in the quote.

Was AVRDUDE configured for libhidapi?

Reason : post AVRDUDE 6.3 -

http://svn.savannah.gnu.org/viewvc/avrdude/trunk/avrdude/NEWS?revision=1425&view=markup

...

[libhidapi - 2 lines]

...

 

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

Last Edited: Sun. Mar 4, 2018 - 03:42 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In Avrdude when specifying the tool you also specify the interface. When you specify programmer by typing "-c xplainedmini" you specify the ISP interface. The tiny416 doesn't have ISP interface. The tiny416 has a UPDI interface, and to specify that you need to type "-c xplainedmini_updi".

 

The support for UPDI and the new tiny's and mega's has not been included in a release yet, so to get that support you have to build Avrdude yourself from svn trunk.

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

gchapman wrote:

LehrCh wrote:
... or knows a better tool for programming the chip/board.
Not better, different :

 

 

Actually, as author of this one, let me recommend instead https://github.com/ElTangas/jtag... which is more geared towards avrdude. But how to connect it? You would have to somehow disconnect the mEDBG to avoid conflicts. I created this software to program bare chips and not dev boards with their own embedded programmer.

Last Edited: Sun. Mar 4, 2018 - 10:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

El Tangas wrote:
You would have to somehow disconnect the mEDBG to avoid conflicts.
On page 2 of the design document for tiny416 Xplained Nano, there's R200 (1KR) that connects signal DBG to signal PA0_UPDI.

ATtiny416 Xplained Nano

http://ww1.microchip.com/downloads/en/DeviceDoc/50002683A.pdf

(page 9, bottom)

3.4 Disconnecting mEDBG

The target device can be completely separated from the mEDBG, but this requires some small modifications to the board using a soldering iron. By removing the resistors in the sections shown in the figure below, the mEDBG is completely disconnected from the target controller. If desired to connect the mEDBG again, solder in 0Ω resistors or solder in 100-mil headers on the header footprints and use wirestraps to connect the interfaces.

via http://www.microchip.com/developmenttools/productdetails.aspx?partno=attiny416-xnano

 

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

Last Edited: Sun. Mar 4, 2018 - 11:17 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

gchapman wrote:

Was AVRDUDE configured for libhidapi?

How can I do that?

 

je_ruud wrote:

.... you have to build Avrdude yourself from svn trunk.

I already did that.

 

gchapman wrote:

El Tangas wrote:

You would have to somehow disconnect the mEDBG to avoid conflicts.

On page 2 of the design document for tiny416 Xplained Nano, there's R200 (1KR) that connects signal DBG to

Would rather not do that.

je_ruud wrote:
The tiny416 has a UPDI interface, and to specify that you need to type "-c xplainedmini_updi".

I tried that and I got the same error.

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

LehrCh wrote:
How can I do that?
Try installing libhidapi and re-doing configure and make.

But, I don't know which libhidapi :

https://packages.debian.org/search?keywords=hidapi&searchon=names&suite=all&section=all

 

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

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

LehrCh wrote:

 

je_ruud wrote:
The tiny416 has a UPDI interface, and to specify that you need to type "-c xplainedmini_updi".

I tried that and I got the same error.

In the OP you printed a log where you clearly was using "-c xplainedmini", which is selecting ISP, not UPDI. What error do you get when you use "-c xplainedmini_updi"?

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

je_ruud wrote:

LehrCh wrote:

 

je_ruud wrote:
The tiny416 has a UPDI interface, and to specify that you need to type "-c xplainedmini_updi".

 

I tried that and I got the same error.

In the OP you printed a log where you clearly was using "-c xplainedmini", which is selecting ISP, not UPDI. What error do you get when you use "-c xplainedmini_updi"?

When I read your reply I tried using the xplainedmini_updi option and thought posting the same error is useless.

 

I update the orignal posting.

 

gchapman wrote:
LehrCh wrote: How can I do that? Try installing libhidapi and re-doing configure and make. But, I don't know which libhidapi : https://packages.debian.org/sear...§ion=all

 

I installed libhidapi,libhid and libhid-devel but I get the following error when i ran configure before build:

DON'T HAVE libftdi
DON'T HAVE libhid
DON'T HAVE libhidapi

 

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

Continuing this thread, which was helpful to me..

It seems that libhid is hard to find. Is it necessary? Or is libhidapi enough?

 

When building avrdude with the latter only, and trying to load code onto an xplainedmini, I get:

 

$ ./avrdude -C avrdude.conf -p t817 -c xplainedmini_updi -U flash:w:~/devel/avr/xplainedmini/main.hex
avrdude: jtag3_edbg_recv(): Inconsistent fragment number; expect 1, got 0

avrdude done.  Thank you.

 

Any ideas?

 

Long time AVR user but more fond of analog electronics than compiler details...

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

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

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

Do I have to manually apply such patches? How do I do that?

Is there a branch where they already have been applied?

Long time AVR user but more fond of analog electronics than compiler details...

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

vfz wrote:
Do I have to manually apply such patches? How do I do that?
I looked at the latest on the master branch and it does not have the changes. So, yes, you would need to pull the master then use the Linux patch command (or similar) to apply the diffs.
vfz wrote:
Is there a branch where they already have been applied?
In the source tree I only see two branches, one of which is 7 years old and the other is 18 years(!) old so, no, I don't think there's a branch with the patch applied.

 

What you might do is try and contact the author of that bugzilla based patch and see if he has a build with the changes applied (presumably he built/tested the change!)

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

clawson wrote:

In the source tree I only see two branches, one of which is 7 years old and the other is 18 years(!)

I used what is in "trunk" which seems to be 5 months old. (Using 7 years old code would probably not recognize the xplainedmini at all..)

But the patch is less than 5 months old so I guess I'll have to apply it manually.

There is also the repo at https://github.com/facchinm/avrdude which is updated more recently. But building with this source gives me the same error message.

 

Long time AVR user but more fond of analog electronics than compiler details...

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

Ok, I applied the patch but it didn't change anything. I also tried with build flags as suggested by the author ( https://lists.nongnu.org/archive... ) but neither that helped :(

Long time AVR user but more fond of analog electronics than compiler details...

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

vfz wrote:
But building with this source gives me the same error message.
Maybe an old mEDBG on the mega32U4.

Hopefully Atmel Studio 7's automatic firmware update will solve that issue; latest firmware should be with Atmel Studio.

 

ATtiny817 Xplained Mini

Atmel Studio 7 - Manual Upgrade

 

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

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

gchapman wrote:

 

Hopefully Atmel Studio 7's automatic firmware update will solve that issue; latest firmware should be with Atmel Studio.

 

 

 

Thanks, I tried that. But no difference.

(And Atmel Studio is a beast - don't want to use it, don't want to use Windows..)

 

What other programmers are good/better for the UPDI chips? Which are proven to work fine with avrdude?

Long time AVR user but more fond of analog electronics than compiler details...

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

pyupdi or one its forks? 

https://github.com/mraardvark/py...

 

just needs a CDC.

 

(not avrdude-compatible though)

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

mraardvark wrote:
pyupdi or one its forks?

Thanks, yes, this seems as the way to do it. I put a mega328p on a proto board and tried jtag2updi ( https://github.com/ElTangas/jtag... )  with avrdude. Worked fine when I lowered buadrates from the default values. But hooking up the serial interface directly on UPDI seems even easier!

( Why do Microchip not promote these simple solutions? It would surely draw attention to their chips and create more business. )

Long time AVR user but more fond of analog electronics than compiler details...