Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
neilh
PostPosted: May 30, 2010 - 06:23 PM
Rookie


Joined: Mar 13, 2006
Posts: 39
Location: San Francisco, Ca

Hi Alex
Just found your posting here - for some reason the avrfreaks search engine doesn't find this even when searching for the title.
Again thankyou thankyou for releasing Xboot.
To summarize out emails so far, I'm trying it on the X32A4 and it is programming it somewhere and then failing on the verify step.
It seems to me it might be something to do with the avrdude 5.10 released avrdude.conf
A couple of issues that show up
1) The X32A4 doesn't support JTAG
2) The A4 doc8069 rev N Table7-2 Pg14 has some thing wrong in Page Size for the 32A4 or the 64A4. Both specify Page Size 128Words and number of pages 128. Seems likely the spec for the 64A4 is wrong.
When I compare it against the M2560 that I've also used, there is a lot more customizations in the avrdude.conf - which I haven't researched to find out what they mean
So ANY pointers on what might be wrong greatly appreaciated. I'm going to dig into the where it might be placing the code and what avrdude docs says about the .conf settings.
Neil
Code:
#------------------------------------------------------------
# ATXMEGA32A4
#------------------------------------------------------------

part
    id      = "x32a4";
    desc   = "ATXMEGA32A4";
    signature   = 0x1e 0x95 0x41;
    has_jtag   = yes;
    has_pdi   = yes;
    nvm_base   = 0x01c0;

    memory "eeprom"
        size      = 0x0400;
        offset      = 0x08c0000;
        page_size   = 0x20;
        readsize   = 0x100;
    ;

    memory "application"
        size      = 0x00008000;
        offset      = 0x0800000;
        page_size   = 0x100;
        readsize   = 0x100;
    ;

    memory "apptable"
        size      = 0x00001000;
        offset      = 0x00807000;
        page_size   = 0x100;
        readsize   = 0x100;
    ;

    memory "boot"
        size      = 0x00001000;
        offset      = 0x00808000;
        page_size   = 0x100;
        readsize   = 0x100;
    ;

    memory "flash"
        size      = 0x00009000;
        offset      = 0x0800000;
        page_size   = 0x100;
        readsize   = 0x100;
    ;

    memory "prodsig"
        size      = 0x200;
        offset      = 0x8e0200;
        page_size   = 0x100;
        readsize   = 0x100;
    ;

    memory "usersig"
        size      = 0x200;
        offset      = 0x8e0400;
        page_size   = 0x100;
        readsize   = 0x100;
    ;

    memory "signature"
        size      = 3;
        offset      = 0x1000090;
    ;

    memory "fuse0"
        size      = 1;
        offset      = 0x8f0020;
    ;

    memory "fuse1"
        size      = 1;
        offset      = 0x8f0021;
    ;

    memory "fuse2"
        size      = 1;
        offset      = 0x8f0022;
    ;

    memory "fuse4"
        size      = 1;
        offset      = 0x8f0024;
    ;

    memory "fuse5"
        size      = 1;
        offset      = 0x8f0025;
    ;

    memory "lock"
        size      = 1;
        offset      = 0x8f0027;
    ;
;

and I use

Code:
avrdude -v -v -c avr109 -p x32a4 -b 19200 -P com15 -U flash:w:B014BrdTestA.hex


with the output
Code:
avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\WinAVR-20100110\bin\avrdude.conf"

         Using Port                    : com15
         Using Programmer              : avr109
         avr910_devcode (avrdude.conf) : none
         Overriding Baud Rate          : 19200
         AVR Part                      : ATXMEGA32A4
         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                       Polle
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBac
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------
           eeprom         0     0     0    0 no       1024   32      0     0     0 0x00 0x0
           application    0     0     0    0 no      32768  256      0     0     0 0x00 0x0
           apptable       0     0     0    0 no       4096  256      0     0     0 0x00 0x0
           boot           0     0     0    0 no       4096  256      0     0     0 0x00 0x0
           flash          0     0     0    0 no      36864  256      0     0     0 0x00 0x0
           prodsig        0     0     0    0 no        512  256      0     0     0 0x00 0x0
           usersig        0     0     0    0 no        512  256      0     0     0 0x00 0x0
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x0
           fuse0          0     0     0    0 no          1    0      0     0     0 0x00 0x0
           fuse1          0     0     0    0 no          1    0      0     0     0 0x00 0x0
           fuse2          0     0     0    0 no          1    0      0     0     0 0x00 0x0
           fuse4          0     0     0    0 no          1    0      0     0     0 0x00 0x0
           fuse5          0     0     0    0 no          1    0      0     0     0 0x00 0x0
           lock           0     0     0    0 no          1    0      0     0     0 0x00 0x0

         Programmer Type : avr910
         Description     : Atmel AppNote AVR109 Boot Loader

Connecting to programmer: .
Found programmer: Id = "XBoot++"; type = S
    Software Version = 1.6; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=256 bytes.

Programmer supports the following devices:
    Device code: 0x7b

avrdude: devcode selected: 0x7b
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9541
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "B014BrdTestA.hex"
avrdude: input file B014BrdTestA.hex auto detected as Intel Hex
avrdude: writing flash (1798 bytes):

Writing | ################################################## | 100% 1.05s



avrdude: 1798 bytes of flash written
avrdude: verifying flash memory against B014BrdTestA.hex:
avrdude: load data flash data from input file B014BrdTestA.hex:
avrdude: input file B014BrdTestA.hex auto detected as Intel Hex
avrdude: input file B014BrdTestA.hex contains 1798 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 1.14s



avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0002
         0xf4 != 0xbc
avrdude: verification error; content mismatch

avrdude done.  Thank you.
Rolling Eyes Rolling Eyes Very Happy
 
 View user's profile Send private message  
Reply with quote Back to top
alex.forencich
PostPosted: May 30, 2010 - 08:19 PM
Wannabe


Joined: Apr 01, 2010
Posts: 68
Location: San Diego, CA

Hm. I have it working perfectly on a 32a4 with no extra customizations, so that's a little fishy. And it looks like we're using the same avrdude.conf file. How did you program the bootloader to the chip? With make program?

Btw, this is the output I get when I program a 32a4 with XBoot:

Code:
avrdude -p atxmega32a4 -P /dev/ttyUSB2 -c avr109 -b 115200    -U flash:w:main.hex -v -v

avrdude: Version 5.10svn, compiled on May  2 2010 at 17:02:16
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

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

         Using Port                    : /dev/ttyUSB2
         Using Programmer              : avr109
         avr910_devcode (avrdude.conf) : none
         Overriding Baud Rate          : 115200
         AVR Part                      : ATXMEGA32A4
         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
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom         0     0     0    0 no       1024   32      0     0     0 0x00 0x00
           application    0     0     0    0 no      32768  256      0     0     0 0x00 0x00
           apptable       0     0     0    0 no       4096  256      0     0     0 0x00 0x00
           boot           0     0     0    0 no       4096  256      0     0     0 0x00 0x00
           flash          0     0     0    0 no      36864  256      0     0     0 0x00 0x00
           prodsig        0     0     0    0 no        512  256      0     0     0 0x00 0x00
           usersig        0     0     0    0 no        512  256      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    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
           lock           0     0     0    0 no          1    0      0     0     0 0x00 0x00

         Programmer Type : avr910
         Description     : Atmel AppNote AVR109 Boot Loader

Connecting to programmer: .
Found programmer: Id = "XBoot++"; type = S
    Software Version = 1.6; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=256 bytes.

Programmer supports the following devices:
    Device code: 0x7b

avrdude: devcode selected: 0x7b
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9541
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "main.hex"
avrdude: input file main.hex auto detected as Intel Hex
avrdude: writing flash (6842 bytes):

Writing | ################################################## | 100% 1.09s



avrdude: 6842 bytes of flash written
avrdude: verifying flash memory against main.hex:
avrdude: load data flash data from input file main.hex:
avrdude: input file main.hex auto detected as Intel Hex
avrdude: input file main.hex contains 6842 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 1.10s



avrdude: verifying ...
avrdude: 6842 bytes of flash verified

avrdude done.  Thank you.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
radbrad
PostPosted: May 30, 2010 - 08:29 PM
Rookie


Joined: Mar 31, 2006
Posts: 48
Location: Corvallis, Oregon

I can't remember the exact output, but I've had problems with AVRDude 5.10 on my laptop. I also have AVRDude 5.10 on my desktop, but they came from different repositories - the laptop one came from Debian "stretch" and the working desktop version came from Ubuntu 10.04. Both are reportedly version 5.10, but maybe one of them has extra patches included in the package that fix some of these issues. Still trying to get to the bottom of that, not sure if it's related...

Also, did you use the included makefile to program the bootloader? I swear I was doing everything right, but for some reason the makefile programmed it correctly whereas my own AVRDude attempts failed.

_________________
_________________
Brad Nelson
http://bradsprojects.wordpress.com
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
alex.forencich
PostPosted: May 30, 2010 - 08:35 PM
Wannabe


Joined: Apr 01, 2010
Posts: 68
Location: San Diego, CA

You're using Windows, right Neil? Most of the testing I have done has been in Linux. It shouldn't make too much difference, but it is definitely a consideration. I will try firing up a Windows VM later and seeing if I can program a chip successfully with the latest avrdude for windows.

_________________
Alex Forencich

XBoot eXtensible Bootloader for AVR ATMEGA and XMEGA
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
neilh
PostPosted: May 30, 2010 - 09:12 PM
Rookie


Joined: Mar 13, 2006
Posts: 39
Location: San Francisco, Ca

Alex, yes I'm using using windows with AvrStudio 4.18Sp2
By referencing back to my last boot build, I've found I need to include in AvrStudio Project.Configuration Options.Project Options.[Linker Options] the following
-Wl,--section-start=.text=4000
Also, when programming it - the F2 B6=0
Fuses.BOOTRST="Boot Loader Reset"
This gets the Bootloader loaded into the right memory. Your makefile is sure nice for that. For some reason I haven't got the right make to run it so I'm doing it through AvrStudio.
Then I can use avrdude with -t to be able to go into terminal mode and read if the application file is being programmed in. Which it is not.
If I program it from the JTAG it works.
So there must be something I am missing. Smile
 
 View user's profile Send private message  
Reply with quote Back to top
alex.forencich
PostPosted: May 31, 2010 - 04:10 AM
Wannabe


Joined: Apr 01, 2010
Posts: 68
Location: San Diego, CA

Hmm. Should that section start be 4000 or 8000? My makefile makes it 8000 for the 32a4.

_________________
Alex Forencich

XBoot eXtensible Bootloader for AVR ATMEGA and XMEGA
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
neilh
PostPosted: May 31, 2010 - 04:31 AM
Rookie


Joined: Mar 13, 2006
Posts: 39
Location: San Francisco, Ca

4000 (0x4000) places it in the right place in memory.
The manual Fig 7-1 references the word address as
2000 for the X16A4
4000 for the X32A4
8000 for the X64A4
I'm getting the xboot loaded in the right location - and its processing commands, but doesn't appear to be programming it. I've put it on the back burner till I can look at the avr109 code to see if there is a way of monitoring the command stream into/out of avrdude. Smile
 
 View user's profile Send private message  
Reply with quote Back to top
alex.forencich
PostPosted: May 31, 2010 - 05:33 AM
Wannabe


Joined: Apr 01, 2010
Posts: 68
Location: San Diego, CA

Yeah. But I believe the linker requires an address in bytes, not words. Please try it with 8000 and tell me what happens, since that's the value that works for me on the same part.

_________________
Alex Forencich

XBoot eXtensible Bootloader for AVR ATMEGA and XMEGA
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
neilh
PostPosted: May 31, 2010 - 07:02 AM
Rookie


Joined: Mar 13, 2006
Posts: 39
Location: San Francisco, Ca

That seems to have done it!. At least from the quick late night test.
I thought I had tried it, and checked its placement in memory, but I think I got confused with the byte/word issue.
So the boot program was running before, and then continually restarting - so it was handling the commands but not from the boot section, so it couldn't program. Whew.
So thanks for looking over my shoulder and making suggestions as to the obvious. Smile
Will check it more tomorrow.
 
 View user's profile Send private message  
Reply with quote Back to top
alex.forencich
PostPosted: May 31, 2010 - 07:28 AM
Wannabe


Joined: Apr 01, 2010
Posts: 68
Location: San Diego, CA

Heh. No problem. Thanks for verifying that it is actually possible to get XBoot to run properly in AVR Studio in windows! I have not had a chance to get a debug environment set up for that yet. Would you be interested in writing a little blurb about how to set up AVR studio for the XBoot readme?

_________________
Alex Forencich

XBoot eXtensible Bootloader for AVR ATMEGA and XMEGA
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
neilh
PostPosted: May 31, 2010 - 03:06 PM
Rookie


Joined: Mar 13, 2006
Posts: 39
Location: San Francisco, Ca

How does this look - its two parts - 1)the AvrStudio setup 2) the programming with a JTAG MkII from AvrStudio

Code:
TO use AvrStudio for Xmega Xboot ensure you have
AvrStudio 4.18 Sp2 (build700) and  WinAvr-20100110
Create a project within Avr - say Xboot.
The somewhat tricky bit is that the project has to be set for the specific member of the Xmega family used.
The Flash is linear and the Boot code is at the end of the flash. Refer to the makefiles "BOOT_SECTION_START" or the specific parts manual. For the AtXmega32A4 with 4K of boot, it is located at byte address 8000.
In AvrStudio  on the Project menu, open the configuration options.
On the "general" tab, select the device atxmega32a4
Set the Frequency to 2000000Hz
Ensure Create Hex File is checked
Step on to the Custom Options tab, and in the "Custom Compilation Options" window select the [Linker Options]
Copy the following into the Add window, and then press Add
 -Wl,--section-start=.text=8000
Press OK
and build your project.

The 2nd part - blowing into the boot
Code:

Now program the boot file into the part and set the FUSEBYTE2 Bit6 = 0 (Boot Loader Reset).
The method is dependent on the Xmega member used and your tools.
A number of members of the Xmega family require the PDI interface(eg the Xmega32A4) - so I have the Jtag MKII that supports PDI (B revision - see Avr Tools Guide in Avr Studio.)
From AvrStudio connect to the MkII Jtag.
ON the Main tab set the "Device", (eg ATxmega32A4) and press read Signature to ensure its connected.
On the Fuses tab
select BOOTRST: "Boot Loader Reset" or FUSEBYTE2 bit6=0
Now go to the Program tab, In the Flash section, select the hex file and press program.
 
 View user's profile Send private message  
Reply with quote Back to top
ofcourseitis
PostPosted: Sep 07, 2010 - 03:39 AM
Newbie


Joined: Sep 07, 2010
Posts: 2


I've just got my xboot bootloader going on a Xmega256A3 using AVR Studio, big thanks to Alex and Neil - it would've taken me a lot longer if you guys hadn't been willing to share your hard work.

Note to others intending on using AVR Studio, the linker start address is in bytes but spec'd in the data sheet in words. This is mentioned in an earlier post but I still missed it...tsts
 
 View user's profile Send private message  
Reply with quote Back to top
ganzziani
PostPosted: Sep 13, 2010 - 02:50 AM
Resident


Joined: Jun 16, 2006
Posts: 617
Location: Sarasota, FL

Can you provide a link for the latest patched avrdude executables? You mention on your webpage that version 5.10 does not support XMEGA unless it is patched (which I am not familiar doing).

[edit] I just found that sinaprog has it included in it.

(I am still trying to get the bootloader to work...)

_________________
www.gabotronics.com
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
radbrad
PostPosted: Sep 13, 2010 - 03:29 AM
Rookie


Joined: Mar 31, 2006
Posts: 48
Location: Corvallis, Oregon

As far as I have been able to determine, the patches are only necessary for a JTAGICE mkII programmer. I have had no trouble using the included makefile (modified for my selected AVR and to use an AVRISP mkII) with the standard AVRDude 5.10.

Brad

_________________
_________________
Brad Nelson
http://bradsprojects.wordpress.com
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
ganzziani
PostPosted: Sep 13, 2010 - 03:43 AM
Resident


Joined: Jun 16, 2006
Posts: 617
Location: Sarasota, FL

Thanks. I am one step further with the bootloader. I am able to run avrdude and the xmega responds. It starts programming but fails in the verification. I get this message:

avrdude: verification error, first mismatch at byte 0x0000
0x0c != 0xff
avrdude: verification error; content mismatch

I compared the content of the ATXMEGA324A4's flash before and after and it is the same. Any clues?

_________________
www.gabotronics.com
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
radbrad
PostPosted: Sep 13, 2010 - 03:52 AM
Rookie


Joined: Mar 31, 2006
Posts: 48
Location: Corvallis, Oregon

Is this output from avrdude loading XBoot onto the micro via PDI or avrdude loading a program onto the micro via XBoot?

I recall seeing this error I got when the bootloader was not correctly loaded into the boot section.

Hmmm ... come to think of it, I also got this error recently on a new development setup and the only way I could get it to install was to restart the computer. It would only correctly load the bootloader on the first avrdude attempt per boot. I hate to give such crude advice, but try unplugging the programmer and rebooting, then give it another try.

A little more info might help: Are you using the included makefile? What OS? Which programmer? The terminal command you are using with avrdude and the full output would help also.

Brad

_________________
_________________
Brad Nelson
http://bradsprojects.wordpress.com
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
ganzziani
PostPosted: Sep 13, 2010 - 04:04 AM
Resident


Joined: Jun 16, 2006
Posts: 617
Location: Sarasota, FL

Thanks. Attached is the source, the hex file, the makefile and the output. All the remaining source files that I didn't include are the same as the original source.

I am using windows 7 64-bit, avrdude 5.10, AVR Studio 4.18, with the "Use external makefile" checked.

I was wondering if the problem was specifying the address like in the posts above, but since I am using the makefile, I think the linker options cannot be changed.

_________________
www.gabotronics.com
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
radbrad
PostPosted: Sep 13, 2010 - 04:12 AM
Rookie


Joined: Mar 31, 2006
Posts: 48
Location: Corvallis, Oregon

You're using a JTAGICE mkII programmer according to the Makefile - is that right? Also, have you verified the JTAGICE mkII hardware revision you have can program XMegas? (Search the forum for more info if not) Does it have recent firmware loaded into it?

I'm not a Windows user, so I'll help as much as I can but it will be mostly in generalities.

_________________
_________________
Brad Nelson
http://bradsprojects.wordpress.com
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
ganzziani
PostPosted: Sep 13, 2010 - 04:16 AM
Resident


Joined: Jun 16, 2006
Posts: 617
Location: Sarasota, FL

I am using the serial port, not the JTAGICE. I just changed that setting on the makefile, so now it is:
AVRDUDE_PROGRAMMER = avr109

But it didn't make any difference.

_________________
www.gabotronics.com
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
radbrad
PostPosted: Sep 13, 2010 - 04:23 AM
Rookie


Joined: Mar 31, 2006
Posts: 48
Location: Corvallis, Oregon

Hope this doesn't come across as condescending, just need to make sure we're on the same page:

1) XBoot must first be correctly loaded into the boot section of flash on the XMega. This must happen using a PDI capable programmer, such as the JTAGICE mkII or the AVRISP mkII. The patch mentioned is for this step, not for general XBoot (AVR109) programming.

2) After XBoot has been correctly loaded, only then can one use avrdude configured to use the AVR109.

It sounds to me like step 1 has not been correctly accomplished yet. Which PDI capable programmer are you using for this step?

_________________
_________________
Brad Nelson
http://bradsprojects.wordpress.com
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits