Forums

writing data to internal flash in single-chip mode

Started by Krzysztof Gruszka September 23, 2002
Hello,

I need to write some data (about 20 x UWord16, like user setup of SCI protocol)
into flash memory in DSP56F803 chip. My application is using single-chip mode
without external memory, in Motorola's Embedded SDK 2.5 as standard target
Flash.

I tried it:

#define N 8
UWord16 CalData[N];

....

FlashFD = open(BSP_DEVICE_NAME_FLASH_X,0,NULL);
write(FlashFD, CalData, N);
close(FlashFD);

but program goes into "unhandled interrupt" loop.

Thank you
Krzysztof Gruszka
--
.-- .''`. --.
| : :' : using |
| `. `' Debian GNU/Linux |
`-- `- ----www.debian.org----'


Attachment (not stored)
attachment
Type: application/pgp-signature


We had this same problem in our applications, it is caused by interrupts
occurring while you are writing to Data (X) Flash. You cannot access
any memory in a Flash Interface Unit (FIU) while any page in the FIU is
being erased or programmed. For example, you cannot read from one page
in Data Flash while another page in Data Flash is being erased or
programmed.

In our applications, we must be able to erase/program Data Flash while
the system is in normal operation. This means that all data has to be
either (a) moved from the Data Flash to the Program Flash, or (b) copied
(during initialization) from Data Flash to Data RAM or Program RAM.
Obviously, any data that is moved to Program Flash or copied to Program
RAM requires some source code changes as well.

To cut to the chase, the array configNestedIPRmask[] has to be moved to
Program Flash for our applications. This array is accessed every time
an interrupt occurs, so it cannot remain in Data Flash, because the
program would crash when we erased or programmed any page in the Data
Flash.

The result is that we had to change the Motorola SDK library files
"arch.c" and "dispatcher.asm", as well as the DSP OS library file
"os_dispatch.c". DSP OS is the realtime operating system (RTOS) we use
in all our applications. We also had to change the application's
"linker.cmd" file so the array configNestedIPRmask[] is placed into
Program Flash. Copies of these files are attached so you can see what's
involved.

In "arch.c", the functions archEnterNestedInterruptCommon() and
archExitNestedInterruptCommon() have been changed. In "dispatcher.asm",
the code changes are near the beginning of FastDispatcher. In
"os_dispatch.c", the code changes are near the beginning of
Os_Interrupt_Dispatcher(). In "linker.cmd", the "const.c (.data)"
section is put into a special memory section called ".pConstFlash", so
the array configNestedIPRmask[] is placed into Program Flash. This
"linker.cmd" file is for the '807 chip, which has a different memory map
than the '803 chip, but you can make similar changes in your
"linker.cmd" file.

I hope this helps.

Regards,

Art Johnson
Senior Systems Analyst
PMC Prime Mover Controls Inc.
3600 Gilmore Way
Burnaby, B.C., Canada
V5G 4R8
Phone: 604 433-4644
FAX: 604 433-5570
Email:
http://www.pmc-controls.com
-----Original Message-----
From: Krzysztof Gruszka [mailto:]
Sent: Monday, September 23, 2002 3:33 AM
To:
Subject: [motoroladsp] writing data to internal flash in single-chip
mode Hello,

I need to write some data (about 20 x UWord16, like user setup of SCI
protocol) into flash memory in DSP56F803 chip. My application is using
single-chip mode without external memory, in Motorola's Embedded SDK 2.5
as standard target Flash.

I tried it:

#define N 8
UWord16 CalData[N];

....

FlashFD = open(BSP_DEVICE_NAME_FLASH_X,0,NULL);
write(FlashFD, CalData, N);
close(FlashFD);

but program goes into "unhandled interrupt" loop.

Thank you
Krzysztof Gruszka
--
.-- .''`. --.
| : :' : using |
| `. `' Debian GNU/Linux |
`-- `- ----www.debian.org----'


Attachment (not stored)
p_intvec.zip
Type: application/x-zip-compressed