I have looked around quite a bit and I can't seem to figure out a definite answer to my question.
So the FTFL controller writes to flash in longword ie 32bit chunks, and FTFL writes in phrases ie 64 bit chunks. And when writing to a flash location once, you should erase the sector before writing again to the same location, because it can cause damage to the flash area.
If you write to the same location it will possibly cause a hardfault error when reading from that location (that is how I got to this whole question in the first place, by porting my bootloader from a FTFL device to a FTFE device).
My question is can you write just one byte to a sector (32bit or 64 bit depending on the controller) and if you don't write to it later before erasing. Or do you need to always write in 32/64bit chunks
So let's say we have a 64 bit chunk starting at 0x1000 and ending at 0x1008.
Do I have to start writing at 0x1000 location or can I start with let's say 0x1001?
Do I have to write 0x10FFFFFFFFFFFFFF starting at 0x1000 with length of 8 bytes, or can I write 0x10 starting at 0x1000 with length of 1 byte?
Hello Lovro Oreskovic:
For the FTFE case the programming operations must always point to a 64-bit aligned address and always provide the whole 8 bytes, disregarding if you don use them all. If you look at the Program Phrase parameters in the Reference Manual it may help you:
So the command expects 8 bytes to be written at a 64-bit aligned address. You can decide to program as many bytes as you want from those 8 bytes (1 in your case), but the next time you want to update the same phrase then an erase must be launched first.
I hope this clarifies.