avrdude-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: jtag3updi with attiny1604


From: Doom
Subject: Re: jtag3updi with attiny1604
Date: Sun, 28 Feb 2021 09:40:31 +0100

Hey Andy,

Can you share us your avrdude.conf file ?
There should a pb in some definitions.

Doom.


Le dim. 28 févr. 2021 à 03:42, Andy Bennett <andyjpb@ashurst.eu.org> a
écrit :

> Hi,
>
> I've been trying to get my JTAGICE3 to work in UPDI mode with an
> ATTiny1604
> (One of the 0-series devices) and avrdude under Linux.
>
> I think it's getting stuck whilst trying to read the signature bytes from
> the target.
>
> I'm using the SVN version of avrdude from a few weeks ago.
>
>
> Initially I had firmware 1.25 on the JTAGICE3 so I had to upgrade it to
> 3.37 using Atmel Studio under Windows. Otherwise I'm entirely using Linux;
> I had to borrow a machine to get the firmware updated.
>
> Whilst I was there I tested that Atmel Studio could use the JTACICE3 with
> the new firmware to read out the signature bytes of an ATMega1284p via
> JTAG
> and an ATTiny1604 via UPDI. Both were successful.
>
> The JTAGICE3 with the new firmware can also read the ATMega1284p with
> avrdude in JTAG mode under linux.
>
>
> However, it hangs with the ATTiny1604:
>
> -----
> $ ~/project/.../avrdudue/installation/bin/avrdude -p t1604 -c jtag3updi -P
> usb -t
>
> avrdude: AVR device initialized and ready to accept instructions
>
> Reading |                                                    | 0% 0.00s
> -----
>
> It just sits here forever, never making any progress.
>
> If I increase the debugging level and attach GDB I see that it gets stuck
> in avr.c:avr_read()'s call to jtag.c:jtag3_paged_load().
>
> jtag3_paged_load() gets stuck in an infinite loop.
>
> It gets passed the correct parameters:
>
> -----
> (gdb) bt
> #0  0x00007fbd14811ff7 in __GI___select (nfds=4, readfds=0x0,
> writefds=0x7ffff003dca0, exceptfds=0x0, timeout=0x7ffff003dc30)
>     at ../sysdeps/unix/sysv/linux/select.c:41
> #1  0x00007fbd14aa57ad in ?? () from /lib/x86_64-linux-gnu/libusb-0.1.so.4
> #2  0x0000556ff4bf676d in usbdev_recv_frame (fd=0x556ff5ff6610,
> buf=0x556ff62c5880 "\020m,\366oU", nbytes=512)
>     at usb_libusb.c:506
> #3  0x0000556ff4c1560f in jtag3_edbg_recv_frame (msg=0x7ffff003def8,
> pgm=0x556ff5ff50d0) at jtag3.c:709
> #4  jtag3_recv_frame (msg=0x7ffff003def8, pgm=0x556ff5ff50d0) at
> jtag3.c:647
> #5  jtag3_recv (pgm=pgm@entry=0x556ff5ff50d0, msg=msg@entry=0x7ffff003def8)
>
> at jtag3.c:780
> #6  0x0000556ff4c15bf1 in jtag3_command (pgm=pgm@entry=0x556ff5ff50d0,
> cmd=cmd@entry=0x7ffff003df04 "\022!",
>     cmdlen=cmdlen@entry=12, resp=resp@entry=0x7ffff003def8,
> descr=descr@entry=0x556ff4c332bc "read memory") at jtag3.c:827
> #7  0x0000556ff4c1677c in jtag3_paged_load (pgm=0x556ff5ff50d0,
> p=0x556ff62754e0, m=0x556ff62766f0, page_size=0, addr=0,
>     n_bytes=1) at jtag3.c:1811
> #8  0x0000556ff4be3f07 in avr_read (pgm=pgm@entry=0x556ff5ff50d0,
> p=p@entry=0x556ff62754e0,
>     memtype=memtype@entry=0x556ff4c1c165 "signature", v=v@entry=0x0) at
> avr.c:406
> #9  0x0000556ff4be4733 in avr_signature (pgm=0x556ff5ff50d0,
> p=0x556ff62754e0) at avr.c:1055
> #10 0x0000556ff4bdfc1a in main (argc=<optimized out>, argv=<optimized
> out>)
> at main.c:1046
> -----
>
> In frame 7, m is the "signature" region with page_size = 1 and readsize =
> 0.
>
> -----
> (gdb) frame 7
> #7  0x0000556ff4c1677c in jtag3_paged_load (pgm=0x556ff5ff50d0,
> p=0x556ff62754e0, m=0x556ff62766f0, page_size=0, addr=0,
>     n_bytes=1) at jtag3.c:1811
> 1811        if ((status = jtag3_command(pgm, cmd, 12, &resp, "read
> memory")) < 0)
> (gdb) print m
> $1 = (AVRMEM *) 0x556ff62766f0
> (gdb) print m->readsize
> $2 = 0
> (gdb) print m->page_size
> $3 = 1
> (gdb) print page_size
> $4 = 0
> -----
>
>
> Then, on line 1769 of jtag3.c , jtag3_paged_load() does
>
> -----
>   page_size = m->readsize;
> -----
>
> ...which causes the for loop on lin 1796:
>
> -----
>  for (; addr < maxaddr; addr += page_size) {
> -----
>
> ... to go into an infinite loop because m->readsize == 0.
>
>
>
> I've tried commenting out the assignment to page_size and I can get
> avrdude
> to go into the interactive terminal:
>
> -----
> $ ~/project/.../avrdudue/installation/bin/avrdude -p t1604 -c jtag3updi -P
> usb -t
>
> avrdude: AVR device initialized and ready to accept instructions
>
> Reading |                                                    | 0%
> 0.00savrdude: bad response to read memory command: 0xa0
> Reading | ################################################## | 100% 0.01s
>
> avrdude: Device signature = 0x1e9425 (probably t1604)
> avrdude> ^C
> -----
>
>
> However, my cursory inspection of both the SVN history and the atmelice
> driver suggest that this code has been untouched for a very long time and
> is therefore most likely not at fault.
>
> I've also scoured avrdude.conf to see if there's anything unusual about
> how
> the ATTiny1604 is set up. I didn't notice anything and no parts seem to
> have readsize assigned for the "signature" memory.
>
>
> I've not looked in detail at how the JTAGICE3 is talking to the
> ATMega1284p
> in JTAG mode but the jtag3.c driver doesn't seem to define a
> `read_sig_bytes` function anywhere so it's not falling into that special
> case in avr_read (avr.c, line 430). Perhaps it's using the read_byte()
> calls on line 440?
>
>
> So my question is, does anyone know why the JTAGICE3 is hanging like this?
>
>
> Atmel Studio can successfully connect to the same board using the same
> JTAGICE3 and the verbose logging output of avrdude tells me that not only
> is it succesfully connecting to the JTAGICE3 and the target, it is also
> able to send the AVR sign-on command and read the SIB, so I'm pretty sure
> the hardware is all OK. I can also interact with the device using pyudpi
> on
> Linux.
>
> -----
> avrdude: Sending AVR sign-on command:
> avrdude: jtag3_edbg_send(): sending 4 bytes
> avrdude: jtag3_edbg_recv():
> avrdude: jtag3_recv(): Got message seqno 14 (command_sequence == 14)
>
> Raw message:
> 12  84  00  74  69  6e  79  00
> [AVR] Data returned:
> 0x00 0x74 0x69 0x6e 0x79 0x00
> avrdude: Partial Family_ID returned: "tiny"
> avrdude: AVR device initialized and ready to accept instructions
>
> Reading | avrdude: jtag3_paged_load(.., signature, 1, 0x0, 1)
>           mapped to address: 0x1100
> avrdude: Sending enter progmode command:
> avrdude: jtag3_edbg_send(): sending 3 bytes
> avrdude: jtag3_edbg_recv():
> avrdude: jtag3_recv(): Got message seqno 15 (command_sequence == 15)
> -----
>
>
> I've attached a (compressed) log that shows the output of
> -----
> $ ~/project/.../avrdudue/installation/bin/avrdude -p t1604 -c jtag3updi -P
> usb -t -vvvv > avrdude-jtagice3updi.log 2>&1
> -----
>
>
>
> Thanks for any pointers you can offer!
>
>
>
>
> Best wishes,
> @ndy
>
> --
> andyjpb@ashurst.eu.org
> http://www.ashurst.eu.org/
> 0x7EBA75FF


reply via email to

[Prev in Thread] Current Thread [Next in Thread]