Re: timeouts on USB ISP programmer

From: Tomek CEDRO <tomek_at_cedro.info>
Date: Sun, 10 Apr 2022 15:01:20 UTC
On Sun, Apr 10, 2022 at 12:37 PM Axel Rau <Axel.Rau@chaos1.de> wrote:
> Am 09.04.2022 um 01:39 schrieb Tomek CEDRO <tomek@cedro.info>:
> > Long story short:
> > * Put both dip-switches to OFF if you use external board (no VCC
> > connection required). They may stay ON if you program "bare" AVR (you
> > need to connect VCC, SW1=ON, SW2 OFF=3.3V ON=5V).
>
> My switches are always on; my MCU is in the ZIFF socket. (-:

Okay ZIF, good :-) 5V is required for programing from what I read from
datasheet.


> > * Try `avrdude -c stk500v2 -p 85 -vvv -t` and see of that connects to
> > Programmer.
>
> That’s what I did.
>
> root@home2l:/ # avrdude -c stk500v2 -p t85 -P /dev/cuau1 -t -vvv -B 250 -i 90
> . . .
> avrdude: Version 6.4
>          Copyright (c) Brian Dean, http://www.bdmicro.com/
>          Copyright (c) Joerg Wunsch
>
>          System wide configuration file is "/usr/local/etc/avrdude.conf"
>          User configuration file is "/root/.avrduderc"
>          User configuration file does not exist or is not a regular file, skipping
>
>          Using Port                    : /dev/cuau1
>          Using Programmer              : stk500v2
>          Setting bit clk period        : 250.0
>          Setting isp clock delay        :  90
> avrdude: ser_recv(): programmer is not responding
> avrdude: stk500v2_ReceiveMessage(): timeout
> avrdude: ser_recv(): programmer is not responding
> avrdude: stk500v2_ReceiveMessage(): timeout
> avrdude: ser_recv(): programmer is not responding
> avrdude: stk500v2_ReceiveMessage(): timeout

Not exactly what I wrote. You used again `-P /dev/cuau1` which is
INVALID syntax. Use no `-P` at all.

STEP 1:

Get a connection to the programmer:

avrdude -c stk500v2 -p 85 -vvv -t

Nothing more. You should get a connection to the Programmer.


STEP 2:

Get Programmer talking with PC by setting serial port BAUDRATE (-b).

For that you may need to set `-b` (baudrate, not SMALL b). You can
attach serial terminal program like `minicom` and set various port
baudrates to see when you get a readable response (i.e. 9600, 57600,
115200, etc). For instance with ATtiny104XNANO I had to use `-b 9600`
parameter.

avrdude -c stk500v2 -p 85 -vvv -t -b 9600

You must end this step with working Programmer talking fine to avrdude.


STEP 3:

Set talking to AVR speed (BITCLOCK -B parameter).

If Diamex works fine with avrdude, but you cannot program AVR, you may
need to tune bitclock with `-B` (note BIG B). You can use frequency
suffix here (i.e. 40khz, 100khz). Try slower and faster speeds.

Example: avrdude -c stk500v2 -p 85 -vvv -B 100khz


That should make it. Assuming STK500V2 will use DebugWIRE ;-)


> I think, the DIAMEX is defective, I try to get another one.
> Perhaps the drivers are gone.
>
> How can I verify this?

Well this avrdude is not that easy to use as it turns out at first
steps even for me so do not worry just try until it works ;-)

It turns out my ATtiny104XNANO does not support TPI protocol so I
cannot program ATtiny10. I am writing now configuration for FT2232H
based KT-LINK. Oscilloscope is mandatory here. I guess you can verify
your Diamex with oscilloscope too.

Here is the detailed deocumentation of avrdude:
https://quantum-mirror.hu/mirrors/pub/gnusavannah/avrdude/avrdude-doc-6.4.pdf

Here is the PR for fixing the build out-of-the-box on FreeBSD:
https://github.com/avrdudes/avrdude/pull/925


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