Flash Read and Write for MCF5485

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Flash Read and Write for MCF5485

1,589件の閲覧回数
preetuabraham
Contributor III

Hi,

I have a MCF5485 processor running project which has timer interrupts. So while reading and writing into external  flash using fucntions,I have some problems since the SW gets stuck and .Whether I have to disable the interrupt while reading and writing into flash

0 件の賞賛
返信
3 返答(返信)

1,208件の閲覧回数
TomE
Specialist II

What sort of "External Flash"? That covers a very wide range.

It could be parallel Flash on the external Address and Data Bus (Flexbus). It could be I2C or SPI Flash. It could even be NAND Flash (unlikely on this CPU). It could even be a Memory Stick on a USB bus. Or an SD Card. Or a Solid State Drive on a PCI bus.

You should give us more details so we can understand what you're doing.

What sort of Flash technology? The new stuff is "self timed", but some of the older stuff needed the CPU to guarantee timing. It is unlikely you're using anything that old, but you might.

The Read cycles shouldn't give trouble if they're interrupted. The Write cycles might, if they're timing critical.

What are the specifications for reading and writing through whatever interface you're using? Could interrupts stretching the timing cause a problem? Is the Flash Writing code using an external timer (to see if the write completes) and that timer is falsely triggering when the code is interrupted? The code can be fixed to check for that condition if you know what can happen.

Does the "Timer Interrupt" perform any operations that could interfere with the Flash Writing? Does any of the interrupt code (or any of the functions it calls) try to READ the Flash for instance?

Where is the MCF5485 running its code from? If it is running from the external Flash when you're trying to program it it causes all sorts of complications. Or is it running code from the SDRAM?

Tom

0 件の賞賛
返信

1,208件の閲覧回数
preetuabraham
Contributor III

Hi Tom,

The External flash used is IN28F256K3 Intel StrataFlash® Synchronous Memory(K3/K18).So the interrupt used is Slice timer 1 and Slice timer 0 for Watchdog. So after programming the operational code using PROGCFZ Flash programmer from PE Micro while Write_to_flash gets called in the process,the SW gets stuck ,so while I Debugged, I found that once it enters erase flash functions or write into flash functions if the interrupt is not disabled then it would not continue further and gets stuck.When I disabled ,write to flash function/eare to flash function would work fine. This is the linker lcf file I used

KEEP_SECTION {.vectortable}

 

MEMORY

{

boot (RWX) : ORIGIN = 0x00000000 , LENGTH = 0x00200000

text (RWX) : ORIGIN = 0x02001000 , LENGTH = 0x02000000

vector_ram (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00000400 /* Vector table */

data (RWX) : ORIGIN = AFTER(text), LENGTH = 0

bss (RWX) : ORIGIN = AFTER(data), LENGTH = 0

}

SECTIONS

{

# Heap and Stack sizes definition

___heap_size = 0x100;

___stack_size = 0x100;

.vector_ram : {} > vector_ram

___MBAR = 0x10000000;

__MBAR = ___MBAR ;

___SDRAM = 0x02000000 ;

___SDRAM_SIZE = (8 * 1024 * 1024);

# ___SDRAM_SIZE = (16 * 1024 * 1024);

___SYS_SRAM = ___MBAR + 0x00010000;

___SYS_SRAM_SIZE = (32 * 1024) ;

___MCDAPI_START = ___SYS_SRAM;

___MCDAPI_SIZE = (12 * 1024);

___CORE_SRAM0 = 0x20000000 ;

___CORE_SRAM0_SIZE = (4 * 1024) ;

__CORE_SRAM0 = ___CORE_SRAM0;

___CORE_SRAM1 = 0x20001000 ;

___CORE_SRAM1_SIZE = (4 * 1024) ;

__CORE_SRAM1 = ___CORE_SRAM1 ;

__CORE_SRAM1_SIZE = ___CORE_SRAM1_SIZE;

___CODE_FLASH = 0x00000000 ;

___CODE_FLASH_SIZE = (32 * 1024 * 1024);

___FLASH = ___CODE_FLASH ;

___BOOT_FLASH = 0x00000000 ;

___BOOT_FLASH_SIZE = (2 * 1024 * 1024);

# ___VECTOR_RAM = ___SDRAM;

___VECTOR_RAM = ADDR(.vector_ram);

# ___SP_AFTER_RESET = ___CORE_SRAM1 + ___CORE_SRAM1_SIZE - 4;

.boot :

{

. = ALIGN(0x4);

_BOOT_BEGIN = .;

_VECTOR_BEGIN = .;

vectors_s.obj(.text)

_VECTOR_END = .;

mcf548x_lo_s.obj(.text)

mcf5xxx_s.obj(.text)

sysinit_c.obj(.text)

. = ALIGN(0x4);

_BOOT_END = .;

} > boot

_VECTOR_SIZE = _VECTOR_END - _VECTOR_BEGIN;

.text : AT(0x00010000)

{

. = ALIGN(0x4);

_TEXT_BEGIN = . ;

#vectors_s.obj(.text)

*(.text)

*(.rodata)

. = ALIGN(0x4);

___DATA_ROM = . ;

_TEXT_END = . ;

} > text

_TEXT_PHYSICAL = 0x00010000;

_TEXT_VIRTUAL = _TEXT_BEGIN;

_TEXT_SIZE = _TEXT_END - _TEXT_BEGIN;

.data : AT(0x00010000 + SIZEOF(.text))

{

. = ALIGN(0x4);

___DATA_RAM = . ;

*(.data)

*(.sdata)

*(.relocate_code)

*(.relocate_const)

*(.relocate_data)

. = ALIGN(0x4);

___DATA_END = . ;

} > data

_DATA_PHYSICAL = 0x00010000 + SIZEOF(text);

_DATA_VIRTUAL = ___DATA_RAM;

_DATA_SIZE = ___DATA_END - ___DATA_RAM;

.bss :

{

. = ALIGN(0x4);

___BSS_START = . ;

*(.sbss)

*(SCOMMON)

*(.bss)

*(COMMON)

. = ALIGN(0x4);

___BSS_END = . ;

} > bss

 

___HEAP_START = .;

___HEAP_END = ___HEAP_START + (512*1024);

___SP_END = ___HEAP_END;

___SP_INIT = ___SP_END + (4*1024);

__SP_INIT = ___SP_INIT;

}

0 件の賞賛
返信

1,208件の閲覧回数
TomE
Specialist II

The "28F256K3 Intel StrataFlash" is ancient (2003 or earlier), but is self-timed.

Your original question contained:

> So while reading and writing into external  flash using fucntions

That implies your device is running a program stand-alone and calling functions to program the Flash.


That's not what you're doing at all. You're running PROGCFZ on a PC connected via USB to a Debug Pod connected to the BDM interface of the CPU. That program on the PC downloads "Programmer" software into (I would guess) the Static RAM of the CPU and runs it to program the external Flash. That software should be the only thing running, and should have "total control" of the CPU, but it seems you're running it in a way where there is other code and other interrupts still firing on the CPU. That can be expected to interfere with what PROGCFZ is trying to do, and you've found it does.


It is likely that the program PROGCFZ loads into the Static RAM has a small stack, and that the interrupt routines you're using are trashing that stack. Or they're doing something else to the CPU that is wrong for what the programmer is trying to do. I asked you what the interrupt routines did.

> This is the linker lcf file I used

That tells me nothing useful at all. If there's something important you think I should be looking for in that file then you should tell me what that is.

> Whether I have to disable the interrupt while reading and writing into flash

Is that meant to be a question?

> When I disabled ,write to flash function/eare to flash function would work fine.

So you don't have a problem any more. You had a problem with your setup and found a fix.

Now that we know that, thanks for letting the rest of us know.

Tom