Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Reboot AT91SAM9260 After Flashing With SAM-BA
PostPosted: Tue Aug 16, 2011 12:03 am 
Offline

Joined: Mon Aug 15, 2011 11:49 pm
Posts: 4
Hi All,

Please note that my question is exactly the same as that posed by Gertjan last year. Not sure if his was answered:

viewtopic.php/f,26/t,19421/p,32594/hilit,reboot/#p32594

I am trying to use SAM-BA to reboot a board after flashing it. I have a TCL script that does essentially what SAM-BA does. Like Gertjan, I tried "TCL_Go(0)" with no success. It seems to me that this would be a very common problem. It is urgent that I get a solution ASAP.

TIA,

J.C.


Top
 Profile  
 
 Post subject: Re: Reboot AT91SAM9260 After Flashing With SAM-BA
PostPosted: Tue Aug 16, 2011 5:05 am 
Offline

Joined: Fri Mar 04, 2011 5:21 am
Posts: 18
can you make it clear your target why you reboot through sam-ba.
because sam-ba is used to download/upload data to flash and sdarm on ateml91sam board.
so commonly , your can add a reset-button or plugin&out your power jack.


Top
 Profile  
 
 Post subject: Re: Reboot AT91SAM9260 After Flashing With SAM-BA
PostPosted: Tue Aug 16, 2011 2:13 pm 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 784
>>can you make it clear your target why you reboot through sam-ba. because sam-ba is used to download/upload data to flash and sdarm on ateml91sam board. so commonly , your can add a reset-button or plugin&out your power jack.

Because obviously he wants to automate a production/test programming sequence for the board, and avoid human interaction with buttons or power jacks.

You could try calling the boot rom's reset address, but potential problems here are the states of the clocks, peripherals, remapping, etc.

Another approach would be to create and load a small applet that generates a hardware reset, and call that. This would get the hardware in a consistent/predictable state.

This would probably work best with a serial connection, than a USB one.


//-----------------------------------------------------------------------------
/// Resets the processor.
//-----------------------------------------------------------------------------
void RSTC_ProcessorReset(void)
{
AT91C_BASE_RSTC->RSTC_RCR = AT91C_RSTC_PROCRST | RSTC_KEY_PASSWORD;
}

or use a watchdog reset.


Top
 Profile  
 
 Post subject: Re: Reboot AT91SAM9260 After Flashing With SAM-BA
PostPosted: Tue Aug 16, 2011 5:44 pm 
Offline

Joined: Mon Aug 15, 2011 11:49 pm
Posts: 4
[quote="CptTitanic"]>>can you make it clear your target why you reboot through sam-ba. because sam-ba is used to download/upload data to flash and sdarm on ateml91sam board. so commonly , your can add a reset-button or plugin&out your power jack.

Because obviously he wants to automate a production/test programming sequence for the board, and avoid human interaction with buttons or power jacks.

You could try calling the boot rom's reset address, but potential problems here are the states of the clocks, peripherals, remapping, etc.

Another approach would be to create and load a small applet that generates a hardware reset, and call that. This would get the hardware in a consistent/predictable state.

This would probably work best with a serial connection, than a USB one.


//-----------------------------------------------------------------------------
/// Resets the processor.
//-----------------------------------------------------------------------------
void RSTC_ProcessorReset(void)
{
AT91C_BASE_RSTC->RSTC_RCR = AT91C_RSTC_PROCRST | RSTC_KEY_PASSWORD;
}

or use a watchdog reset.[/quote]

That is exactly right. I am trying to avoid human intervention in the production of our boards.

I would like to try the code above, but since I am in an urgent situation, I decided to use U-Boot to see it if it would work first.

As I understand, according to the data sheet on the AT91SAM9260, the 32-bit reset controller reset control register is mapped at memory address 0xFFFFFD00. The bit for processor reset is at position 0. The password for reset is 0xA5 and must be written to upper byte of reset control register.

Typing "mw", for "memory write", at the U-Boot command prompt, gives the following help:

Usage:
mw [.b, .w, .l] address value [count]

To me, this says that I get the choice of 8-bit, 16-bit, or 32-bit word-size for the value to be written. I should specify the address to write, the value to write, and a count for repetition, which is presumably 1 by default.

So I try:

mw .l 0xFFFFFFD0 0xA5000001 1

This does not work. U-Boot simply reprints the Usage message above, implying that I am not doing something right.

So I try:

mw .l 0xFFFFFD00 0xAF000001

...and the CPU hangs (I think). I must do power-cycle so that text starts scrolling again in HyperTerminal.

Seems to me that this should have worked.

Any ideas?

-JC


Top
 Profile  
 
 Post subject: Re: Reboot AT91SAM9260 After Flashing With SAM-BA
PostPosted: Tue Aug 16, 2011 6:37 pm 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 784
I don't have a board in front of me but the syntax should be

mw.l FFFFFD00 A5000005 1

Uboot also has the code reset_cpu(), but it looks to be used in some fault handler ( bad_mode() ), rather than being called as a specific command.


Top
 Profile  
 
 Post subject: Re: Reboot AT91SAM9260 After Flashing With SAM-BA
PostPosted: Tue Aug 16, 2011 7:51 pm 
Offline

Joined: Mon Aug 15, 2011 11:49 pm
Posts: 4
That worked. I was erroneously including a space between the "mw" and the ".l". Now I am trying to get SAM-BA's TCL_Write_Int to do the same thing, at which point my TCL script for automatically programming our boards will be entirely without human intervention.

-JC


Top
 Profile  
 
 Post subject: Re: Reboot AT91SAM9260 After Flashing With SAM-BA
PostPosted: Tue Sep 06, 2011 4:25 pm 
Offline

Joined: Fri Jan 16, 2009 9:00 am
Posts: 3
Hi all
I'm facing a tricky situation not far from your problem.
I have a custom board based on AT91SAM9260.
The NAND flash is erased and so the Boot ROM can detect a USB interface.
The USB interface is properly detected (\usb\ARM0). Then a script is executed to quickly program the nand flash (bootstrap, uboot, kernel, rootfs). Then I need to restart the board in order to automate the production test. So I have added a "go 0" at the end of the tcl script. But nothing happen. The NAND flash has been correctly programmed because if I do a power cycle the board boots up without problem. But this is the step I would like not to do. I need to restart the board from a tcl script.
After programming I have tried to connect SAM-BA to interactively assert some command from the command line as

# TCL_Write_Int $target(handle) 0xA5000005 0xFFFFFDD0
# TCL_Go $target(handle) 0x0 err_code

but the board seems to be freezed and it doesn't reboot.
Have you found the right TCL statement to be included in the script? Can you advise the most correct approach to reboot the board?


thanks in advance

fabio


Top
 Profile  
 
 Post subject: Re: Reboot AT91SAM9260 After Flashing With SAM-BA
PostPosted: Tue Sep 06, 2011 6:51 pm 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 784
>># TCL_Write_Int $target(handle) 0xA5000005 0xFFFFFDD0

Cut-n-paste the address correctly. Poking the wrong address is almost assuredly not going to work well.

#define AT91C_RSTC_RCR (0xFFFFFD00) // (RSTC) Reset Control Register


Top
 Profile  
 
 Post subject: Re: Reboot AT91SAM9260 After Flashing With SAM-BA
PostPosted: Wed Sep 07, 2011 8:51 am 
Offline

Joined: Fri Jan 16, 2009 9:00 am
Posts: 3
Hi
first of all thanks a lot for your help.
You are right: The address was wrong. Now I can restart the board from the SAM-BA command line connected through a \jlink\ARM0. So some progress has been done. Thanks a lot. Anyway usually the \usb\ARM0 interface will be used at the production site. So I need to run a programming script sending all the required image files. At the end of this step I need to issue such a command to restart the board. But in this case the command doesn't work yet. If I restart the board and run again SAM-BA the USB interface is not detected anymore because now the Boot ROM finds some executable code at the beginning of the flash and try to lauch it. I thinks this is the correct behaviour. So my question is why the following command

TCL_Write_Int $target(handle) 0xA5000005 0xFFFFFD00

doesn't work from a USB connection at the end of the programming script? It sounds as the processor is a state where this statement has no effect.
Have you developed a plugin (C code) to reboot your board? Could you show me some hints to compile the plugin from the command line?
Thanks in advance

fabio


Top
 Profile  
 
 Post subject: Re: Reboot AT91SAM9260 After Flashing With SAM-BA
PostPosted: Wed Sep 07, 2011 10:39 pm 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 784
At $100 USD the SAM-ICE for JTAG connectivity isn't particularly expensive. And there is always a serial connection. The actual SAM-BA protocol implemented by RomBOOT isn't particularly complex. I've used a variety of SAM-BA application versions over the years, the newer ones have become less easy to use/modify, and have never been particularly robust.

Personally I'd favour using a serial flash device to plug-in and payload code onto a blank 9260 board. ATMEL demonstrates this with their dataflash on an MMC footprint. On subsequent chips one could use a sub $10 USD SD/MMC Card to payload a boot image onto the NAND. If updating/controlling cards is an issue in production, use a simple bootstrap to pull full images via ethernet from a server.

The "getting started" application would be a particularly good example of injecting run-able code into SDRAM and running it from SAM-BA. Pretty much a case of installing GCC and GNU Make, and running make. I believe the current download for the board contains Keil and IAR examples too. Rebuilding SAM-BA applets should also be a matter of using make, in a similar manner as building AT91BootStrap. Generally the biggest obstacle with the 9260 is the small SRAM.

http://atmel.com/dyn/resources/prod_doc ... oc6297.pdf
http://www.atmel.com/dyn/resources/prod ... oc3257.pdf


Top
 Profile  
 
 Post subject: Re: Reboot AT91SAM9260 After Flashing With SAM-BA
PostPosted: Thu Sep 08, 2011 8:44 am 
Offline

Joined: Fri Jan 16, 2009 9:00 am
Posts: 3
Hi
Thanks a lot for your precious support.
Unfortunately on the custom board I'm working on I have neither dataflash neither SD/MMC slot neither an ethernet interface.
I'll try to modify SAM-BA in order to support my custom board. In the past I have succesfullly customized SAM-BA 2.6 to support other custom boards. I needed to modify just some .tcl script. Now I have SAM-BA 2.10 and I realize that the customization is a little bit more hard because some changes to the C code are required. Basically I need to modify the extram and nandflash plugin. I hope to overcome the difficulties!

Best regards

fabio


Top
 Profile  
 
 Post subject: Re: Reboot AT91SAM9260 After Flashing With SAM-BA
PostPosted: Fri Oct 14, 2011 11:32 am 
Offline

Joined: Thu Apr 30, 2009 11:02 am
Posts: 4
Hi,

I have tried to set the EXTRST bit in the reset control register value,
TCL_Write_Int $target(handle) 0xA500000D 0xFFFFFD00 and works properly.

With 0xA5000005 value for the reset control register, the sam-ba applet loaded in RAM reset continually.

Best regards.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: