Writing to Flash

I am trying to write to the Flash on a Logic PD Development Kit using a Sharp LH79524 to write to a Sharp LH28F128SPHTD. I know the hardware is fine because I can program the flash using a debugger and code happily runs from it.

The flash uses the CFI interface and writing 0x98 to (Flash Base) + 0x55h correctly returns the 'Q' 'R' and 'Y' query string. Writing 0x60 and then

0xD0 is supposed to unlock the bank (there are two banks, controlled by the top address line) and a read of the status word after sending these claims that the banks were unlocked. I then wrote 0x20 and 0xD0 to the base of the flash to try and erase the first block and again the status returns that it was done, although the erase never actually happens.

Trying to write a word by writing 0x40 and the the data to the desired location intially appears to work (according to the status bit) but then fails after a number of locations have been done (up to 17 but often only

1). The writes never actually program any locations though and the failure status word reports that I've tried to write to a locked area.

Can anyone shed any light on what may be happening? I have remembered to set the Program Enable line, which was my first thought, but other than that the CFI should make this simple. Shouldn't it?

Reply to
Tom Lucas
Loading thread data ...

Having examine the Program Enable Line then I've found that it only pulses high for a short time (

Reply to
Tom Lucas

I should add, for completeness, that it is bit 1 of the register that I want to set to enable Program Enable.

Thanks for your patience - I'll get there yet!

Reply to
Tom Lucas

Program Enable stays on now. Should have casted to char instead of int - caused 3 extra bytes of 0's to be sent -turning off what I'd turnng on. Still hasn't allowed me to write, though.

Reply to
Tom Lucas

Are you trying to execute from the same FLASH bank? This would abort any writes or erases instantly.

high for

uint32*)0x4C800000)

caused 3

allowed

Reply to
Andrew M

No, at run-time the whole code in flash transfers itself to ram and the flash is not touched again. I've now got the write to work by monitoring the status signal coming from the device but reading the status word still fails to return when the state machine is finished.

Reply to
Tom Lucas

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.