"Andrew M" <noone@home> wrote in message
news:442c303e$0$21269$5a62ac22@per-qv1-newsreader-01.iinet.net.au...
> Are you trying to execute from the same FLASH bank? This would abort any
> writes or erases instantly.
>
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.
> "Tom Lucas" <news@REMOVEautoTOflameREPLY.clara.co.uk> wrote in message
> news:1143537810.16959.0@doris.uk.clara.net...
>> "Tom Lucas" <news@REMOVEautoTOflameREPLY.clara.co.uk> wrote in message
>> news:1143535957.16174.0@doris.uk.clara.net...
>>
>>> Having examine the Program Enable Line then I've found that it only
>>> pulses high for a short time (<1us) and then goes low again. It is
>>> controlled by writing to a CPLD register and I've used the command
>>> FLASH_REG |= 0x01; to do it, where FLASH_REG is *((volatile
>>> uint32*)0x4C800000)
>>
>> 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 by Andrew M●March 30, 20062006-03-30
Are you trying to execute from the same FLASH bank? This would abort any writes or
erases instantly.
"Tom Lucas" <news@REMOVEautoTOflameREPLY.clara.co.uk> wrote in message
news:1143537810.16959.0@doris.uk.clara.net...
> "Tom Lucas" <news@REMOVEautoTOflameREPLY.clara.co.uk> wrote in message
> news:1143535957.16174.0@doris.uk.clara.net...
>
>> Having examine the Program Enable Line then I've found that it only pulses high for
>> a short time (<1us) and then goes low again. It is controlled by writing to a CPLD
>> register and I've used the command
>> FLASH_REG |= 0x01; to do it, where FLASH_REG is *((volatile uint32*)0x4C800000)
>
> 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 by Tom Lucas●March 28, 20062006-03-28
"Tom Lucas" <news@REMOVEautoTOflameREPLY.clara.co.uk> wrote in message
news:1143535957.16174.0@doris.uk.clara.net...
> Having examine the Program Enable Line then I've found that it only pulses
> high for a short time (<1us) and then goes low again. It is controlled by
> writing to a CPLD register and I've used the command
> FLASH_REG |= 0x01; to do it, where FLASH_REG is *((volatile
> uint32*)0x4C800000)
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 by Tom Lucas●March 28, 20062006-03-28
"Tom Lucas" <news@REMOVEautoTOflameREPLY.clara.co.uk> wrote in message
news:1143535957.16174.0@doris.uk.clara.net...
<snip>
> Having examine the Program Enable Line then I've found that it only pulses
> high for a short time (<1us) and then goes low again. It is controlled by
> writing to a CPLD register and I've used the command
> FLASH_REG |= 0x01; to do it, where FLASH_REG is *((volatile
> uint32*)0x4C800000)
> with the magic number being the address of the register. I think that is a
> sensible way of doing it and the volatile type should stop the compiler
> optimising the write out - or maybe I've doen something dumb?
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 by Tom Lucas●March 28, 20062006-03-28
"Tom Lucas" <news@REMOVEautoTOflameREPLY.clara.co.uk> wrote in message
news:1143535621.15897.0@doris.uk.clara.net...
<snip>
> 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?
Having examine the Program Enable Line then I've found that it only pulses
high for a short time (<1us) and then goes low again. It is controlled by
writing to a CPLD register and I've used the command
FLASH_REG |= 0x01; to do it, where FLASH_REG is *((volatile
uint32*)0x4C800000)
with the magic number being the address of the register. I think that is a
sensible way of doing it and the volatile type should stop the compiler
optimising the write out - or maybe I've doen something dumb?
Reply by Tom Lucas●March 28, 20062006-03-28
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?