From nobody Fri Apr 8 16:04:25 2022 X-Original-To: hardware@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B0AAB12B8D3D for ; Fri, 8 Apr 2022 16:04:40 +0000 (UTC) (envelope-from tomek@cedro.info) Received: from mail-oa1-x2e.google.com (mail-oa1-x2e.google.com [IPv6:2001:4860:4864:20::2e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KZjkH6tcbz4pKr for ; Fri, 8 Apr 2022 16:04:39 +0000 (UTC) (envelope-from tomek@cedro.info) Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-e2a00f2cc8so730698fac.4 for ; Fri, 08 Apr 2022 09:04:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cedro.info; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=SoqJExMsJ/BgNcEeS58K0ODNBLTT1hRsEpm545Vj9G8=; b=b+y6InLRaqDFAT4H8hl8skXPgItCdbKkqnUPmtBq0QD/o4qfvKqUDby/j8dV6vyjFq wUCS2G7e6+ssoSFRLp9XLH1gQu1kBlqEcB9Yjst10LcPEXepBHCw8asIDs9NuSjf0wt7 NjnYy/QRvY7qh9X/Tc/HQQqjgYZid+AdVH8uDOEnpUdTUhrIwTqpl6Z7yxR/6QD9g/3j lENx35h4zlfhmCKuk8k2V27ahpY7j99ZSpMLK6g2vQqKLJ9GtrZTxjulkQLAtfZrfZf8 BYqKtLpDTGpz7Ih8muYBb7a7GNXAkH8TN/NOnngpqlwU0/ioh3PhVBu2V+UpjwtvmkRq cfvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=SoqJExMsJ/BgNcEeS58K0ODNBLTT1hRsEpm545Vj9G8=; b=CYDt6AVWVH4i/CJaGahABeGm40PPHm8sBQUwtpCN9bssI8lh1kQfZ7rS4HN9SGeaWk im076127kB2WrH1LcdSVkWhiX3MGRL8r3iHQcrK3AcS2QE6KoNVUwIzMRrjISsrOBIn3 aXuMlNqDRnqh+ijZADabnNgu3Tv3Pf++hCKtWt7+JhMZMIsfYsmmVzNg6Gaqnmsrk9z0 anc44jbCNtxy0htZ+tTxp8m9qKsHVLM/5BRp06LnZUEQKtHgnyF0qSC7mQ6qSIli7H24 ryNXVaHTzcT7tpPq97uPs0+98C9Wc3de0VJtBBjA1P5t46gnt+K5In7sBoh/+sy2Hl1Y vESA== X-Gm-Message-State: AOAM530uW77lHTGUK1WPZOEmR21jXmwAzSktiM1j9LbQQHV69bt/u6jM MEdtcxvXq0xhFfKy8+g0v0jhdor6PtgSODlN X-Google-Smtp-Source: ABdhPJxzxj6iHMLgMyVcXj/t/tU/GUud3SXR8kh1sRmbMOqnhgY8cRCyPP/91cNTtFcG/8c5gM3NaA== X-Received: by 2002:a05:6870:9590:b0:de:27ca:c60c with SMTP id k16-20020a056870959000b000de27cac60cmr9289608oao.108.1649433878623; Fri, 08 Apr 2022 09:04:38 -0700 (PDT) Received: from mail-oa1-f43.google.com (mail-oa1-f43.google.com. [209.85.160.43]) by smtp.gmail.com with ESMTPSA id bb35-20020a056820162300b00324b9a8121bsm9048279oob.27.2022.04.08.09.04.37 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Apr 2022 09:04:37 -0700 (PDT) Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-df22f50e0cso10197481fac.3 for ; Fri, 08 Apr 2022 09:04:37 -0700 (PDT) X-Received: by 2002:a05:6870:248c:b0:d7:19f3:a52c with SMTP id s12-20020a056870248c00b000d719f3a52cmr8581116oaq.149.1649433877420; Fri, 08 Apr 2022 09:04:37 -0700 (PDT) List-Id: General discussion of FreeBSD hardware List-Archive: https://lists.freebsd.org/archives/freebsd-hardware List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hardware@freebsd.org MIME-Version: 1.0 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> <7CDFB049-241F-4C31-A7B1-A7D6BDE6A002@Chaos1.DE> In-Reply-To: <7CDFB049-241F-4C31-A7B1-A7D6BDE6A002@Chaos1.DE> From: Tomek CEDRO Date: Fri, 8 Apr 2022 18:04:25 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: timeouts on USB ISP programmer To: Axel Rau Cc: Hans Petter Selasky , hardware@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4KZjkH6tcbz4pKr X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=cedro.info header.s=google header.b=b+y6InLR; dmarc=none; spf=none (mx1.freebsd.org: domain of tomek@cedro.info has no SPF policy when checking 2001:4860:4864:20::2e) smtp.mailfrom=tomek@cedro.info X-Spamd-Result: default: False [-3.30 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[cedro.info:s=google]; NEURAL_HAM_MEDIUM(-1.00)[-0.999]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[hardware@freebsd.org]; DMARC_NA(0.00)[cedro.info]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[cedro.info:+]; NEURAL_HAM_SHORT(-1.00)[-0.999]; RCVD_IN_DNSWL_NONE(0.00)[2001:4860:4864:20::2e:from,209.85.160.43:received]; MLMMJ_DEST(0.00)[hardware]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:2001:4860:4864::/48, country:US]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On Fri, Apr 8, 2022 at 11:08 AM Axel Rau wrote: > Am 08.04.2022 um 05:33 schrieb Tomek CEDRO : > Mystery solved ;-) > For avrdude `-P` parameter defines the the programmer port __BUT__ (as > obviously stated in man page) if you use `usb:` device then you need > to provide programmer SERIAL NUMBER last bytes not the OS serial port > device ;-) > I have no such serial number on the outside of my DIAMEX-ISP-USB. )-: > All I have is this: > > root@home2l:/ # usbconfig -d 0.4 dump_device_desc > ugen0.4: at usbus0, cfg=3D0 md=3DHOST spd=3DFULL (12Mbps= ) pwr=3DON (500mA) > > bLength =3D 0x0012 > bDescriptorType =3D 0x0001 > bcdUSB =3D 0x0200 > bDeviceClass =3D 0x0002 > bDeviceSubClass =3D 0x0000 > bDeviceProtocol =3D 0x0000 > bMaxPacketSize0 =3D 0x0040 > idVendor =3D 0x16c0 > idProduct =3D 0x2a9b > bcdDevice =3D 0x4340 > iManufacturer =3D 0x0001 > iProduct =3D 0x0002 > iSerialNumber =3D 0x0003 <19331-49101-552> > bNumConfigurations =3D 0x0001 Good news is that you can only provide `-P usb` if you have one Programmer Interface and it is defined in the configuration. In your case if you want to use specific serial number that would probably be `-P usb:552` parameter. > Would it help to create a section for programmer diamex-isp-usb ? Yes. As Diamex interface is not defined in the configuration files, where all hardware definition resides, avrdude will not detect it. You need to create a local user configuration file (`~/.avrduderc`) with the interface definitions. Try copy-paste from existing similar interface, change VID:PID pair, and step by step make it work :-) > All I got with -vvv: > > avrdude: usbdev_open(): did not find any (matching) USB device "usb:552" = (0x03eb:0x2104) > avrdude: usbdev_open(): did not find any (matching) USB device "usb:0552"= (0x03eb:0x2104) > avrdude: usbdev_open(): did not find any (matching) USB device "usb:0003"= (0x03eb:0x2104) > avrdude: usbdev_open(): did not find any (matching) USB device "usb:1552"= (0x03eb:0x2104) Okay, so at first you need to provide VID=3D0x16C0 and PID=3D0x2A9B in your local configuration file that will contain the interface definition. At the end of message I will try to deduce example configuration file for you :-) > I=E2=80=99m still not convinced that this stick does real USB mode (inste= ad of serial emulation via ftdi. This is not the problem. It uses "real USB mode" to transport commands between PC and FT2232 too. Most of those Programmer dongles uses Virtual-COM-Port-over-USB (aka VCP / USB CDC). No matter if you use dedicated IC like FT2232H that you can simply put in your design and control with a predefined command sequences using libraries like LibUSB+LibFTDI, or you use a microcontroller with embedded USB Device silicon that puts additional burden on you to create a base firmware for that in the first place just then to get the commands to control it like FT2232. Using FT2232H is cheaper when you consider firmware + software developer time cost and you need no extra functionalities beyond GPIO control. This is really powerful chip and I still keep my KT-LINK in my backpack every day :-) > I=E2=80=99m willing to buy a quality programmer from ATmel to move on. > Any recommendations? > Please advice. You will learn more when you bring your interface to life. Maybe contact Diamex and ask them to create such configuration for avrdude. Maybe you can create such configuration and ask them for some financing for better motivation. You can also send one programmer to me and I will try to help but I need that hardware at hand :-) I have one project in mind that will use ATtiny10. In order to program this chip I also bought these two ATtiny104XNANO and ATtiny416XNANO. These were cheap generic boards, one of them should work with existing Open-Source utilities, so I was sure I could convert them to programmer of my ATtiny10. Thanks to you I took some time and focus to research the area in practice :-) If you plan to work more with AVR and have some funding then ATMEL-ICE seems most popular interface and it is also supported in all possible configurations with avrdude: https://www.microchip.com/en-us/development-tool/ATATMEL-ICE > All I currently need, is burning/flashing/fusing ATtinys: > > avrdude -c stk500v2 -p t861 -P /dev/ttyU1 \ > -U hfuse:w:init.t861.elf \ > -U efuse:w:init.t861.elf \ > -U eeprom:w:init.t861.elf \ > -U flash:w:init.t861.elf t861 target seems to be already in place, we just need to create a configuration for Diamex interface :-) > But debugging support would be helpful in the future. It may be possible, looks like the code is there, but first things first, we need to create a base interface configuration for Flashing.. it may then allow Debug. I am not that familiar with avrdude. Did not even know that Debug is now possible with AVR. It seems that depends on how you connect the Interface to the Target MCU as there are several possible ways. Last time I played with AVR was around 2003 :-) :-) If you need to know the details DataSheets are always best place to look in the first place. I learned digital electronics from Atmel's datasheets (for At89C51 MCU) in the 1990's :-) https://www.microchip.com/en-us/product/ATTINY861 https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-2588-8-bit-AVR-Micro= controllers-tinyAVR-ATtiny261-ATtiny461-ATtiny861_Datasheet-Summary.pdf https://ww1.microchip.com/downloads/en/Appnotes/AN2519-AVR-Microcontroller-= Hardware-Design-Considerations-00002519B.pdf https://ww1.microchip.com/downloads/en/Appnotes/00002466B.pdf https://ww1.microchip.com/downloads/en/Appnotes/Production-Programming-of-M= icrochip-AVR-SAM-MCU-00002468D.pdf > Sorry, I'm a newbie in the MCU business. > > Thank you so much for all the time you did spend to help me, > Axel No worries. This is the most beautiful time of exploration. Also the hardest one as lots and lots of unexpected details jump out of the hat. But this is absolutely normal. We all learn all the time :-) Tomek =3D=3D=3D EXAMPLE DIAMEX-AVR-USB CONFIGURATION =3D=3D=3D Here is an example `~/.avrduderc` to try out. It should work out of the box as FT2232 has constant `reset`, `sck`, `mosi`, `miso` pins. `VID:PID` pair is defined. You y need to tune `usbvendor`, `usbproduct`, `usbdev`, `usbsn` fields. Default programmer is defined so there is no need to provide `-c` parameter. Maybe `-P usb` is necessary not sure. Please let us know how this works for you (with `-vvv` switch). # Possible entry formats are: # # programmer # parent # optional parent # id =3D [, [, ] ...] ; # are quoted st= rings # desc =3D ; # quoted string # type =3D ; # programmer type, quoted string # # supported programmer types can be listed by "-c ?type" # connection_type =3D parallel | serial | usb # baudrate =3D ; # baudrate for avr910-programmer # vcc =3D [, ... ] ; # pin number(s) # buff =3D [, ... ] ; # pin number(s) # reset =3D ; # pin number # sck =3D ; # pin number # mosi =3D ; # pin number # miso =3D ; # pin number # errled =3D ; # pin number # rdyled =3D ; # pin number # pgmled =3D ; # pin number # vfyled =3D ; # pin number # usbvid =3D ; # USB VID (Vendor ID) # usbpid =3D [, ...] # USB PID (Product ID= ) (1) # usbdev =3D ; # USB interface or other device info # usbvendor =3D ; # USB Vendor Name # usbproduct =3D ; # USB Product Name # usbsn =3D ; # USB Serial Number # # To invert a bit, use =3D ~ , the spaces are important. # For a pin list all pins must be inverted. # A single pin can be specified as usual =3D ~ , for lists # specify it as follows =3D ~ ( [, ... ] ) . # # (1) Not all programmer types can process a list of PIDs. # ; # set this to avoid providing `-c` all the time :-) default_programmer =3D "diamex-avr-usb"; # this will interface with the chips on these programmers: # # http://real.kiev.ua/old/avreal/en/adapters # http://www.amontec.com/jtagkey.shtml, jtagkey-tiny.shtml # http://www.olimex.com/dev/arm-usb-ocd.html, arm-usb-tiny.html # http://www.ethernut.de/en/hardware/turtelizer/index.html # http://elk.informatik.fh-augsburg.de/hhweb/doc/openocd/usbjtag/usbjtag.ht= ml # http://dangerousprototypes.com/docs/FT2232_breakout_board # http://www.ftdichip.com/Products/Modules/DLPModules.htm,DLP-2232*,DLP-USB= 1232H # http://flashrom.org/FT2232SPI_Programmer # # The drivers will look for a specific device and use the first one found. # If you have mulitple devices, then look for unique information (like SN) # And fill that in here. # # Note that the pin numbers for the main ISP signals (reset, sck, # mosi, miso) are fixed and cannot be changed, since they must match # the way the Multi-Protocol Synchronous Serial Engine (MPSSE) of # these FTDI ICs has been designed. programmer id =3D "diamex-avr-usb"; desc =3D "FT2232 based Diamex AVR USB programmer"; type =3D "avrftdi"; connection_type =3D usb; usbvid =3D 0x16C0; usbpid =3D 0x2A9B; usbvendor =3D ""; usbproduct =3D ""; usbdev =3D "A"; usbsn =3D ""; #ISP-signals - lower ADBUS-Nibble (default) reset =3D 3; sck =3D 0; mosi =3D 1; miso =3D 2; #LED SIGNALs - higher ADBUS-Nibble # errled =3D 4; # rdyled =3D 5; # pgmled =3D 6; # vfyled =3D 7; #Buffer Signal - ACBUS - Nibble # buff =3D 8; ; --=20 CeDeROM, SQ7MHZ, http://www.tomek.cedro.info