Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Apr 2022 19:40:59 +0200
From:      Tomek CEDRO <tomek@cedro.info>
To:        Hans Petter Selasky <hps@selasky.org>
Cc:        Axel Rau <Axel.Rau@chaos1.de>, hardware@freebsd.org
Subject:   Re: timeouts on USB ISP programmer
Message-ID:  <CAFYkXjmjnFX1a3%2BCQxAxdwX=-oASSEWLdzrmx=%2B4QbX3_Og2Gw@mail.gmail.com>
In-Reply-To: <CAFYkXj=HMdxZG%2B8x0gpLCDy8cbu_qOpFqcN37RO9EG=WOBHkqw@mail.gmail.com>
References:  <3A781DFA-1E2C-41A5-8053-C90A806244DC@Chaos1.DE> <34a747ea-2ee5-660f-71c6-dc00d5de337f@selasky.org> <9334c4f0-3ecf-c046-420f-516e39379981@selasky.org> <976BDBEB-8B57-4541-A0B7-3F2C89498DC6@Chaos1.DE> <7190bdde-22bc-79ee-06d0-d0114a3ffbad@selasky.org> <CAFYkXj=HMdxZG%2B8x0gpLCDy8cbu_qOpFqcN37RO9EG=WOBHkqw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Sorry, this time a reply that is subscribed to the list :-)

Hello world :-)

Short story:
* Try `-P usb:/dev/cuaU0` parameter. You need to use `usb:` prefix for
the USB adapter.
* Did that interface worked well on other OS with avrdude 6.4 (we
currently have 6.3 port on FreeBSD)?
* I have encountered similar issue with VID:PID pair on my
ATtiny416XNANO board. This needs patching the upstream. But port uses
several local patched to build on FreeBSD that are not part of the
upstream. We have to make upstream build cleanly on FreeBSD in the
first place :-)

Long story:
I have some Attiny104XplainedNano and Attiny416XplainedNano develkits
we can play with. I will provide example step by step documentation
that helps solving problems and that got me into conslusions presented
above :-)

Best regards :-)
Tomek


== OS ==

FreeBSD hexagon 13.1-STABLE FreeBSD 13.1-STABLE #0
stable/13-n250096-4f69c575996: Fri Mar 25 03:50:58 CET 2022
root@hexagon:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64


== ATtiny416XplainedNano ==

# dmesg | tail
ugen0.8: <ATMEL mEDBG CMSIS-DAP> at usbus0
usbhid4 on uhub15
usbhid4: <ATMEL mEDBG CMSIS-DAP, class 239/2, rev 2.00/10.00, addr 7> on usbus0
hidbus4: <HID bus> on usbhid4
umodem0 on uhub15
umodem0: <ATMEL mEDBG CMSIS-DAP, class 239/2, rev 2.00/10.00, addr 7> on usbus0
umodem0: data interface 2, has CM over data, has break

 # usbconfig -d 0.8 dump_device_desc
ugen0.8: <ATMEL mEDBG CMSIS-DAP> at usbus0, cfg=0 md=HOST spd=FULL
(12Mbps) pwr=ON (100mA)
  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x00ef  <Miscellaneous device>
  bDeviceSubClass = 0x0002
  bDeviceProtocol = 0x0001
  bMaxPacketSize0 = 0x0020
  idVendor = 0x03eb
  idProduct = 0x2145
  bcdDevice = 0x1000
  iManufacturer = 0x0001  <ATMEL>
  iProduct = 0x0002  <mEDBG CMSIS-DAP>
  iSerialNumber = 0x0003  <ATML2795042700003537>
  bNumConfigurations = 0x0001


== ATtiny416XplainedNano ==

# dmesg | tail
ugen0.8: <ATMEL mEDBG CMSIS-DAP> at usbus0 (disconnected)
usbhid4: at uhub15, port 4, addr 7 (disconnected)
hidbus4: detached
usbhid4: detached
umodem0: at uhub15, port 4, addr 7 (disconnected)
umodem0: detached
ugen0.8: <ATMEL mEDBG CMSIS-DAP> at usbus0
usbhid4 on uhub15
usbhid4: <ATMEL mEDBG CMSIS-DAP, class 239/2, rev 2.00/10.00, addr 7> on usbus0
hidbus4: <HID bus> on usbhid4
umodem0 on uhub15
umodem0: <ATMEL mEDBG CMSIS-DAP, class 239/2, rev 2.00/10.00, addr 7> on usbus0
umodem0: data interface 2, has CM over data, has break

# usbconfig -d 0.8 dump_device_desc
ugen0.8: <ATMEL mEDBG CMSIS-DAP> at usbus0, cfg=0 md=HOST spd=FULL
(12Mbps) pwr=ON (100mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x00ef  <Miscellaneous device>
  bDeviceSubClass = 0x0002
  bDeviceProtocol = 0x0001
  bMaxPacketSize0 = 0x0020
  idVendor = 0x03eb
  idProduct = 0x2145
  bcdDevice = 0x1000
  iManufacturer = 0x0001  <ATMEL>
  iProduct = 0x0002  <mEDBG CMSIS-DAP>
  iSerialNumber = 0x0003  <ATML2678020200009059>
  bNumConfigurations = 0x0001


== AVRDUDE PART ==

% avrdude -c "?"

Valid programmers are:
  2232HIO          = FT2232H based generic programmer
  4232h            = FT4232H based generic programmer
  arduino          = Arduino
  arduino-ft232r   = Arduino: FT232R connected to ISP
  atmelice         = Atmel-ICE (ARM/AVR) in JTAG mode
  atmelice_dw      = Atmel-ICE (ARM/AVR) in debugWIRE mode
  atmelice_isp     = Atmel-ICE (ARM/AVR) in ISP mode
  atmelice_pdi     = Atmel-ICE (ARM/AVR) in PDI mode
  atmelice_updi    = Atmel-ICE (ARM/AVR) in UPDI mode
  avr109           = Atmel AppNote AVR109 Boot Loader
  avr910           = Atmel Low Cost Serial Programmer
  avr911           = Atmel AppNote AVR911 AVROSP
  avrftdi          = FT2232D based generic programmer
  avrisp           = Atmel AVR ISP
  avrisp2          = Atmel AVR ISP mkII
  avrispmkII       = Atmel AVR ISP mkII
  avrispv2         = Atmel AVR ISP V2
  buspirate        = The Bus Pirate
  buspirate_bb     = The Bus Pirate (bitbang interface, supports TPI)
  butterfly        = Atmel Butterfly Development Board
  butterfly_mk     = Mikrokopter.de Butterfly
  bwmega           = BitWizard ftdi_atmega builtin programmer
  C232HM           = FT232H based module from FTDI and Glyn.com.au
  c2n232i          = serial port banging, reset=dtr sck=!rts mosi=!txd miso=!cts
  dasa             = serial port banging, reset=rts sck=dtr mosi=txd miso=cts
  dasa3            = serial port banging, reset=!dtr sck=rts mosi=txd miso=cts
  diecimila        = alias for arduino-ft232r
  dragon_dw        = Atmel AVR Dragon in debugWire mode
  dragon_hvsp      = Atmel AVR Dragon in HVSP mode
  dragon_isp       = Atmel AVR Dragon in ISP mode
  dragon_jtag      = Atmel AVR Dragon in JTAG mode
  dragon_pdi       = Atmel AVR Dragon in PDI mode
  dragon_pp        = Atmel AVR Dragon in PP mode
  ehajo-isp        = avr-isp-programmer from eHaJo, http://www.eHaJo.de
  flip1            = FLIP USB DFU protocol version 1 (doc7618)
  flip2            = FLIP USB DFU protocol version 2 (AVR4023)
  ft232r           = FT232R Synchronous BitBang
  ft245r           = FT245R Synchronous BitBang
  iseavrprog       = USBtiny-based USB programmer,
https://github.com/IowaScaledEngineering/ckt-avrp
  jtag1            = Atmel JTAG ICE (mkI)
  jtag1slow        = Atmel JTAG ICE (mkI)
  jtag2            = Atmel JTAG ICE mkII
  jtag2avr32       = Atmel JTAG ICE mkII im AVR32 mode
  jtag2dw          = Atmel JTAG ICE mkII in debugWire mode
  jtag2fast        = Atmel JTAG ICE mkII
  jtag2isp         = Atmel JTAG ICE mkII in ISP mode
  jtag2pdi         = Atmel JTAG ICE mkII PDI mode
  jtag2slow        = Atmel JTAG ICE mkII
  jtag3            = Atmel AVR JTAGICE3 in JTAG mode
  jtag3dw          = Atmel AVR JTAGICE3 in debugWIRE mode
  jtag3isp         = Atmel AVR JTAGICE3 in ISP mode
  jtag3pdi         = Atmel AVR JTAGICE3 in PDI mode
  jtag3updi        = Atmel AVR JTAGICE3 in UPDI mode
  jtagkey          = Amontec JTAGKey, JTAGKey-Tiny and JTAGKey2
  jtagmkI          = Atmel JTAG ICE (mkI)
  jtagmkII         = Atmel JTAG ICE mkII
  jtagmkII_avr32   = Atmel JTAG ICE mkII im AVR32 mode
  lm3s811          = Luminary Micro LM3S811 Eval Board (Rev. A)
  mib510           = Crossbow MIB510 programming board
  mkbutterfly      = Mikrokopter.de Butterfly
  nibobee          = NIBObee
  o-link           = O-Link, OpenJTAG from www.100ask.net
  openmoko         = Openmoko debug board (v3)
  pavr             = Jason Kyle's pAVR Serial Programmer
  pickit2          = MicroChip's PICkit2 Programmer
  pickit4_updi     = MPLAB(R) PICkit 4 in UPDI mode
  pkobn_updi       = Curiosity nano (nEDBG) in UPDI mode
  ponyser          = design ponyprog serial, reset=!txd sck=rts
mosi=dtr miso=cts
  powerdebugger    = Atmel PowerDebugger (ARM/AVR) in JTAG mode
  powerdebugger_dw = Atmel PowerDebugger (ARM/AVR) in debugWire mode
  powerdebugger_isp = Atmel PowerDebugger (ARM/AVR) in ISP mode
  powerdebugger_pdi = Atmel PowerDebugger (ARM/AVR) in PDI mode
  powerdebugger_updi = Atmel PowerDebugger (ARM/AVR) in UPDI mode
  siprog           = Lancos SI-Prog <http://www.lancos.com/siprogsch.html>;
  snap_updi        = MPLAB(R) SNAP in UPDI mode
  stk500           = Atmel STK500
  stk500hvsp       = Atmel STK500 V2 in high-voltage serial programming mode
  stk500pp         = Atmel STK500 V2 in parallel programming mode
  stk500v1         = Atmel STK500 Version 1.x firmware
  stk500v2         = Atmel STK500 Version 2.x firmware
  stk600           = Atmel STK600
  stk600hvsp       = Atmel STK600 in high-voltage serial programming mode
  stk600pp         = Atmel STK600 in parallel programming mode
  tc2030           = Tag-Connect TC2030
  ttl232r          = FTDI TTL232R-5V with ICSP adapter
  tumpa            = TIAO USB Multi-Protocol Adapter
  UM232H           = FT232H based module from FTDI and Glyn.com.au
  uncompatino      = uncompatino with all pairs of pins shorted
  usbasp           = USBasp, http://www.fischl.de/usbasp/
  usbasp-clone     = Any usbasp clone with correct VID/PID
  usbtiny          = USBtiny simple USB programmer,
https://learn.adafruit.com/usbtinyisp
  wiring           = Wiring
  xbee             = XBee Series 2 Over-The-Air (XBeeBoot)
  xplainedmini     = Atmel AVR XplainedMini in ISP mode
  xplainedmini_dw  = Atmel AVR XplainedMini in debugWIRE mode
  xplainedmini_updi = Atmel AVR XplainedMini in UPDI mode
  xplainedpro      = Atmel AVR XplainedPro in JTAG mode
  xplainedpro_updi = Atmel AVR XplainedPro in UPDI mode

% avrdude -p "?"

Valid parts are:
  uc3a0512 = AT32UC3A0512
  c128     = AT90CAN128
  c32      = AT90CAN32
  c64      = AT90CAN64
  pwm2     = AT90PWM2
  pwm216   = AT90PWM216
  pwm2b    = AT90PWM2B
  pwm3     = AT90PWM3
  pwm316   = AT90PWM316
  pwm3b    = AT90PWM3B
  1200     = AT90S1200
  2313     = AT90S2313
  2333     = AT90S2333
  2343     = AT90S2343
  4414     = AT90S4414
  4433     = AT90S4433
  4434     = AT90S4434
  8515     = AT90S8515
  8535     = AT90S8535
  usb1286  = AT90USB1286
  usb1287  = AT90USB1287
  usb162   = AT90USB162
  usb646   = AT90USB646
  usb647   = AT90USB647
  usb82    = AT90USB82
  m103     = ATmega103
  m128     = ATmega128
  m1280    = ATmega1280
  m1281    = ATmega1281
  m1284    = ATmega1284
  m1284p   = ATmega1284P
  m1284rfr2 = ATmega1284RFR2
  m128rfa1 = ATmega128RFA1
  m128rfr2 = ATmega128RFR2
  m16      = ATmega16
  m1608    = ATmega1608
  m1609    = ATmega1609
  m161     = ATmega161
  m162     = ATmega162
  m163     = ATmega163
  m164p    = ATmega164P
  m168     = ATmega168
  m168p    = ATmega168P
  m168pb   = ATmega168PB
  m169     = ATmega169
  m16u2    = ATmega16U2
  m2560    = ATmega2560
  m2561    = ATmega2561
  m2564rfr2 = ATmega2564RFR2
  m256rfr2 = ATmega256RFR2
  m32      = ATmega32
  m3208    = ATmega3208
  m3209    = ATmega3209
  m324a    = ATmega324A
  m324p    = ATmega324P
  m324pa   = ATmega324PA
  m324pb   = ATmega324PB
  m325     = ATmega325
  m3250    = ATmega3250
  m328     = ATmega328
  m328p    = ATmega328P
  m328pb   = ATmega328PB
  m329     = ATmega329
  m3290    = ATmega3290
  m3290p   = ATmega3290P
  m329p    = ATmega329P
  m32m1    = ATmega32M1
  m32u2    = ATmega32U2
  m32u4    = ATmega32U4
  m406     = ATMEGA406
  m48      = ATmega48
  m4808    = ATmega4808
  m4809    = ATmega4809
  m48p     = ATmega48P
  m48pb    = ATmega48PB
  m64      = ATmega64
  m640     = ATmega640
  m644     = ATmega644
  m644p    = ATmega644P
  m644rfr2 = ATmega644RFR2
  m645     = ATmega645
  m6450    = ATmega6450
  m649     = ATmega649
  m6490    = ATmega6490
  m64m1    = ATmega64M1
  m64rfr2  = ATmega64RFR2
  m8       = ATmega8
  m808     = ATmega808
  m809     = ATmega809
  m8515    = ATmega8515
  m8535    = ATmega8535
  m88      = ATmega88
  m88p     = ATmega88P
  m88pb    = ATmega88PB
  m8a      = ATmega8A
  m8u2     = ATmega8U2
  t10      = ATtiny10
  t11      = ATtiny11
  t12      = ATtiny12
  t13      = ATtiny13
  t15      = ATtiny15
  t1604    = ATtiny1604
  t1606    = ATtiny1606
  t1607    = ATtiny1607
  t1614    = ATtiny1614
  t1616    = ATtiny1616
  t1617    = ATtiny1617
  t1624    = ATtiny1624
  t1626    = ATtiny1626
  t1627    = ATtiny1627
  t1634    = ATtiny1634
  t20      = ATtiny20
  t202     = ATtiny202
  t204     = ATtiny204
  t212     = ATtiny212
  t214     = ATtiny214
  t2313    = ATtiny2313
  t24      = ATtiny24
  t25      = ATtiny25
  t26      = ATtiny26
  t261     = ATtiny261
  t28      = ATtiny28
  t3216    = ATtiny3216
  t3217    = ATtiny3217
  t4       = ATtiny4
  t40      = ATtiny40
  t402     = ATtiny402
  t404     = ATtiny404
  t406     = ATtiny406
  t412     = ATtiny412
  t414     = ATtiny414
  t416     = ATtiny416
  t417     = ATtiny417
  t424     = ATtiny424
  t426     = ATtiny426
  t427     = ATtiny427
  t4313    = ATtiny4313
  t43u     = ATtiny43u
  t44      = ATtiny44
  t441     = ATtiny441
  t45      = ATtiny45
  t461     = ATtiny461
  t5       = ATtiny5
  t804     = ATtiny804
  t806     = ATtiny806
  t807     = ATtiny807
  t814     = ATtiny814
  t816     = ATtiny816
  t817     = ATtiny817
  t824     = ATtiny824
  t826     = ATtiny826
  t827     = ATtiny827
  t84      = ATtiny84
  t841     = ATtiny841
  t85      = ATtiny85
  t861     = ATtiny861
  t88      = ATtiny88
  t9       = ATtiny9
  x128a1   = ATxmega128A1
  x128a1d  = ATxmega128A1revD
  x128a1u  = ATxmega128A1U
  x128a3   = ATxmega128A3
  x128a3u  = ATxmega128A3U
  x128a4   = ATxmega128A4
  x128a4u  = ATxmega128A4U
  x128b1   = ATxmega128B1
  x128b3   = ATxmega128B3
  x128c3   = ATxmega128C3
  x128d3   = ATxmega128D3
  x128d4   = ATxmega128D4
  x16a4    = ATxmega16A4
  x16a4u   = ATxmega16A4U
  x16c4    = ATxmega16C4
  x16d4    = ATxmega16D4
  x16e5    = ATxmega16E5
  x192a1   = ATxmega192A1
  x192a3   = ATxmega192A3
  x192a3u  = ATxmega192A3U
  x192c3   = ATxmega192C3
  x192d3   = ATxmega192D3
  x256a1   = ATxmega256A1
  x256a3   = ATxmega256A3
  x256a3b  = ATxmega256A3B
  x256a3bu = ATxmega256A3BU
  x256a3u  = ATxmega256A3U
  x256c3   = ATxmega256C3
  x256d3   = ATxmega256D3
  x32a4    = ATxmega32A4
  x32a4u   = ATxmega32A4U
  x32c4    = ATxmega32C4
  x32d4    = ATxmega32D4
  x32e5    = ATxmega32E5
  x384c3   = ATxmega384C3
  x384d3   = ATxmega384D3
  x64a1    = ATxmega64A1
  x64a1u   = ATxmega64A1U
  x64a3    = ATxmega64A3
  x64a3u   = ATxmega64A3U
  x64a4    = ATxmega64A4
  x64a4u   = ATxmega64A4U
  x64b1    = ATxmega64B1
  x64b3    = ATxmega64B3
  x64c3    = ATxmega64C3
  x64d3    = ATxmega64D3
  x64d4    = ATxmega64D4
  x8e5     = ATxmega8E5
  avr128da28 = AVR128DA28
  avr128da32 = AVR128DA32
  avr128da48 = AVR128DA48
  avr128da64 = AVR128DA64
  avr128db28 = AVR128DB28
  avr128db32 = AVR128DB32
  avr128db48 = AVR128DB48
  avr128db64 = AVR128DB64
  avr32da28 = AVR32DA28
  avr32da32 = AVR32DA32
  avr32da48 = AVR32DA48
  avr32db28 = AVR32DB28
  avr32db32 = AVR32DB32
  avr32db48 = AVR32DB48
  avr64da28 = AVR64DA28
  avr64da32 = AVR64DA32
  avr64da48 = AVR64DA48
  avr64da64 = AVR64DA64
  avr64db28 = AVR64DB28
  avr64db32 = AVR64DB32
  avr64db48 = AVR64DB48
  avr64db64 = AVR64DB64
  ucr2     = deprecated, use 'uc3a0512'
  lgt8fx168p = LGT8FX168P
  lgt8fx328p = LGT8FX328P
  lgt8fx88p = LGT8FX88P


% avrdude -c "?" 2>&1| grep -i diamex
(no result)

Diamex device is not in the list of the supported programmers of
avrdude. You or Diamex will have to create and provide configuration
to that interface so it is available to everyone :-)

This is Open-Source project at:
https://github.com/avrdudes/avrdude

Nothing about Diamex mentioned in the repo:
https://github.com/avrdudes/avrdude/search?q=diamex

% avrdude -p "?" 2>&1| grep -i tiny104
(no result)

Looks like we have no use with ATtiny104 board bacause target is not supported.

% avrdude -p "?" 2>&1| grep -i tiny416
  t416     = ATtiny416

But we can play with the ATtiny416 board :-)

Also I have somewhere ATtiny10 purchased for one project, so I could
solder that quickly and use ATtiny104XNANO as the programmer for
ATtiny10 if necessary.


== Memory Access ==

hexagon% avrdude -c xplainedmini -p t416 -P usb:/dev/cuaU0
avrdude: jtag3_open_common(): Did not find any device matching VID
0x03eb and PID list: 0x2145

avrdude done.  Thank you.

hexagon% avrdude -c xplainedmini_updi -p t416 -P usb:/dev/cuaU0
avrdude: jtag3_open_common(): Did not find any device matching VID
0x03eb and PID list: 0x2145

avrdude done.  Thank you.

hexagon% avrdude -c xplainedmini_dw -p t416 -P usb:/dev/cuaU0
avrdude: jtag3_open_common(): Did not find any device matching VID
0x03eb and PID list: 0x2145

avrdude done.  Thank you.

So it seems avrdude does not have VID:PID for my board in the source
code. We need to patch it. This seems to be defined in
`src/usbdevs.h`.

However upstream is not patched to build correctly on FreeBSD.

hexagon% make
[  1%] [BISON][Parser] Building parser with bison 3.8.2
[  3%] [FLEX][Parser] Building scanner with flex 2.6.4
[  4%] Building C object src/CMakeFiles/libavrdude.dir/arduino.c.o
[  6%] Building C object src/CMakeFiles/libavrdude.dir/avr.c.o
[  8%] Building C object src/CMakeFiles/libavrdude.dir/avr910.c.o
[  9%] Building C object src/CMakeFiles/libavrdude.dir/avrftdi.c.o
In file included from
/home/cederom/cederom/work/CeDeROM/lab/embedded/avr/avrdude.git/src/avrftdi.c:41:
/home/cederom/cederom/work/CeDeROM/lab/embedded/avr/avrdude.git/src/avrftdi_private.h:12:11:
fatal error: 'libftdi1/ftdi.h' file not found
# include <libftdi1/ftdi.h>
          ^~~~~~~~~~~~~~~~~
1 error generated.
*** Error code 1

Port uses dozens patches that not only fixes build logic but also does
some changes to the functional part. These should be sent for a review
and merge into upstream in the first place so we can have a clean
build of the upstream on FreeBSD.

-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFYkXjmjnFX1a3%2BCQxAxdwX=-oASSEWLdzrmx=%2B4QbX3_Og2Gw>