Date: Fri, 8 Apr 2022 18:04:25 +0200 From: Tomek CEDRO <tomek@cedro.info> To: Axel Rau <Axel.Rau@chaos1.de> Cc: Hans Petter Selasky <hps@selasky.org>, hardware@freebsd.org Subject: Re: timeouts on USB ISP programmer Message-ID: <CAFYkXjnwvba60u3_tRMReEiyb5dohNZDLoenZWieNB2q_c_-0w@mail.gmail.com> In-Reply-To: <7CDFB049-241F-4C31-A7B1-A7D6BDE6A002@Chaos1.DE> 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> <CAFYkXjmjnFX1a3%2BCQxAxdwX=-oASSEWLdzrmx=%2B4QbX3_Og2Gw@mail.gmail.com> <CAFYkXjmgLi0F4gLVWQxtVwS6tCXCni%2BxU2-7KQM4ve%2B%2B-aEiBw@mail.gmail.com> <CAFYkXjnG5uOzF5_BbNZUgzBzTN8hpU9RmTTh1h_KDZ0EonZgEQ@mail.gmail.com> <CAFYkXjnbneNUszR8ZwS50xY8924uvCQyYQ9d3ohT_t1HZrjmDw@mail.gmail.com> <CAFYkXjmf8DpZw5hQ6Cc_FBurHufKNHhKGYiXpK%2BArB0SGCbqsg@mail.gmail.com> <7CDFB049-241F-4C31-A7B1-A7D6BDE6A002@Chaos1.DE>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Apr 8, 2022 at 11:08 AM Axel Rau <Axel.Rau@chaos1.de> wrote: > Am 08.04.2022 um 05:33 schrieb Tomek CEDRO <tomek@cedro.info>: > 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: <ERFOS AVR-ISP2> at usbus0, cfg=3D0 md=3DHOST spd=3DFULL (12Mbps= ) pwr=3DON (500mA) > > bLength =3D 0x0012 > bDescriptorType =3D 0x0001 > bcdUSB =3D 0x0200 > bDeviceClass =3D 0x0002 <Communication device> > bDeviceSubClass =3D 0x0000 > bDeviceProtocol =3D 0x0000 > bMaxPacketSize0 =3D 0x0040 > idVendor =3D 0x16c0 > idProduct =3D 0x2a9b > bcdDevice =3D 0x4340 > iManufacturer =3D 0x0001 <ERFOS> > iProduct =3D 0x0002 <AVR-ISP2> > 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 <id> # optional parent # id =3D <id1> [, <id2> [, <id3>] ...] ; # <idN> are quoted st= rings # desc =3D <description> ; # quoted string # type =3D <type>; # programmer type, quoted string # # supported programmer types can be listed by "-c ?type" # connection_type =3D parallel | serial | usb # baudrate =3D <num> ; # baudrate for avr910-programmer # vcc =3D <num1> [, <num2> ... ] ; # pin number(s) # buff =3D <num1> [, <num2> ... ] ; # pin number(s) # reset =3D <num> ; # pin number # sck =3D <num> ; # pin number # mosi =3D <num> ; # pin number # miso =3D <num> ; # pin number # errled =3D <num> ; # pin number # rdyled =3D <num> ; # pin number # pgmled =3D <num> ; # pin number # vfyled =3D <num> ; # pin number # usbvid =3D <hexnum>; # USB VID (Vendor ID) # usbpid =3D <hexnum> [, <hexnum> ...] # USB PID (Product ID= ) (1) # usbdev =3D <interface>; # USB interface or other device info # usbvendor =3D <vendorname>; # USB Vendor Name # usbproduct =3D <productname>; # USB Product Name # usbsn =3D <serialno>; # USB Serial Number # # To invert a bit, use =3D ~ <num>, the spaces are important. # For a pin list all pins must be inverted. # A single pin can be specified as usual =3D ~ <num>, for lists # specify it as follows =3D ~ ( <num> [, <num2> ... ] ) . # # (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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFYkXjnwvba60u3_tRMReEiyb5dohNZDLoenZWieNB2q_c_-0w>