I am playing with the EZPORT (on Coldfire M52210) and found a problem when trying to program data.
1) I can read the status register, set the write enable bit and then the configuration register. Also bulk erase is working using the sequence:
- set write enabled, set configuration, set write enable, command bulk erase, poll the status register until the write in progress bit has cleared
2) When doing a page write to address 0 (32 bit aligned) I always get a Write Error Flag and no data is written. The sequence is (starting out of reset):
- set write enabled, set configuration, set write enable, command page program with 3 address bytes (all 0) plus send some data bytes (256, but I also tried sending just 4 (the minimum amount))
- reading the status register then always shows that the Write Error Flag is set
According to the data sheet this would be because the sector is protected.
Since the Flash is completely erased it does seem logical that all Flash sectors are protected out of reset (since the CFM protection register is loaded with 0xffffffff from the flash configuration), but how can the Flash sectors be unprotected using ezport since it can't write to processor registers?
I checked in a freescale application note but didn't find any reference to such a problem so maybe it has nothing to do with the flash security after all (?)
Any ideas why the sequence, which has correct status register values up to the start of the page program command (0x22 - showing that the configuration has been programmed and the write enable has been set) should cause a write error to result? Note that the configuration setting is 0x50 (clocked from 48MHz should give 185kHz flash clock and bulk erase works OK with the setting).