Hello,
I want to ask about placing variables in EERPOM for HCS12 - DP512.
1. The EEPROM manual states that the EEPROM is organaized in 16bits rows. Does that mean that I can't wirte one byte to certain memory location in EEPORM. Hence, I have to use 16bit pointers?. (I tried locating one byte in EEPORM, but CW didn't take it. Actually it compiled it but never located in EEPROM. It gave it just random address 0x0000!!).
2. In CW, when I flashed a value to EEPROM variable (using some functions I wrote), I counldn't verify that by looking at the memory map in CW (debug) as it doesn't reflect the new value of the EEPROM variable. I had to send it out via SCI to actually verify that the EEPROM has been seccussfully flashed. Any reasons/explanation/comments?
Thanks,
Prog_ram..
Solved! Go to Solution.
Hello prog_ram,
did you really try to turn on the "Refresh memory when halting" option for the appropriate EEPROM item in the Debugging Memory Map window in the Debugger?
see e.g.
Stanish
Try looking at this thread for pointers on HCS12 EEPROM programming.
For viewing the EEPROM update, did you try Memory > Refresh in the Debugger?
---Tom
Hello Tom,
I don't have problems flashing data into the EEPROM. I am checking the word alignment and I am erasing a sector before wirting and all of that.. So far it seems to be working.
I couldn't be able to verify that the write function is working by checking the memory window in the debugger (I did the refresh, didn't show the udpate). I had to output the data via SCI to a terminal to verify that the variables in EEPROM have been updated..
It's just why the debugger doesn't show the udpate. If I am planning to flash unsigned int var[200] array into EEPROM, it's going to be defficult to output them all to a terminal to verify the successful flashing..
Here is my ee variables
#pragma DATA_SEG EE_DATA
unsigned int ee_variable;
unsigned int ee_variable1;
unsigned int ee_variable2;
unsigned int ee_variable3[2];
float f_ee_variable;
#pragma DATA_SEG DEFAULT
and :
/* EPROM */
EEPROM = NO_INIT 0x0400 TO 0x07FF;
Placement:
EE_DATA INTO EEPROM;
One more thing.. please have a look at these statements and tell me if they are correct:
"The minimum data size that can be flashed into the EEPROM is 16bit (Word)."
"Any word can't be flashed before erasing the sector in which it's located. For this reason, the wirte function has to locate the sector address and erase it as the word in it maybe sector-aligned or not."
"Flashing data that is less than 16bit (a byte) will require extra job. Such as reading the current word (in which the new byte is located), and then flashing the whole word back again. This is true also for 4byte data where the whole sector has to be read/erased/flashed (in case the 4bytes cover just one sector, if not then two sectors have to be read/erased/flashed)."
Thanks for your support..
Prog_ram..
prog_ram wrote:
"The minimum data size that can be flashed into the EEPROM is 16bit (Word)."
That's right.
"Any word can't be flashed before erasing the sector in which it's located. For this reason, the wirte function has to locate the sector address and erase it as the word in it maybe sector-aligned or not."
Yes, but minimum erase size is whole 4-bytes/2-words sector. Sectors are sector-aligned of course.
"Flashing data that is less than 16bit (a byte) will require extra job. Such as reading the current word (in which the new byte is located), and then flashing the whole word back again. This is true also for 4byte data where the whole sector has to be read/erased/flashed (in case the 4bytes cover just one sector, if not then two sectors have to be read/erased/flashed)."
Yes, you read sector, change required bytes, then write sector back.
BTW, if you have plenty of spare EEPROM space, then you can reduce some overhead sector-aligning all your eeprom data, like this
/* EPROM */
EEPROM = NO_INIT 0x0400 TO 0x07FF ALIGN 4;
Thanks Kef for the verfication..
Still one issue remains, which is the CW Debugger not showing the udpated data in EEPROM as explained above..
what do you think the reason?
Regards,
Prog_ram..
Hello prog_ram,
did you really try to turn on the "Refresh memory when halting" option for the appropriate EEPROM item in the Debugging Memory Map window in the Debugger?
see e.g.
Stanish
I tried it.. it's working!
thanks guys..
Hi everybody, i;ve tried to interfacing my MC9S12DG256MP with the internal EEPROM to write and read some important data. Unofortunately, i could not make that. I wanna know if somebody could help sending me a driver that already works
Thanks very much, my mail is mchavanne@gmail.com
Not a perfect solution for eeprom refresh trouble, but search box at bottom gave me this
So the way to update eeprom window is
1. enter flash in command window
flash
2, then enter another command
flash unselect
3. refresh memory window using context sensitive menu
Seems to work, though not very nice.