| Author |
Message |
|
|
Posted: Apr 04, 2012 - 03:13 AM |
|

Joined: Apr 03, 2010
Posts: 82
|
|
hello
i just got my xplained board but for two days im having problems with connecting it.
At first i tried on windows and programmed it and i lost the bootloader.
Im trying to reprogram (on both windows and linux)it with a dragon but i got nothing.I ve treid everything i found on forums and atmel's pdf but i cant find a solution.
Did anyone have the same problem?
Also a general question.Which operating system is better and more flexible for programming for av32 controllers?I used to use avr studio for mega on windows ,but now with avr32 studio and batchisp i dont know if its better on linux?
thanks |
|
|
| |
|
|
|
|
|
Posted: Apr 04, 2012 - 03:58 AM |
|

Joined: Mar 28, 2010
Posts: 129
Location: Palmerston North, New Zealand
|
|
Hi Giannhssdra
Firstly have you tried to reset to the Bootloader, in accordance with the documentation? (Once you have programmed your application it will automatically load until you manually start the bootloader by pressing SW0 as you power the board - connect it to the USB). This should always fire up the bootloader, as it is not overwritten when you program you application.
You may have difficulty in Linux with the driver for the bootloader (I did) so I tended to use windows for most of my development. There are a number of people using Linux to develop however so they may be able to point you in the right direction. I know there is an equivalent to batchISP in Linux which you can use.
I personally prefer windows for driver issues, as Im more familiar with it, than Linux.
Regards. |
|
|
| |
|
|
|
|
|
Posted: Apr 04, 2012 - 04:07 AM |
|

Joined: Apr 03, 2010
Posts: 82
|
|
I programmed it with to blink a led.But even i press the button before power up it doesn't enter the bootloader(the led keeps blinking).
On windows first i installed the driver from the atmel's site but i had to switch driver to flip's usb dfu driver to work with batchisp.
I could only run ht uc and communicate through terminal but i could not program it with batchisp.
I could only program it through dragon but not the xplained board alone.
What can i do with the drivers?
If i get it right i only need batchisp and the bootloader if i want to program the board through usb without extra tool.Or i also need them is i will program the board the the dragon? |
|
|
| |
|
|
|
|
|
Posted: Apr 04, 2012 - 05:30 AM |
|

Joined: Mar 28, 2010
Posts: 129
Location: Palmerston North, New Zealand
|
|
You should be able to program just with the correct driver and BatchISP. What application are you using to program the device. I would strongly suggest the AVR32 IDE, as it will correctly program through the bootloader, and sorts the commands required for you. If you know the commands however you can just use the command line and batchISP. What commands did you send to program it initially?
If you have overwritten the bootloader accidentally then the only option is to program with JTAG. I dont believe that dragon will be able to reprogram the bootloader (although you can generate the bootloader as it is one of the example applications in AVR32 studio.
I haven't used the Xplained board, but suspect it may have come with an application installed (as well as the bootloader) and this is probably the reason why you needed two different drivers, one for the application (most likely the USB CDC application) and one for the bootloader once it has entered this mode.
Not sure what else I could help you with, but good luck.
Regards. |
|
|
| |
|
|
|
|
|
Posted: Apr 04, 2012 - 02:04 PM |
|

Joined: Apr 03, 2010
Posts: 82
|
|
|
Quote:
You should be able to program just with the correct driver and BatchISP
I cant program it through batchisp.
FIrst time i programed it it was with avrstudio 6 and using dragon's jtag.I can also program it through avr32 studio with the dragon again.
Im trying with batchisp but i cant program it the command is
Quote:
batchisp -device at32uc3a3256 -hardware usb -operation erase f memory flash blankcheck loadbuffer blabla.elf program verify start reset 0
It fails when erasing the chip and programming it.
But when i used
Quote:
batchisp -device at32uc3a3256 -hardware usb -operation read momory bootloader
it worked fine
Im trying to reprogram the bootloader form avr32 studio.In targets window right click on dragon and gives an option to program the bootloader.But it find the hex file to load.I dont know where that is.
Quote:
I haven't used the Xplained board, but suspect it may have come with an application installed (as well as the bootloader)
Yes it was like that.So i have to install the driver from flip/usb if i want to program it with batchisp.
And if i want to use it just as com port i should install the other driver? |
|
|
| |
|
|
|
|
|
Posted: Apr 04, 2012 - 10:06 PM |
|

Joined: Mar 28, 2010
Posts: 129
Location: Palmerston North, New Zealand
|
|
Hi Giannhssdra
Here is the command I use to reprogram my units via BatchISP
Code:
batchisp -device AT32UC3A3256 -hardware usb -operation onfail abort memory FLASH erase F loadbuffer filename.elf program verify reset 0 (WAIT)
Try that and see if it works as it does for me (note this is called via a java program much the same way as flip does).
You can also program units using batchISP from AVR32 studio, you just need to set up a DFU target, as well as the dragon programmer. Again for testing this is generally how I program the units rather than using a JTAG programmer, as the USB connectivity is easier to connect.
Without knowing exactly what the application is that comes installed on the board, I would suspect that the driver you will have installed for it is the CDC Virtual COM port driver. (I use this one all the time). However the bootloader uses a different USB 'protocol' and therefore needs a different driver (DFU driver) which should get installed as part of flip. Both drivers are only needed to be installed once, and are then selected based on what the USB reports when it connects. Just hope that clears it up.
Regards. |
|
|
| |
|
|
|
|
|
Posted: Apr 05, 2012 - 12:33 AM |
|

Joined: Apr 03, 2010
Posts: 82
|
|
Thanks for the answer.
I understood now about the drivers and i tested my self.
I cant program it with batchisp because i dont have the bootloader.
I saw at atmels dfu bootloader pdf that i can program the bootloader with avr32program ( and atprogram if they are the same ) and a bin file.But i cant find anywhere that bin file( and i am not the only one ).
Any idea where i can find it?
From avr32 studio gives an option to program the bootloader but gives eroor everytime. |
|
|
| |
|
|
|
|
|
Posted: Apr 05, 2012 - 01:22 AM |
|

Joined: Mar 28, 2010
Posts: 129
Location: Palmerston North, New Zealand
|
|
What error are you getting.
When I have had issues, I normally do a complete chip erase, reset the JTAG, and then do a bootloader install, which then SHOULD work. I have typically done this in AVR32 Studio which works well, not sure about the stability of AVR Studio 6 as I haven't used it.
The erase is important as it can be that part of the FLASH is locked and the chip erase removes this lock, allowing you to re-program the bootloader.
Regards. |
|
|
| |
|
|
|
|
|
Posted: Apr 05, 2012 - 01:59 AM |
|

Joined: Apr 03, 2010
Posts: 82
|
|
Im doing it the same way i think.
On the targets window right click and erase chip which works.
Then right click and program bootloader.
It has two versions 1.0.3. and 1.0.2.I use the first one
starts programming and gives an error saying nothing.
If i use the second one says it cant find the bin file.
But the 1.0.3 is there but for some reason it cant be programmed.
In dfu bootloader pdf i found these commands for programming the bootloader.
Quote:
Issue a JTAG Chip Erase command to make sure the part is unprotected and free to use:
avr32program chiperase
• Program the bootloader:
avr32program program -finternal@0x80000000,512Kb -cxtal -e -v -O0x80000000 -Fbin
at32uc3a-isp-1.0.0.bin
• Program the bootloader configuration word in the User page:
avr32program program -finternal@0x80000000,512Kb -cxtal -e -v -O0x808001FC -Fbin
at32uc3a-isp_cfg-1.0.0.bin
• Write the general-purpose fuses with their default value used by the ISP:
avr32program writefuses -finternal@0x80000000,512Kb gp=0xFC07FFFF
I thought i could use those commands but i dont know the exact user page address to upload the 32-bit word.
From atmels site http://www.atmel.com/devices/AT32UC3A3256.aspx?tab=documents i downloaded a zip which had some bin files and come cmd files |
|
|
| |
|
|
|
|
|
Posted: Apr 05, 2012 - 02:24 AM |
|

Joined: Mar 28, 2010
Posts: 129
Location: Palmerston North, New Zealand
|
|
One question, are you powering the board while you are trying to program the bootloader.
I have had issues where you need to have USB connected while programming using the JTAG. Its just a thought. |
|
|
| |
|
|
|
|
|
Posted: Apr 05, 2012 - 02:35 AM |
|

Joined: Apr 03, 2010
Posts: 82
|
|
Yes.
Actually i dont know if its possible the other way.
I tried without plug in the xplain board and only the dragon but it was giving error.
I downloaded this file from atmels site.It was in at32uc3a3256 .Can you just see if those are the files for the bootloader?
Also why cant i use avr32program and only atprogram?
Is it a seperate installation do i have to do anything more?
At program opens with command line from studio 6.
But i cant find how to open command line from av32 studio
This is what i get when programming the boot loader form avr32 studio
Quote:
Executing cmd.exe /C avr32program -c USB:FFFFFFFFFFFF -pavrdragon --part UC3A3256 chiperase (WAIT)
Connected to AVR Dragon ÿÿÿÿÿÿ version {0x0716, 0x0716}.
JTAG chip erase performed.
Executing cmd.exe /C avr32program -c USB:FFFFFFFFFFFF -pavrdragon --part UC3A3256 program -finternal@0x80000000,512Kb -cxtal -e -v -O0x80000000 -Fbin C:\Users\Sentos\AppData\Local\Temp\at32uc3a3-isp-1.0.3.bin5876887068971533790.bin (WAIT)
Process failed with error code -1,073,741,819.
but the bin file that is looking for isnt in that directory.It has some other bin for the uc3 |
|
|
| |
|
|
|
|
|
Posted: Apr 05, 2012 - 03:55 AM |
|

Joined: Apr 03, 2010
Posts: 82
|
|
I finally got it working.
The tecnical support of atmel send me the hex elf and bin of bootloader.
I can run and program now with batchisp.
One last question (i hope)
I programmed the board with the bootloader using the dragon and then the board with dfu from batchisp.
The bootloader still is in there but i cant access it anymore.(push button during power up)
Is this because of the trampoline the asf puts in every program?Can i somehow dont include it and have the program enters the bootloader first and if i dont push the button during power up jump to my application or else enter the bootloader
Can i use the addrange option with the batchisp to load my program beyond the bootloader?
And still have the push button option?
Thanks for the help |
|
|
| |
|
|
|
|
|
Posted: Apr 09, 2012 - 10:12 PM |
|

Joined: Mar 28, 2010
Posts: 129
Location: Palmerston North, New Zealand
|
|
The bootloader uses the last four bytes of the userpage to store information about which pin to check on startup for the bootloader. Additionally there are three fuses that control how the bootloader starts (if at all). Check that you are not overwritting the userpage information, so that the last four bytes are being corrupted, and check that you have not set the three fuses, as the middle fuse tells the bootloader whether or not to check a pin on start as to whether it should run or not.
The trampoline section is not actually written if the bootloader is there, what it does is simulate the booloader so that your code can run with or without the bootloader installed, and all memory references are therefore correct. When programming with the bootloader you will get a warning that your application and the bootloader overlap, which is normal as far as I can tell, and therefore the trampoline is not written.
The trampoline is what causes your program to automatically be moved to the correct location for when the bootloader is installed.
regards. |
|
|
| |
|
|
|
|
|
Posted: Apr 10, 2012 - 02:43 PM |
|

Joined: Apr 03, 2010
Posts: 82
|
|
Hello
Any ideas why i can use the bootloader only once?
Im programming first the board with the bootloader using the dragon.
Then using batchisp and dfu i can program the board with the application.(before unplug the board im able to reprogram it with batch isp meaning that the bootloader is still in there.
From avr studio i can see that the trampoline is compiled and linked tomy project.
But i cant go back in the bootloader again(press button during power up)
Any ideas why is this happening? |
|
|
| |
|
|
|
|
|
Posted: Apr 10, 2012 - 11:56 PM |
|

Joined: Mar 28, 2010
Posts: 129
Location: Palmerston North, New Zealand
|
|
Two things may be wrong. Firstly the bootloader may not be being protected when you are programming it manually with the dragon. I know it does when using AVR32 (1.7) studio programs the bootloader normally. If this is the case then you SHOULD see a warning when you program your application. Here is the output from batchISP (in the AVR32 console) when I use it to program my application
Code:
Executing cmd.exe /C avr32program -l (WAIT)
Executing cmd.exe /C batchisp -device AT32UC3A3256 -hardware usb -operation onfail abort memory FLASH erase F loadbuffer C:\Users\Daff\Documents\workspace\SpiderFirmware\V3Firmware\Release\S3Firmware_2.2.002.elf program verify start noreset 0 (WAIT)
Running batchisp 1.2.4 on Wed Apr 11 10:52:12 2012
AT32UC3A3256 - USB - USB/DFU
Device selection....................... PASS
Hardware selection..................... PASS
Opening port........................... PASS
Reading Bootloader version............. PASS 1.0.3
Selecting FLASH........................ PASS
Erasing................................ PASS
Parsing ELF file....................... PASS C:\Users\Daff\Documents\workspace\SpiderFirmware\V3Firmware\Release\S3Firmware_2.2.002.elf
Programming memory
WARNING: The user program and the bootloader overlap!
Programming memory..................... PASS 0x00000 0x1bf57
Verifying memory....................... PASS 0x00000 0x1bf57
Starting Application................... PASS NORESET 0
Summary: Total 10 Passed 10 Failed 0
NOTE : The warning about the user program and bootloader overlapping...
The second thing that could be changing, as I said above, is that if you are programming something into the user page that used the whole 512 bytes, then you will be overwriting the last four bytes, which the bootloader uses to determine which pin to test on startup to see if it should run, or skip to your application. If this has been changed then it is likely that the bootloader will not run at all.
Hope that helps. |
|
|
| |
|
|
|
|
|
Posted: Apr 11, 2012 - 10:35 AM |
|

Joined: Apr 03, 2010
Posts: 82
|
|
|
Code:
WARNING: The user program and the bootloader overlap!
I get this warning every time i use batchisp.
Does this have something to so with the fuses?
I saw that the fuses must be set at 0xfff7ffff to have an 8kb area for the bootloaer.
But every time i read the fuses (after i have programmed the board) they have a value at 0xffffffff. |
|
|
| |
|
|
|
|
|
Posted: Apr 11, 2012 - 10:45 PM |
|

Joined: Mar 28, 2010
Posts: 129
Location: Palmerston North, New Zealand
|
|
The warning is indicating that the trampoline and the bootloader are in the same address space and therefore overlap. Which is what is the job of the trampoline (if bootloader is there, dont overwrite it, if not then trampoline performs same function and bounces to you application's start address (80008000 i think) from the 'normal' (80000000 - i think) start address.).
The fuses are written by a separate command directly (if required) but you should not need to change these, once set.
This looks to be where you are having the issue with the bootloader not running once your application is loaded. I have the following set for my application (which has the bootloader able to be run by pressing a key on my custom board)
BODLevel : 0x3F
LOCK bit Mask : 0xFFFF
Bootloader Size : 8K Bytes
EPFL : Enabled
GP Fuses : 0x6
It is the GP fuses that control the bootloader
Small point to note here, and I cannot find anywhere where it has been documented is that reading from the bootloader will modify these bits so that the bootloader ALWAYS runs once a read has occurred. This means reading the fuses affects the fuses you see. Took me a while to work this one out.
I used to manually program the fuses once the main application has been programmed, but by getting the bootloader to start the application, once programmed I found that the fuses have then been correctly set to enable the application to run unless the button is pressed on start, and therefore the bootloader is started. |
|
|
| |
|
|
|
|
|