Content originally posted in LPCWare by pcproa on Thu Sep 27 17:59:00 MST 2012
Hey Rolf,
On your first response to my Original Post, you questioned the use of the buffer that I added. When I responded to that I started thinking about it as well. I immediately removed the line to turn on the buffer and started playing with the rest of the code. I removed every section of code and started doing each step one by one.
With the buffer off, I found that the Datasheet recommended Erase time of 128 seconds had to completely pass after I sent the command to Erase. If I tried to write to the chip before the Erase time transpired, it would Toggle Bit on the first write till the Flash completed the previous action. Once the action is complete, it would write everything correctly.
The CMSIS Example didn't have enough of a delay after the Erase command and I was wrong to assume it would work correctly with just a few changes to the EMC latencies. What made it worse is that after data had been written to an address on the NOR Flash, a second attempt to write the same address would allow it to run into the same long ToggleBit loop giving the impression that it is still faulty. I know you can't write to Flash twice unless you Erase and re-write, but I've never experienced a nearly infinite delay if you try to write over an address that was already written.
Early on, I became fixated on what made it seemingly work, that I didn't realize enabling the buffer action was actually a step in the wrong direction. Thank you very much for all the help, it now works flawlessly and reliably.
To follow up with the last thing you mentioned about the commands of 2AA/555 vs. 2AAA/5555, that was one of the first things I looked at a few days ago. I found that the SST39VF3201 Datasheet also says the commands are 2AA/555 and I didn't understand why the CMSIS examples had the extra repeat nibble of the nibble right before it. However, I did try both command formats and they both produced the same results on this chip. In other words, in this case, 2AA/555 seems to be the same as 2AAA/5555
Again, than you very much for the help Rolf. You managed to wipe out 3 days of frustration.
Best Regards,
Patrick