hi, i'm trying to save some data on flash with a 9s12e64 freescale MCU, following instruction on application notes and examples i did the following steps
1)set FCLKDIV to have the flash clock in the right range
2)do an ordinary write,data does'nt matter, in the sector that i want erase
3)put an erase command($40) in the FCMD register
3)then clear CBEIF bit in FSTAT by LDAA #$80 followed by STAA FSTAT then i check the bit with a BITA instructtion ,then branching if the bit results still set
okthanks to you now something changes in flash , but i can't understand why when i erase the sector with 0x40 in FCMD and sending 80 to FSTAT i have the entire blocks 0x4000 to 0x8000 and
0xC000 to 0xFFFF filled with strange values: 10 and 4F,can you help me again
i do the erasing performing an ordinary write at 0x5200,or 0xC200,expecting that only the sector containing the address that i choose would be erased can you or someone help me again ,please?
ok,your hints helped me a lot,the last problem was due to a trivial reason,i deleted erroneously a row in my code so i did'nt program the FCLKDIV register (LDAA #$00101001 was not followed by STAA FCLKDIV),now it looks working
ok,thanks to you now my program looks being able to write data in the FLASH,i profit of your courtesy for other 2 questions:
I am using the 9s12E64 MCU having 64KB of memory; it looks that with 16bits i could address linearly the whole memory so ,why the need of the PPAGE block?Compatibility with 8 bit devices?
In my case i used the upper block(starting from $C000) for the code and i used the FLASH starting from $ 4000 for variables to be stored,hopin that i not did a bad choice. i read in the Application notes and examples that one has to erase the whole sector prior of writing a byte,and the sector should be 512 bytes wide; why it happens that 1024 bytes are erased?
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.