Programing ATmega4809 with Atmel Ice in UPDI

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

I tried to install avrdude latest version from source to use atmelice_updi programmer.

 

So, I downloaded avrdude source from here : http://download.savannah.gnu.org/releases/avrdude/

 

When I do 

./configure

I get 

Configuration summary:
----------------------
DO HAVE    libelf
DO HAVE    libusb
DO HAVE    libusb_1_0
DO HAVE    libftdi1
DO HAVE    libftdi (but prefer to use libftdi1)
DON'T HAVE libhid
DO HAVE    pthread
DISABLED   doc
ENABLED    parport
DISABLED   linuxgpio

Don't succeeded in having libhid (but see somewhere it is only for windows)

 

But after I get this info when doing 'make' :

/bin/bash ./ylwrap lexer.l .c lexer.c -- :  
Makefile:1924: recipe for target 'lexer.c' failed
make: *** [lexer.c] Error 1

 

Help !!!

 

AVR inside

Last Edited: Mon. Mar 2, 2020 - 11:12 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thats YAML isn't it? Maybe the .configure doesn't check for ALL the dependencies?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I succeed in building from arduino/avrdude sources : https://github.com/facchinm/avrdude

 

git clone https://github.com/facchinm/avrdude.git
cd avrdude/
./bootstrap 
sudo apt install automake libtool
./bootstrap 
./configure 
make
./avrdude -C ./avrdude.conf -c ?

But now, I am facing a new problem :

./avrdude -C ./avrdude.conf -c atmelice_updi -p m4809 -v

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "./avrdude.conf"
         User configuration file is "/home/doom/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : usb
         Using Programmer              : atmelice_updi
avrdude: Found CMSIS-DAP compliant device, using EDBG protocol
         AVR Part                      : ATmega4809
         Chip Erase delay              : 0 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 0
         StabDelay                     : 0
         CmdexeDelay                   : 0
         SyncLoops                     : 0
         ByteDelay                     : 0
         PollIndex                     : 0
         PollValue                     : 0x00
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           prodsig        0     0     0    0 no         61   61      0     0     0 0x00 0x00
           fuses          0     0     0    0 no          9    0      0     0     0 0x00 0x00
           fuse0          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse1          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse2          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse4          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse5          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse6          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse7          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse8          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0     0     0 0x00 0x00
           data           0     0     0    0 no          0    0      0     0     0 0x00 0x00
           usersig        0     0     0    0 no         64   64      0     0     0 0x00 0x00
           flash          0     0     0    0 no      49152  128      0     0     0 0x00 0x00
           eeprom         0     0     0    0 no        256   64      0     0     0 0x00 0x00

         Programmer Type : JTAGICE3_UPDI
         Description     : Atmel-ICE (ARM/AVR) in UPDI mode
         ICE hardware version: 0
         ICE firmware version: 1.00 (rel. 33)
         Serial number   : Jxxxxxxxxxxxxx
         Vtarget         : 3.34 V
         JTAG clock megaAVR/program: 1000 kHz
         JTAG clock megaAVR/debug:   1000 kHz
         JTAG clock Xmega: 1000 kHz
         PDI clock Xmega : 1000 kHz

avrdude: bad response to set parameter (scope 0x12, section 0, parm 0) command: 0xa0
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude: bad response to AVR sign-off command: 0xa0

avrdude done.  Thank you.

 

With -v -v -v -v, I get this : 

Raw message:
12  84  00  e8  03  00
[AVR] Data returned:
0x00 0xe8 0x03 0x00
         JTAG clock Xmega: 1000 kHz
avrdude: jtag3_getparm()
avrdude: Sending get parameter (scope 0x12, section 1, parm 49) command:
avrdude: jtag3_edbg_send(): sending 6 bytes
avrdude: jtag3_edbg_recv():
avrdude: jtag3_recv(): Got message seqno 7 (command_sequence == 7)

Raw message:
12  84  00  e8  03  00
[AVR] Data returned:
0x00 0xe8 0x03 0x00
         PDI clock Xmega : 1000 kHz

avrdude: jtag3_getparm()
avrdude: Sending get parameter (scope 0x01, section 0, parm 1) command:
avrdude: jtag3_edbg_send(): sending 6 bytes
avrdude: jtag3_edbg_recv():
avrdude: jtag3_recv(): Got message seqno 8 (command_sequence == 8)

Raw message:
01  84  01  01  00  00
[general] Data returned:
0x01 0x01 0x00 0x00
avrdude: jtag3_setparm()
avrdude: Sending set parameter (scope 0x12, section 0, parm 0) command:
avrdude: jtag3_edbg_send(): sending 7 bytes
avrdude: jtag3_edbg_recv():
avrdude: jtag3_recv(): Got message seqno 9 (command_sequence == 9)

Raw message:
12  a0  00  11
[AVR] FAILED, reason: 0x11
avrdude: bad response to set parameter (scope 0x12, section 0, parm 0) command: 0xa0
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude: jtag3_close()
avrdude: Sending AVR sign-off command:
avrdude: jtag3_edbg_send(): sending 3 bytes
avrdude: jtag3_edbg_recv():
avrdude: jtag3_recv(): Got message seqno 10 (command_sequence == 10)

Raw message:
12  a0  00  90
[AVR] FAILED, reason: 0x90
avrdude: bad response to AVR sign-off command: 0xa0
avrdude: Sending sign-off command:
avrdude: jtag3_edbg_send(): sending 4 bytes
avrdude: jtag3_edbg_recv():
avrdude: jtag3_recv(): Got message seqno 11 (command_sequence == 11)

Raw message:
01  80  00
[general] OK

avrdude: jtag3_edbg_signoff()

avrdude done.  Thank you.

 

AVR inside

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Seems that there's a problem with the device signature : 

 

If I type :

./avrdude -C ./avrdude.conf -c atmelice_updi -p m4809 -U lock:r:-:h -v -F

I get :

 

/avrdude -C ./avrdude.conf -c atmelice_updi -p m4809 -U lfuse:r:-:h -v -F

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "./avrdude.conf"
         User configuration file is "/home/doom/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : usb
         Using Programmer              : atmelice_updi
avrdude: Found CMSIS-DAP compliant device, using EDBG protocol
         AVR Part                      : ATmega4809
         Chip Erase delay              : 0 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 0
         StabDelay                     : 0
         CmdexeDelay                   : 0
         SyncLoops                     : 0
         ByteDelay                     : 0
         PollIndex                     : 0
         PollValue                     : 0x00
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           prodsig        0     0     0    0 no         61   61      0     0     0 0x00 0x00
           fuses          0     0     0    0 no          9    0      0     0     0 0x00 0x00
           fuse0          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse1          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse2          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse4          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse5          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse6          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse7          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse8          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0     0     0 0x00 0x00
           data           0     0     0    0 no          0    0      0     0     0 0x00 0x00
           usersig        0     0     0    0 no         64   64      0     0     0 0x00 0x00
           flash          0     0     0    0 no      49152  128      0     0     0 0x00 0x00
           eeprom         0     0     0    0 no        256   64      0     0     0 0x00 0x00

         Programmer Type : JTAGICE3_UPDI
         Description     : Atmel-ICE (ARM/AVR) in UPDI mode
         ICE hardware version: 0
         ICE firmware version: 1.00 (rel. 33)
         Serial number   : Jxxxxxxxxxx
         Vtarget         : 3.24 V
         JTAG clock megaAVR/program: 1000 kHz
         JTAG clock megaAVR/debug:   1000 kHz
         JTAG clock Xmega: 1000 kHz
         PDI clock Xmega : 1000 kHz

avrdude: bad response to set parameter (scope 0x12, section 0, parm 0) command: 0xa0
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x60bb54
avrdude: Expected signature for ATmega4809 is 1E 96 51
avrdude: bad response to AVR sign-off command: 0xa0

avrdude done.  Thank you.

 

Seems that there's a problem with the signature.

 

But signature of ATmega4809 is 1E 96 51, not 60bb54 (according to p19 of datasheet : )

 

I am using a ATmega4809 Xplained-Pro dev board, where I have supressed R509 and R510 resistor

(here is link to the schematics)

 

According to this, I think I am well connected to the ATmega4809.

 

So why this problem of signature ?

 

Does anyone know where I could find the device that have 60bb54 signature ??

 

Thanks.

 

Doom

 

AVR inside

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You are using -F, when you do that, avrdude always returns some random signature even if it never connected to the target.

In other words, I don't think you have established any UPDI connection, yet. Make sure to check your connections and power.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

El Tangas wrote:
You are using -F, when you do that,
Bottom line. NEVER use the -F option it makes no sense whatsoever. The way avrdude normally works is that to first establish that it's in communication with the target chip it first has a dialog to ask what the signature is. Because you use "-p m4809" it knows exactly what the answer should be. If it does not get that answer then the comms cannot be working so there is absolutely no point continuing. The -F option says "oh, ignore that, continue anyway". Now I suppose that if you were in a production environment and you knew that the comms link was bound to work then you could shave off a few milliseconds per unit programmed by saying "don't waste time doing the signature check" and that is almost certainly why the "-F" option exists. But in normal usage you want this "belts and braces" check to be done to just ensure, each time, that nothing has gone wrong with the programming communication (like a wire came loose or something).

 

Bottom line: never use -F

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Thanks for your answer.

 

I checked connections and all are OK.

So in case of, I put back R509 and 510 (in fact a wire).

No change.

 

I put an oscilloscope on UPDI pin, and it seems that there's no activity (always 3.3V).

 

So it seems that the problem is not between Atmel Ice and the board, but between Avrdude and Atmel Ice

 

Raw message:
01  84  01  01  00  00
[general] Data returned:
0x01 0x01 0x00 0x00
avrdude: jtag3_setparm()
avrdude: Sending set parameter (scope 0x12, section 0, parm 0) command:
avrdude: jtag3_edbg_send(): sending 7 bytes
avrdude: jtag3_edbg_recv():
avrdude: jtag3_recv(): Got message seqno 9 (command_sequence == 9)

Raw message:
12  a0  00  11
[AVR] FAILED, reason: 0x11
avrdude: bad response to set parameter (scope 0x12, section 0, parm 0) command: 0xa0
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

 

What is "parameter (scope 0x12, section 0, parm 0)" ??

 

I guess it was a parameter of Atmel Ice. Yes ? No?

 

Thanks for your help.

 

AVR inside

Last Edited: Fri. Mar 6, 2020 - 10:48 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

doomstar wrote:
I guess it was a parameter of Atmel Ice. Yes ? No?

 

Seems to be some kind of command from the (quite complex) EDBG protocol, documented here:  http://ww1.microchip.com/downloads/en/DeviceDoc/50002630A.pdf

I never had the willpower to force myself to read this document, so I'm not able to tell you which command it is.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for this link.

 

Finally, I succeded in reading fuses and lock bits.

 

It was a problem of firmware version of the Atmel-Ice.

 

The solution is quite ugly as I am under Linux Ubuntu.

Solution is to find a Windows PC, update everything, wait, reboot, wait again, install Atmel Studio 7, wait again and again, and then update the Atmel Ice. angry

After that, it seems to work.

 

Keep you in touch in case of other problems.

 

Thanks for your help. wink

 

Doom*

AVR inside