View previous topic :: View next topic |
Author |
Message |
gjs_rsdi
Joined: 06 Feb 2006 Posts: 468 Location: Bali
|
Programming verification error |
Posted: Mon Jan 20, 2020 7:36 pm |
|
|
Hi
I am using ICDU64 to program the PIC.
The microcontroller is PIC18F26K22.
CCS PCH C Compiler, Version 5.062.
In the past I was saving some data in the internal EEPROM while programming the chip as bellow:
Code: | #rom getenv("EEPROM_ADDRESS")={0}
#rom 0xF000F0 = { 0x02 }
#rom 0xF000F1 = { 0x02 }
#rom 0xF000F2 = { 0x02 }
#rom 0xF000F3 = { 0x02 }
#rom 0xF000F4 = { 0x02 }
#rom 0xF000F5 = { 0x02 }
#rom 0xF000F6 = { 0x02 }
#rom 0xF000F7 = { 0x02 }
|
I presume that I am saving the data in the locations F0 and up.
I changed the software to:
Code: | #rom getenv("EEPROM_ADDRESS")={0}
#rom 0xF00000 = { 0x02 }
#rom 0xF00001 = { 0x02 }
#rom 0xF00002 = { 0x02 }
#rom 0xF00003 = { 0x02 }
#rom 0xF00004 = { 0x02 }
#rom 0xF00005 = { 0x02 }
#rom 0xF00006 = { 0x02 }
#rom 0xF00007 = { 0x02 }
#rom 0xF00008 = { 0x02 }
#rom 0xF00009 = { 0x02 } |
I was thinking that now I will save the data from 00.
When trying to program the chip I am getting:
"Programming error of the data storage:
Address 0000; Actual 02; Expected 00;
Please be kind and explain me what I am doing wrong
Best wishes
Joe |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19520
|
|
Posted: Mon Jan 20, 2020 11:05 pm |
|
|
Problem is you are trying to write both 0, and 2 to the same address....
Your original format was a little dangerous. Better to load
the EEPROM_ADDRESS, and do all the writes _relative_ to this. So:
Code: |
#rom getenv("EEPROM_ADDRESS")={0}
#rom int8 getenv("EEPROM_ADDRESS")+0xF0 = { 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 }
|
Now you can use the same approach for your new version, just remember
the first line is writing 0 to the first byte of the EEPROM, so if you want to
store '2' here this will need to change.... |
|
|
gjs_rsdi
Joined: 06 Feb 2006 Posts: 468 Location: Bali
|
|
Posted: Tue Jan 21, 2020 12:29 am |
|
|
Thank you for your post Ttelmah
I understand what you wrote and will do as you advised.
Best wishes
Joe |
|
|
|