Hello I have the following problem with the at91sam9g20 and a software + hardware reset:
44.3.5 Reset Controller (RSTC)
44.3.5.1 RSTC: Reset During SDRAM Accesses
When a User Reset occurs during SDRAM read access, the SDRAM clock is turned off while
data are ready to be read on the data bus. The SDRAM maintains the data until the clock
restarts.
If the user Reset is programmed to assert a general reset, the data maintained by the SDRAM
leads to a data bus conflict and adversely affects the boot memories connected on the EBI:
• NAND Flash boot functionality, if the system boots out of internal ROM.
• NOR Flash boot, if the system boots on an external memory connected on the EBI CS0.
Problem Fix/Workaround
1. Avoid User Reset to generate a system reset.
2. Trap the User Reset with an interrupt.
In the interrupt routine, Power Down SDRAM properly and perform Peripheral and Processor
Reset with software in assembler.
I tried the following code in the kernel-file /arch/arm/mach-at91/at91sam9260.c
Code:
#include <mach/at91sam9_sdramc.h>
static void soft_user_reset (void)
{
//;disable IRQs
asm("MRS r0, CPSR");
asm("ORR r0, r0, #0x80");
asm("MSR CPSR_c, r0");
//change refresh rate to block all data accesses
//asm("LDR r0, =0xFFFFEA04");// AT91_SDRAMC_TR = 0xFFFFEA04
//asm("LDR r1, =1");
//asm("STR r1, [r0]");
at91_sys_write(AT91_SDRAMC_TR,1);
//prepare power down command
//asm("LDR r0, =0xFFFFEA10");//AT91_SDRAMC_LPR = 0xFFFFEA10
//asm("LDR r1, =2");
//prepare proc_reset and periph_reset
//asm("LDR r2, =0xFFFFFD00");//AT91_RSTC_RCR = 0xFFFFFD00
//asm("LDR r3, =0xA5000005");
//perform power down command
//asm("STR r1, [r0]");
at91_sys_write(AT91_SDRAMC_LPR,AT91_SDRAMC_LPCB_POWER_DOWN); // oder AT91_SDRAMC_LPCB_DEEP_POWER_DOWN
//perform proc_reset and periph_reset (in the ARM pipeline)
//asm("STR r3, [r2]");
at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
}
static void at91sam9260_reset(void)
{
//at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
soft_user_reset();
}
like it is mentioned in the datasheets as a workaround.
1.) after a "kill 1" command in linux the system sometimes hangs on reboot at printing "Romstart"
2.) If i press the hardware reset button the system sometimes hangs on reboot at printing "Romstart"
Only a power off -> power on could force the board to reboot again.
What could I do - why doesn´t the workaround work ?
Thanks
Manuel Sahm