| Author |
Message |
|
|
Posted: Dec 15, 2009 - 10:14 AM |
|


Joined: Jan 23, 2004
Posts: 9826
Location: Trondheim, Norway
|
|
Freaks,
I've just completed what appears to be a working first revision of a programming firmware for the XPLAIN board, loadable via FLIP into the onboard AT90USB1287. When loaded, it will cause the USB AVR to enumerate as a AVRISP-MKII which (with the latest AVRStudio release) can then program the board's XMEGA via its PDI interface.
I've attached the first build of the programmer firmware here. All those with XPLAIN boards gathering dust because you don't have an external programmer - this is for you! All I ask is for some feedback; post here if the firmware works (or doesn't work) for you.
For those interested in a generic open source XMEGA programmer, the source code for this is located in my LUFA project public SVN at http://code.google.com/p/lufa-lib/, under the Projects/AVRISP/ folder.
A very, very, very big special thanks to Justin Mattair for his help with the PDI protocol, and to Ross McKenzie for loaning me his XPLAIN board for development.
Note that Rev 1 XPLAIN boards have a faulty bootloader in the USB AVR, and cannot be flashed with this firmware without an external JTAG programmer.
EDIT: Latest build and source is now available from my site: http://www.fourwalledcubicle.com/XPLAIN.php
EDIT: I've posted a short guide to loading and using the firmware on my blog: http://fourwalledcubicle.com/blog/archives/508
- Dean  |
_________________ Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
Last edited by abcminiuser on Jul 18, 2010 - 06:59 AM; edited 9 times in total
|
| |
|
|
|
|
|
Posted: Dec 15, 2009 - 01:03 PM |
|


Joined: Jun 11, 2004
Posts: 2422
Location: Vilanova (Barcelona)
|
|
| Good job, Dean. |
_________________ Guillem.
"Common sense is the least common of the senses" Anonymous.
|
| |
|
|
|
|
|
Posted: Dec 15, 2009 - 04:22 PM |
|


Joined: Dec 11, 2007
Posts: 6849
Location: Cleveland, OH
|
|
Once again, Dean, you have outdone yourself!
Nice Job!
JC |
|
|
| |
|
|
|
|
|
Posted: Dec 15, 2009 - 05:04 PM |
|


Joined: Sep 04, 2002
Posts: 21258
Location: Orlando Florida
|
|
| If they offered you a job in Finland, would you move up there? |
_________________ Imagecraft compiler user
|
| |
|
|
|
|
|
Posted: Dec 15, 2009 - 06:13 PM |
|

Joined: Nov 29, 2007
Posts: 3219
|
|
|
bobgardner wrote:
If they offered you a job in Finland, would you move up there?
What should he do in Finland? Lurking over the border into north Norway, around the corner and around Sweden, to figure out what the Atmel guys are doing at almost the other end of Norway? |
|
|
| |
|
|
|
|
|
Posted: Dec 15, 2009 - 06:51 PM |
|


Joined: Mar 28, 2001
Posts: 20363
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)
|
|
So do we still keep the bridge functionality?
How do we switch from programmer to bridge?
If you haven't fininshed a full manual, why not?  |
_________________ John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
|
| |
|
|
|
|
|
Posted: Dec 15, 2009 - 07:00 PM |
|


Joined: Apr 25, 2004
Posts: 3809
Location: Denmark
|
|
Nice Dean.
Does one have to check out via SVN 0r is there an uptodate Zip
Well i used SVN
Is there a special "Board ID" for the Xplain board in the makefile ?
/Bingo |
Last edited by Bingo600 on Dec 15, 2009 - 07:19 PM; edited 1 time in total
|
| |
|
|
|
|
|
Posted: Dec 15, 2009 - 07:01 PM |
|


Joined: Sep 04, 2002
Posts: 21258
Location: Orlando Florida
|
|
| Finskis, Norskis, Swedskis, they're all furriners to us good ol boys. I never was too good with geography. |
_________________ Imagecraft compiler user
|
| |
|
|
|
|
|
Posted: Dec 15, 2009 - 07:40 PM |
|

Joined: Nov 29, 2007
Posts: 3219
|
|
avrdude 5.8 (with PDI patch, but that shouldn't matter here):
Code:
$ dfu-programmer at90usb1287 erase --suppress-bootloader-mem
$ dfu-programmer at90usb1287 flash --suppress-bootloader-mem XPLAIN\ Programmer\ R1.hex
Validating...
6288 bytes used (5.12%)
$ lsusb | grep Atmel
Bus 001 Device 011: ID 03eb:2104 Atmel Corp. AVR ISP mkII
$ avrdude -p atxmega128a1 -c avrispmkII -P usb -t
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.30s
avrdude: Device signature = 0x1e974c
avrdude> dump flash 0 256
>>> dump flash 0 256
0000 0c 94 fa 00 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
0010 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
0020 0c 94 1c 01 0c 94 1c 01 0c 94 d7 06 0c 94 1c 01 | ... ... ... ...|
0030 0c 94 1c 01 0c 94 1c 01 0c 94 24 06 0c 94 1c 01 | ... ... .$. ...|
0040 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
0050 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
0060 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
0070 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
0080 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
0090 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
00a0 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
00b0 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
00c0 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
00d0 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
00e0 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
00f0 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
avrdude> quit
>>> quit
avrdude: safemode: Fuses OK
avrdude done. Thank you.
$
Reading just the first 256 bytes of the flash takes, however, 25 seconds. 25 s / 256 bytes ~= 100 ms/byte
I didn't try programming. |
|
|
| |
|
|
|
|
|
Posted: Dec 15, 2009 - 10:54 PM |
|


Joined: Jan 23, 2004
Posts: 9826
Location: Trondheim, Norway
|
|
Thanks all!
Quote:
If they offered you a job in Finland, would you move up there?
Every time I hear "Finland", I always think of that Monty Python song. If Atmel were ever to offer me a job, I think the bits wouldn't have time to travel to my inbox before I would already be on a plane over there.
Quote:
So do we still keep the bridge functionality?
How do we switch from programmer to bridge?
If you haven't fininshed a full manual, why not? Wink
Programmer only for now. Once it's shown to work, I'll make a special dual version which can act as a programmer or a bridge, depending on a jumper (or similar switching method). I'd be able to do both at the same time, except the Atmel drivers won't bind to a compound device.
Quote:
Does one have to check out via SVN 0r is there an uptodate Zip
Well i used SVN Smile
Is there a special "Board ID" for the Xplain board in the makefile ?
Yes, SVN only for now, until the next release (which will be as soon as I can confirm this working for the unwashed masses). When compling, specify "BOARD = XPLAIN" in the makefile and it'll do the rest to ensure it will work on the board.
Quote:
Reading just the first 256 bytes of the flash takes, however, 25 seconds. 25 s / 256 bytes ~= 100 ms/byte
I didn't try programming.
That's ridiculous - something's wrong there with how AVRDude is sending the bytes; I'll go check it out. Under AVRStudio, my code is currently faster than the Atmel JTAG, by virtue of it's 1MHz bus since it's located so close to the target chip physically. Writing the QTouch app takes less than a second, and full 256KB readback takes only 5 seconds or so. I'll go see what's what.
- Dean  |
_________________ Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
|
| |
|
|
|
|
|
Posted: Dec 16, 2009 - 01:31 AM |
|


Joined: Jan 23, 2004
Posts: 9826
Location: Trondheim, Norway
|
|
ArnoldB, where did you get your AVRDude build (and patch), and what OS are you using? The latest AVRDude in WinAVR doesn't work under Windows for me, as it doesn't want to work with the USB port. Under Ubuntu, I get a faulty (0x00) readback on almost every read. Since yours apparently works (and since the code works with AVRStudio), I'm thinking I need to get a later avrdude version.
- Dean  |
_________________ Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
|
| |
|
|
|
|
|
Posted: Dec 16, 2009 - 02:19 AM |
|


Joined: Jan 23, 2004
Posts: 9826
Location: Trondheim, Norway
|
|
Yep, AVRDude's jiggered - no idea how you got yours working ArnoldB. I compiled from the latest source and ran some tests - AVRDude is trying to read the wrong addresses (it reads address 0x02000090UL for the signature, instead of 0x01000090UL, for example). If I force it to continue, I see the same crazily slow read speed you do when reading out normal bytes.
I think I might see if I can figure out the avrdude code, and make my own patch.
EDIT: Darn. After fixing it myself in the source, I then through to seek out ArnoldB's mentioned patch, and found it at http://www.avrfreaks.net/index.php?name ... ;p=645370. Using that and the slightly updated version attached here, it all works great now.
EDIT 2: Removed updated build - see original post for latest version.
- Dean  |
_________________ Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
Last edited by abcminiuser on Jan 05, 2010 - 12:28 PM; edited 1 time in total
|
| |
|
|
|
|
|
Posted: Dec 16, 2009 - 10:02 AM |
|

Joined: Sep 27, 2007
Posts: 9
|
|
The first revision of the Xplain board was a composite device with a dual CDC class so both programmer and serial interface was available at the same time.
This can be achieved by using the association descriptors in the USB which will wrap each of the CDC in it's own class. However, Windows XP SP2 do not have drivers that support this without manually updating the usbser.sys and another .sys file. Updates available at microsoft.com. The SP3 do however include this so it will work without any magic updates.
Dean can probably make this work without any jumpers or such and use the driver (.inf) file for the rev1 of the Xplain. It's in the zip-file for the Xplain at www.atmel.com/xplain. |
|
|
| |
|
|
|
|
|
Posted: Dec 16, 2009 - 10:10 AM |
|


Joined: Jan 23, 2004
Posts: 9826
Location: Trondheim, Norway
|
|
SuperAVRMan,
The Atmel firmware apparently uses a CDC interface for the programming; what host side application is Atmel using to program the XPLAIN? That method won't work here as my version clones a full AVRISP-MKII (including the V2 protocol and ISP/PDI programming modes) which can't be part of a composite device.
Also, if Atmel has a semi-complete version already made, why isn't it in general use?
- Dean  |
_________________ Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
|
| |
|
|
|
|
|
Posted: Dec 16, 2009 - 05:19 PM |
|

Joined: Nov 29, 2007
Posts: 3219
|
|
I am using Ubuntu 9.04, an avrdude 5.8 compiled from original source with the PDI patch.
With the R2 version it still takes 25 seconds for dumping the first 256 bytes of flash. And avrdude crashes on a second attempt:
Code:
$ avrdude -p atxmega128a1 -c avrispmkII -P usb -t
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.30s
avrdude: Device signature = 0x1e974c
avrdude> dump flash 0 256
>>> dump flash 0 256
0000 0c 94 fa 00 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
0010 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
0020 0c 94 1c 01 0c 94 1c 01 0c 94 d7 06 0c 94 1c 01 | ... ... ... ...|
0030 0c 94 1c 01 0c 94 1c 01 0c 94 24 06 0c 94 1c 01 | ... ... .$. ...|
0040 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
0050 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
0060 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
0070 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
0080 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
0090 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
00a0 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
00b0 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
00c0 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
00d0 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
00e0 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
00f0 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 0c 94 1c 01 | ... ... ... ...|
avrdude> dump flash 0 256
>>> dump flash 0 256
avrdude: usbdev_send(): wrote 0 out of 1 bytes, err = No error
avrdude: stk500_send_mk2(): failed to send command to serial port
$
The USB interface is still there, and when starting avrdude again I can again read the flash (at the low rate).
So the crash must be something inside avrdude. |
|
|
| |
|
|
|
|
|
Posted: Dec 16, 2009 - 06:39 PM |
|

Joined: Oct 17, 2003
Posts: 57
|
|
Congratulations Dean.
You are a pretty smart guy and I am sure Atmel with consider you in their future plans (Better they do it soon or they will lose the opportunity). |
|
|
| |
|
|
|
|
|
Posted: Dec 16, 2009 - 11:50 PM |
|


Joined: Jan 23, 2004
Posts: 9826
Location: Trondheim, Norway
|
|
|
Quote:
I am using Ubuntu 9.04, an avrdude 5.8 compiled from original source with the PDI patch.
With the R2 version it still takes 25 seconds for dumping the first 256 bytes of flash. And avrdude crashes on a second attempt:
Try using non terminal mode -- that's what I tested with and what appears to work great (with the patched version). Try this:
Code:
$ avrdude -p atxmega128a1 -c avrispmkII -P usb -U flash:r:FIRMWARE.hex
- Dean  |
_________________ Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
|
| |
|
|
|
|
|
Posted: Dec 23, 2009 - 09:47 PM |
|

Joined: Feb 08, 2006
Posts: 12
|
|
Hallo,
thanks to Dean for his great work! I've just downloaded the newest LUFA and tried to get the Xplain bridge to work. I could build the project for the 1287 with no errors in Studio 4.18 Build 692
Program: 4190 bytes (3.2% Full)
(.text + .data + .bootloader)
Data: 307 bytes (3.7% Full)
(.data + .bss + .noinit)
Flip succeeded in programming and Windows XP SP3 shows a 'LUFA XPLAIN Bridge' I set the driver to the 'LUFA XPLAIN Bridge.inf' file and get a 'communications port'
But the AVRstudio is not able to connect to an AVRISP mkII using an USB connection.
Does anybody know where the fault is?
Thanks and greetings from Germany
Eumel |
|
|
| |
|
|
|
|
|
Posted: Dec 23, 2009 - 10:58 PM |
|


Joined: Jan 23, 2004
Posts: 9826
Location: Trondheim, Norway
|
|
Eumel,
The XPLAINBridge code is for making a USB to Serial bridge between the XMEGA and the host for communications -- but not for programming. To be able to make the XPLAIN board appear as a AVRISP-MKII for programming of the XMEGA, you'll instead need to compile and flash the "AVRISP" project in LUFA, compiled for the XPLAIN board.
- Dean  |
_________________ Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
|
| |
|
|
|
|
|
Posted: Dec 24, 2009 - 10:10 AM |
|

Joined: Feb 08, 2006
Posts: 12
|
|
Thank you very much Dean!
Merry Christmas to you and your family.
Greetings from the cold (and a little bit snowy) north west Germany
Einhart |
|
|
| |
|
|
|
|
|