[ECOS] flash erase - network stack

Andrew Lunn andrew@lunn.ch
Tue Nov 9 14:07:00 GMT 2004


On Tue, Nov 09, 2004 at 08:17:20AM -0500, Nicolas Brouard wrote:
> With Per Hebdlom's patch, my application doesn't work better. This patch
> does a cyg_drv_isr_lock/unlock around the six bus cycle operation to erase
> sector.

That patch is addressing a different problem. His patch fixes the
problem that the FLASH erase sequence is getting interupted while
performing the six bus cycles needed to start the erase. These cycles
need to be performed within a specified time. 

He is running all this code in RAM, so does not have to worry about
interupts after starting the erase when the flash is still
unaccessable. You however do need to worry about this and this is
causing your crash. 

> You problem is that I tried with cyg_drv_isr_lock at the beginning
> of flash_erase_block function and cyg_drv_isr_unlock at the end, and
> it works very well. Of course, I'll have a big delay when I ping my
> application.

> I'm reading the flash data sheet to be more precise in the position of
> cyg_drv_isr_lock/unlock functions.

When ever the flash cannot be read to access the normal context, you
need interrupts disabled. ie from the start of the erase until the
erase has completed. Also from the start of a program till it has
completed. Also from the start of reading the device id to the end of
this process.
 
> Is it a good way to use cyg_drv_isr_lock/unlock functions to disable
> interrupt during flash erase? Or must I use cyg_interrupt_disable?

Using the drv functions is the correct way to do
this. cyg_interrupt_disable is part of the kernel, so might not exist
in some eCos configurations. The driver functions always exist.

        Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list