-----Original Message-----
From: jeffrey.tenney@... [mailto:jeffrey.tenney@...]
Sent: Tuesday, September 16, 2003 12:58 PM
To: 68300@yahoogroups.com
Subject: RE: [68300] Disabling interrupts during Flash writing sessions
Marty,
Be sure your VBR points into RAM, meaning that your entire
interrupt-vector table is in RAM.
Also, be sure your ISRs are also in RAM and can execute from there. The
routines must be position independent or you must map the RAM to the
"correct" address for the routines.
Jeff
"Marty Burns" <burnsmarty@...>
09/15/2003 05:48 PM
Please respond to 68300
To: <68300@yahoogroups.com>
cc:
Subject: RE: [68300] Disabling interrupts during Flash writing sessions
After the enable command.
-----Original Message-----
From: jeffrey.tenney@... [mailto:jeffrey.tenney@...]
Sent: Monday, September 15, 2003 8:08 PM
To: 68300@yahoogroups.com
Subject: Re: [68300] Disabling interrupts during Flash writing sessions
Marty,
Do you get the mysterious fault immediately after the DISABLE command or
immediately after the ENABLE command?
Jeff
"Marty Burns" <burnsmarty@...>
09/14/2003 02:19 PM
Please respond to 68300
To: <68300@yahoogroups.com>
cc: "Martin J. Burns" <burnsmarty@...>
Subject: [68300] Disabling interrupts during Flash writing
sessions
I am debugging the flash writing routines for an embedded 68LC302
application. I seem to get some kind of bus fault? when I disable
interrupts
prior to invoking a flash erase followed by interrupt enable. I think the
communications engine is in the process of transmitting and it may have a
transmitter interrupt ready when I invoke the enable interrupts code.
Does anyone have a sense that I should be doing something additional in my
entry and leaving the flash routines. Note the flash routines are located
in
RAM. The rest of the code is in the FLASH. These routines involve
execution
from RAM since the FLASH is not valid during erase or write.
To disable interrupts:
#define DISABLE ASM(" ori.w #0x0700,%sr")
To enable interrups:
#define ENABLE ASM(" andi.w #0xf8ff,%sr")
To erase flash:
void FlashErase(int sector)
{
FLASH_PTR[0] = 0xF0F0; // reset device to read mode
DISABLE;
FLASH_PTR[0x555] = 0xAAAA; // unlock 1
FLASH_PTR[0x2AA] = 0x5555; // unlock 2
FLASH_PTR[0x555] = 0x8080;
FLASH_PTR[0x555] = 0xAAAA;
FLASH_PTR[0x2AA] = 0x5555;
FLASH_PTR[flashSectors[sector].offset/2] = 0x3030;
while(FlashStatus(FLASH_PTR)!=STATUS_READY)
TICKLE_WATCHDOG;
ENABLE;
}
int FlashStatus(volatile WORD *fp)
{
unsigned char d, t;
int retry = 1;
again:
d = *fp; /* read data */
t = d ^ *fp; /* read it again and see what toggled */
if (t == 0) { /* no toggles, nothing's
happening */
return STATUS_READY;
}
else if (t == 0x04) { /* erase-suspend */
if (retry--) goto again; /* may have
been write completion */
return STATUS_ERSUSP;
}
else if (t & 0x40) {
if (d & 0x20) { /* timeout */
return STATUS_TIMEOUT;
}
else {
return STATUS_BUSY;
}
}
if (retry--) goto again; /* may have been write
completion */
return STATUS_ERROR;
}
---------------------------------------------------
To unsubscribe from this group, send an email to:
68300-unsubscribe@yahoogroups.com
To learn more about Motorola Microcontrollers, please visit
http://www.motorola.com/mcu <http://www.motorola.com/mcu>
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ <http://docs.yahoo.com/info/terms/>
[Non-text portions of this message have been removed]
---------------------------------------------------
To unsubscribe from this group, send an email to:
68300-unsubscribe@yahoogroups.com
To learn more about Motorola Microcontrollers, please visit
http://www.motorola.com/mcu <http://www.motorola.com/mcu>
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ <http://docs.yahoo.com/info/terms/>
---------------------------------------------------
To unsubscribe from this group, send an email to:
68300-unsubscribe@yahoogroups.com
To learn more about Motorola Microcontrollers, please visit
http://www.motorola.com/mcu <http://www.motorola.com/mcu>
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ <http://docs.yahoo.com/info/terms/>
[Non-text portions of this message have been removed]
Yahoo! Groups Sponsor
ADVERTISEMENT
<http://rd.yahoo.com/M=251812.3856299.5103760.1261774/D=egroupweb/S=1706554205:HM/A=1754451/R=0/SIG=11tkldm5d/*http://www.netflix.com/Default?mqso=60178323&partid=3856299> click here
<http://us.adserver.yahoo.com/l?M=251812.3856299.5103760.1261774/D=egroupmail/S=:HM/A=1754451/rand=114580567>
---------------------------------------------------
To unsubscribe from this group, send an email to:
68300-unsubscribe@yahoogroups.com
To learn more about Motorola Microcontrollers, please visit
http://www.motorola.com/mcu <http://www.motorola.com/mcu>
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> .
[Non-text portions of this message have been removed]