Menu

#44 wrong part when invoking avrdude to read fuses/lockbits

v2.3
closed
Behavior (41)
5
2019-05-30
2010-07-01
Anonymous
No

When trying to read fuses or lockbits from AVRDude options page in project properties, the plugin outputs a wrong command line to invoke AVRDude:
avrdude -cavrisp2 -Pusb -pm16
this command fails saying "avrdude: initialization failed, rc=-1"
Since I'm using ATXMEGA128A1 mcu, the part specified in the command line doesn't reflects the project target hardware setting.
I think the command line should be: avrdude -cavrisp2 -Pusb -px128a1

This behavior is present also when trying to load the "Flash memory erase cycle counter" in the "other" page of AVRDude options.

P.S. My project is setup correctly as I can program my board and the fuses (when I set them manually).

Please take a look at this. Xmega devices uses a different type of initialization than traditional MEGA.

Discussion

  • Thomas Holland

    Thomas Holland - 2010-07-01

    Some internal functions like "read fuses from MCU" try to automatically detect which MCU type is connected. This was done as a safeguard against user errors where the connected MCU is not the same as set for the project.
    They do this by passing -pm16 to avrdude and parsing the response from avrdude (which will report the correct MCU type)

    It seems that this autodetection fails with ATXmegas, but I don't have any ATXmegas to test this (I just ordered an XPlain board as a remedy :-).

    So, in the meantime could you please provide the full avrdude console output? (If you haven't done this already please select Window->Preferences...->AVR->AVRDude -> Log internal AVRDude output to console).
    This way I could already start to work on the bug while I wait for my XPlain board.

     
  • Simone

    Simone - 2010-07-02

    This is the output log in CDT:

    Launching C:\Programmi\Atmel\WinAVR\bin\avrdude -cavrisp2 -Pusb -pm16
    Output:

    avrdude: stk500v2_command(): command failed
    avrdude: stk500v2_command(): unknown status 0xc9
    avrdude: stk500v2_program_enable(): cannot get connection status
    avrdude: initialization failed, rc=-1
    Double check connections and try again, or use -F to override
    this check.

    avrdude execution aborted

    To help you, I tryed from command line to execute the command with xmega16a4 part and

    avrdude answers in the following way:

    avrdude -cavrisp2 -Pusb -px16a4

    avrdude: AVR device initialized and ready to accept instructions

    Reading | ################################################## | 100% 0.02s

    avrdude: Device signature = 0x1e974c
    avrdude: Expected signature for ATXMEGA16A4 is 1E 94 41
    Double check chip, or use -F to override this check.

    avrdude done. Thank you.

    and specifying the correct part (xmega128a1):

    C:\Documents and Settings\s.zamboni.ELTASRL>avrdude -cavrisp2 -Pusb -px128a1

    avrdude: AVR device initialized and ready to accept instructions

    Reading | ################################################## | 100% 0.02s

    avrdude: Device signature = 0x1e974c

    avrdude done. Thank you.

    I think avrdude must know that the target hardware is a XMEGA part because MEGA and XMEGA

    series uses completely different protocols: ATMEGA is programmed over SPI and XMEGA uses the

    new PDI programming port.

    I know would be a better way to automatically recognize the device attached but wouldn't be

    simpler to just use the one specified by the user in the target page? If the user doesn't

    set any device he will receive an error.

    I can perform further test if you need extra informations.

     
  • Thomas Holland

    Thomas Holland - 2010-07-06

    I think I have fixed this bug (and another XMega related bug that popped up once I had fixed this issue).

    Could you please try the fix to see if it works for you as well?

    I have uploaded the fixed plugin to the inofficial update site at avr-eclipse.sourceforge.net/previews or you could just use the following link to download the p2 repository which can be used as a local installation source.

    http://avr-eclipse.sourceforge.net/previews/avreclipse-p2-repository-2.3.4.20100706betaNGT.zip

    BTW the plugin still tries to determine the MCU automatically, it will just try an XMega typ if the a 'conventional' AVR MCU fails. Anything else would have meant a large rewrite of the plugin.

     
  • Simone

    Simone - 2010-07-08

    Yes, this works for me too!

    As I stated before, the only problem is that XMEGA uses a different protocol for the external programmer than the standard MEGA parts and AVRDude doesn't try automatically both protocols, it uses only the one for the part family you have specified in the command line.
    So I think your approach is optimal. This enhancement should go into the next release.

    Good job and many thanks for this great plugin!

     
  • Thomas Holland

    Thomas Holland - 2010-07-08

    Good! I'll release the fix in the next days as 2.3.4.

     
  • Thomas Holland

    Thomas Holland - 2010-08-07

    Fix released with 2.3.4

     
  • Jack Wilborn

    Jack Wilborn - 2019-05-30

    Is this the same issue? I'm using Eclipse (2019) and have never been able to get the device fuses or anything else like that read from the target (now an attiny85 't85'.) As I read this it looked very similar. The supplied link is no longer functional. It works fine from the command line or during actuall programming. Here is the output from eclipse window:

    Launching /usr/bin/avrdude -cdragon_isp -Pusb -b460800 -v -pm16 
    Output:
    
    avrdude: Version 6.3
             Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
             Copyright (c) 2007-2014 Joerg Wunsch
    
             System wide configuration file is "/etc/avrdude.conf"
             User configuration file is "/home/jack/.avrduderc"
             User configuration file does not exist or is not a regular file, skipping
    
             Using Port                    : usb
             Using Programmer              : dragon_isp
             Overriding Baud Rate          : 460800
    avrdude: usbdev_open(): Found AVRDRAGON, serno: FFFFFFFFFFFF
    JTAG ICE mkII sign-on message:
    Communications protocol version: 1
    M_MCU:
      boot-loader FW version:        255
      firmware version:              6.11
      hardware version:              1
    S_MCU:
      boot-loader FW version:        255
      firmware version:              6.11
      hardware version:              7
    Serial number:                   ff:ff:ff:ff:ff:ff
    Device ID:                       AVRDRAGON
             AVR Part                      : ATmega16
             Chip Erase delay              : 9000 us
             PAGEL                         : PD7
             BS2                           : PA0
             RESET disposition             : dedicated
             RETRY pulse                   : SCK
             serial program mode           : yes
             parallel program mode         : yes
             Timeout                       : 200
             StabDelay                     : 100
             CmdexeDelay                   : 25
             SyncLoops                     : 32
             ByteDelay                     : 0
             PollIndex                     : 3
             PollValue                     : 0x53
             Memory Detail                 :
    
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               eeprom         4    10   128    0 no        512    4      0  9000  9000 0xff 0xff
               flash         33     6   128    0 yes     16384  128    128  4500  4500 0xff 0xff
               lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
               lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
               hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
               signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
               calibration    0     0     0    0 no          4    0      0     0     0 0x00 0x00
    
             Programmer Type : DRAGON_ISP
             Description     : Atmel AVR Dragon in ISP mode
             Vtarget         : 5.0 V
             SCK period      : 8.00 us
    
    avrdude: AVR device initialized and ready to accept instructions
    
    Reading | ################################################## | 100% 0.15s
    
    avrdude: Device signature = 0x1e930b (probably t85)
    avrdude: Expected signature for ATmega16 is 1E 94 03
             Double check chip, or use -F to override this check.
    
    avrdude done.  Thank you.
    
    avrdude finished
    
    
    Launching /usr/bin/avrdude -cdragon_isp -Pusb -b460800 -v -px128a3 
    Output:
    
    avrdude: Version 6.3
             Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
             Copyright (c) 2007-2014 Joerg Wunsch
    
             System wide configuration file is "/etc/avrdude.conf"
             User configuration file is "/home/jack/.avrduderc"
             User configuration file does not exist or is not a regular file, skipping
    
             Using Port                    : usb
             Using Programmer              : dragon_isp
             Overriding Baud Rate          : 460800
    avrdude: usbdev_open(): Found AVRDRAGON, serno: FFFFFFFFFFFF
    JTAG ICE mkII sign-on message:
    Communications protocol version: 1
    M_MCU:
      boot-loader FW version:        255
      firmware version:              6.11
      hardware version:              1
    S_MCU:
      boot-loader FW version:        255
      firmware version:              6.11
      hardware version:              7
    Serial number:                   ff:ff:ff:ff:ff:ff
    Device ID:                       AVRDRAGON
             AVR Part                      : ATxmega128A3
             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         50   50      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
               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
               eeprom         0     0     0    0 no       2048   32      0     0     0 0x00 0x00
               application    0     0     0    0 no     131072  512      0     0     0 0x00 0x00
               apptable       0     0     0    0 no       8192  512      0     0     0 0x00 0x00
               boot           0     0     0    0 no       8192  512      0     0     0 0x00 0x00
               flash          0     0     0    0 no     139264  512      0     0     0 0x00 0x00
               usersig        0     0     0    0 no        512  512      0     0     0 0x00 0x00
               fuse0          0     0     0    0 no          1    0      0     0     0 0x00 0x00
    
             Programmer Type : DRAGON_ISP
             Description     : Atmel AVR Dragon in ISP mode
             Vtarget         : 5.0 V
             SCK period      : 8.00 us
    
    avrdude: unsupported encapsulated ISP command: 0x51
    avrdude: stk500v2_jtagmkII_recv(): error in jtagmkII_recv()
    avrdude: unsupported encapsulated ISP command: 0x50
    avrdude: stk500v2_jtagmkII_recv(): error in jtagmkII_recv()
    avrdude: unsupported encapsulated ISP command: 0x50
    avrdude: stk500v2_jtagmkII_recv(): error in jtagmkII_recv()
    avrdude: unsupported encapsulated ISP command: 0x50
    avrdude: stk500v2_jtagmkII_recv(): error in jtagmkII_recv()
    avrdude: AVR device initialized and ready to accept instructions
    
    Reading | avrdude: unsupported encapsulated ISP command: 0x50
    avrdude: stk500v2_jtagmkII_recv(): error in jtagmkII_recv()
    avrdude: unsupported encapsulated ISP command: 0x50
    avrdude: stk500v2_jtagmkII_recv(): error in jtagmkII_recv()
    ################avrdude: unsupported encapsulated ISP command: 0x50
    avrdude: stk500v2_jtagmkII_recv(): error in jtagmkII_recv()
    ################################## | 100% 30.00s
    
    avrdude: Device signature = 0x010101
    avrdude: Expected signature for ATxmega128A3 is 1E 97 42
             Double check chip, or use -F to override this check.
    avrdude: unsupported encapsulated ISP command: 0x50
    avrdude: stk500v2_jtagmkII_recv(): error in jtagmkII_recv()
    
    avrdude done.  Thank you.
    
    avrdude finished
    

    Seems very similar. Any suggestions?

     

Log in to post a comment.

MongoDB Logo MongoDB