| Welcome to AT91SAM Community Forum http://www.at91.com/samphpbb/ |
|
| Prefetch abort & spurious interrupt http://www.at91.com/samphpbb/viewtopic.php?f=15&t=18262 |
Page 1 of 1 |
| Author: | pradeepit [ Wed Jun 24, 2009 8:03 am ] |
| Post subject: | Prefetch abort & spurious interrupt |
Hi all, I am working with AT91SAM7SE32 arm7tdmi core. I am frequently getting the prefetch abort and spurious interrupt problem. The description of the problem is as below. It would be great if you can give some suggestions over it too. 1) Prefetch Abort - I am getting it when working with flash writing and unlocking. (especially when executing the below code in function EFC_PerformCommand in EFC.c) pEfc->EFC_FCR = (0x5A << 24) | (argument << When I am step debugging this command, there is no problem in writing to flash, but when I give a breakpoint just after this, and give it a run, the execution will be stuck in prefetch abort vector. 2) Spurious Interrupt - When getting too many interrupts in IRQ0 and SPI as well. Basically, its repeating when multiple interrupts are interrupting at a very fast rate. Please suggest me if you have any ways to handle these 2 critical problems. Regards Pradeep |
|
| Author: | Ancaritha [ Wed Jun 24, 2009 3:24 pm ] |
| Post subject: | Re: Prefetch abort & spurious interrupt |
When you write to flash, are you executing that function out of ram or flash? If it's in flash, it's going to get hung up. As for the spurious interrupts, in the low level init file (sets up the processor clock speed, wait cycles for flash etc etc) there should be a part where it defines the default handlers for interrupts: Quote: AT91C_BASE_AIC->AIC_SVR[0] = (int) AT91F_Default_FIQ_handler ; for (i=1;i < 31; i++) { AT91C_BASE_AIC->AIC_SVR[i] = (int) AT91F_Default_IRQ_handler ; } add in this line to the end: Code: AT91C_BASE_AIC->AIC_SPU = (int) AT91F_Spurious_handler ; You then have to write a handler for the spurious interrupts: Code: void AT91F_Spurious_handler(void) { // Acknowledge the broken interrupt AT91F_AIC_AcknowledgeIt(AT91C_BASE_AIC); // Return nothing so we move on with life return; } That will catch all the spurious interrupts and stop them from mucking up your system. |
|
| Author: | pradeepit [ Thu Jun 25, 2009 7:36 am ] |
| Post subject: | Re: Prefetch abort & spurious interrupt |
Hi ancaritha, Thanks for the reply. 1) I am running the code from flash. That might be a problem, which I had not thought about. Is there any way to overcome this. Because I have a limited RAM size of 8K, where in I am not able to put the whole code in RAM and test. 2) I handled the spurious vector as you had shown. Its working fine. Thank you very much. Regards Pradeep |
|
| Author: | Ancaritha [ Thu Jun 25, 2009 8:31 pm ] |
| Post subject: | Re: Prefetch abort & spurious interrupt |
There is a way to define just specific functions in RAM, which is what I do. I got these instructions from Martin Thomas over at http://embdev.net/forum/arm-gcc, so all credit goes to him. Now let me just find what I had to change... I know it required a couple of changes in different places... Been a long time since I looked at this code OK, so here are the two functions that I have in RAM Code: RAMFUNC int AT91F_Flash_Status (unsigned int Mask) { unsigned int status; status = 0; //* Wait the end of command while ((status & Mask) != Mask ) { status = AT91C_BASE_MC->MC_FSR; } return status; } RAMFUNC void flushPage(U32 nPageAddr) { U32 nPage = nPageAddr >> 8; // Set number of Flash Waite sate // SAM7A3 features Single Cycle Access at Up to 30 MHz // if MCK = 47923200, 72 Cycles for 1.5 µseconde (field MC_FMR->FMCN) AT91C_BASE_MC->MC_FMR = ((AT91C_MC_FMCN) & (72 <<16)) | AT91C_MC_FWS_1FWS; // Write the write page command AT91C_BASE_MC->MC_FCR = AT91C_MC_CORRECT_KEY | AT91C_MC_FCMD_START_PROG | (AT91C_MC_PAGEN & (nPage << 8)); // OPTIONAL WRITE COMMAND--- THIS ONE WON'T ERASE MEMORY FIRST! //AT91C_BASE_MC->MC_FCR = AT91C_MC_CORRECT_KEY | AT91C_MC_FCMD_START_PROG | (AT91C_MC_PAGEN & (nPage << 8) | AT91C_MC_NEBP); // Wait the end of command AT91F_Flash_Status(AT91C_MC_EOP); } RAMFUNC is defined as: Code: #define RAMFUNC __attribute__ ((long_call, section (".fastrun"))) Now we get to modify the linker file! For me, that file is: AT91SAM7A3-ROM.ld Head down to where it creates the .data section, and add in .fastrun at the end of it: Code: /* .data section which is used for initialized data */ .data : AT (_etext) { _data = .; PROVIDE (__os_data_start = .); *(.osData) PROVIDE (__os_data_end = .); *(.data) *(.data.*) *(.gnu.linkonce.d*) SORT(CONSTRUCTORS) /* mt 4/2005 */ . = ALIGN(4); *(.fastrun) /* "RAM-Functions" */ /* added by mthomas */ } > RAM Your linker script likely will not have an .osData section, that's something else I added. It may or may not have the SORT(CONSTRUCTORS) either, as that is for getting C++ to work. I believe those are the only two changes you have to make. Hopefully it'll work for you! |
|
| Author: | mike1273 [ Wed Jul 21, 2010 11:00 am ] |
| Post subject: | Re: Prefetch abort & spurious interrupt |
Regarding the handler, does it need the __irq and __arm specifiers? (I am using the IAR toolset). Is there a way to test this handler in practice? Regards Quote: You then have to write a handler for the spurious interrupts:
Code: void AT91F_Spurious_handler(void) { // Acknowledge the broken interrupt AT91F_AIC_AcknowledgeIt(AT91C_BASE_AIC); // Return nothing so we move on with life return; } That will catch all the spurious interrupts and stop them from mucking up your system. |
|
| Author: | zeilhofer [ Tue Aug 31, 2010 4:53 pm ] |
| Post subject: | Re: Prefetch abort & spurious interrupt |
Hi, i have the same problem as pradeepit now. My program gets stuck after executing: pEfc->EFC_FCR = (0x5A << 24) | (argument << in efc.c, in the function EFC_PerformCommand(). I have checked, that the Function runs in the RAM. For testing purpose, i wrote a small testprogram, to ensure the functionalitiy of the FLASHD_xxx functions. There i worte a 256 Byte buffer successfully to the flash. But in my main-project the processor get stuck and halts in abort-mode after executing the write-command to EFC_FCR. What could be the source of the error? I also already tried to disable all Interrupts in the AIC, with no effect. kind regards PS: i'm using WinARM with the Atmel Library V1.5 |
|
| Author: | gerhardf [ Wed Sep 01, 2010 8:35 pm ] |
| Post subject: | Re: Prefetch abort & spurious interrupt |
zeilhofer wrote: Hi, i have the same problem as pradeepit now. My program gets stuck after executing: pEfc->EFC_FCR = (0x5A << 24) | (argument << in efc.c, in the function EFC_PerformCommand(). I have checked, that the Function runs in the RAM. For testing purpose, i wrote a small testprogram, to ensure the functionalitiy of the FLASHD_xxx functions. There i worte a 256 Byte buffer successfully to the flash. But in my main-project the processor get stuck and halts in abort-mode after executing the write-command to EFC_FCR. What could be the source of the error? I also already tried to disable all Interrupts in the AIC, with no effect. kind regards PS: i'm using WinARM with the Atmel Library V1.5 hello posting your code would make things easier. regards gerhard |
|
| Page 1 of 1 | All times are UTC + 1 hour [ DST ] |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|



Forum