EEprom (internal) no erase @ download

klaus313

New Member
hi all,
currently I stuck with following issue:
I store calibration values in the intermal EEPROM (18M2).
now I want to update only the code not the EEPROM values in the CHIP.
I thought works with #no_data but uunfortunately at each download of the code the EEPROM is empty...
Is there a way top keep the eeprom data ?

Thanks for help

Klaus
 

BESQUEUT

Senior Member
I store calibration values in the intermal EEPROM (18M2).
now I want to update only the code not the EEPROM values in the CHIP.
I thought works with #no_data but unfortunately at each download of the code the EEPROM is empty...
#no_data is the way to do that.
Can you publish your code ?
How did you set data ?
How are you reading EEPROM ?
If using TABLE, look at the #no_table directive...
 

klaus313

New Member
#no_data is the way to do that.
Can you publish your code ?
How did you set data ?
How are you reading EEPROM ?
If using TABLE, look at the #no_table directive...
#picaxe 18m2
#no_data
setfreq m16

read @ program start


main:
; check init @ start
read 0,init_OK ; Sensor 1 : 0 = cal missing
...

Write procedure:

write_init:
if select_sens = 1 then
write 0,1 ; cal OK Sensor 1
let init_OK = 1;
endif
 

BESQUEUT

Senior Member
User manual page 7 :
#no_data
Do not download EEPROM data (only active on parts where program and data are separate).

User manual, page 261 :
With the PICAXE-08, 08M, 08M2, 14M, 18, 18M and 18M2 the data memory is shared with program memory.
 

hippy

Technical Support
Staff member
When I tested the issue it all worked for me; no EEPROM data is downloaded when the #NO_DATA directive is present. Including tests with a physical 18M2 chip. That seems to be the case for 18M2 ( Firmware 2.x ) and 18M2+ ( Firmware D.x ).

It could be that it just appears not to be working or there is some issue with the code which leads to it seeming to be that way.

The 18M2 does share data memory with code, but only when the code is particularly large, and the compiler will issue errors and refuse to Syntax Check or Download when trying to use EEPROM in such circumstances.
 

klaus313

New Member
User manual page 7 :
#no_data
Do not download EEPROM data (only active on parts where program and data are separate).

User manual, page 261 :
With the PICAXE-08, 08M, 08M2, 14M, 18, 18M and 18M2 the data memory is shared with program memory.
THANKS a lot, so it seems I have to use a different type ...
 

AllyCat

Senior Member
Hi,

I believe that the PE is clever enough to program the two "separate" areas of memory correctly.

But IMHO, the first fundamental question is "Does the programming download occur in one 'pass' or two"? AFAIK, if there is a second pass then the EEPROM (data) is being overwritten. If not, then I suspect there is an error in your program. We really need to see all the program, or at least all the relevant symbol declarations and the intervening instructions, etc., to see if there is a "silly" or a "gotcha" in the coding.

Cheers, Alan.
 

hippy

Technical Support
Staff member
THANKS a lot, so it seems I have to use a different type ...
No; please see post #5 which you may have missed as it was posted while you were probably typing your own reply. It should be entirely possible to use the 18M2 as you desire.
 

BESQUEUT

Senior Member
It should be entirely possible to use the 18M2 as you desire.
If so, user manual is wrong...
But the online doc is OK : #no_data
When I tested the issue it all worked for me; no EEPROM data is downloaded when the #NO_DATA directive is present. Including tests with a physical 18M2 chip. That seems to be the case for 18M2 ( Firmware 2.x ) and 18M2+ ( Firmware D.x )
As I had no physical Picaxe at hand, I tried simulation with no success...
Code:
[color=Navy]#picaxe [/color][color=Black]18m2[/color]
[color=Navy]#no_data[/color]
[color=Blue]setfreq m16

symbol [/color][color=Purple]init_OK[/color][color=DarkCyan]=[/color][color=Purple]b1[/color]
[color=Blue]symbol [/color][color=Purple]select_sens[/color][color=DarkCyan]=[/color][color=Purple]b2

select_sens[/color][color=DarkCyan]=[/color][color=Navy]1[/color]

[color=Green];read @ program start[/color]


[color=Black]main:[/color]
[color=Green]; check init @ start[/color]
[color=Blue]read [/color][color=Navy]0[/color][color=Black],[/color][color=Purple]init_OK [/color][color=Green]; Sensor 1 : 0 = cal missing[/color]
[color=Blue]sertxd ([/color][color=Red]"init_OK="[/color][color=Black], #[/color][color=Purple]init_OK[/color][color=Black],[/color][color=Navy]13[/color][color=Black],[/color][color=Navy]10[/color][color=Blue])[/color]
[color=Green]'...

'Write procedure:[/color]

[color=Black]write_init:[/color]
[color=Blue]if [/color][color=Purple]select_sens [/color][color=DarkCyan]= [/color][color=Navy]1 [/color][color=Blue]then
      write [/color][color=Navy]0[/color][color=Black],[/color][color=Navy]1 [/color][color=Green]; cal OK Sensor 1
      [/color][color=Blue]let [/color][color=Purple]init_OK [/color][color=DarkCyan]= [/color][color=Navy]1[/color][color=Green];[/color]
[color=Blue]endif[/color]
First time, init_OK=0 and the EEPROM panel show update at address 0.

But if I run the simulator for a second time, the #no_data directive is ignored...
and EEPROM start with a zéro...

We really need to see all the program, or at least all the relevant symbol declarations and the intervening instructions, etc., to see if there is a "silly" or a "gotcha" in the coding.
+1
This is a general consideration :
please, when you publish code, start by checking syntax with PE.
We are ready to help you, but we have no time to rewrite your code.
 
Last edited:

klaus313

New Member
@ all: sorry not providing the full code, but I have just expected some hints/tips from you not that you start debugging - but thanks in general for all of your engegement :)
The code is quite large ~ 2000 Byte ... so close to the limit
I will do the following:
1.) test the general behaviour with some basic code (less lines of code) if the habaviour is different @ hippy possibly pointed out
2.) I already ordered a 20M2 , which should be able to do what I want
 

hippy

Technical Support
Staff member
The code is quite large ~ 2000 Byte ... so close to the limit
On earlier 18M2 devices, I believe around 1800 bytes of code are stored in Flash, code above that is stored in EEPROM. When any code is placed in the EEPROM the entire EEPROM must be downloaded, and this may be what is happening here, the #NO_DATA being ignored because of that.

We would need to investigate further to give a more definitive response. It would help if you could post your code and also supply the firmware version of your 18M2. We would also recommend checking you have the latest version of the software installed and it would also be helpful if you can clarify exactly which software and version you are using.
 
Last edited:
Top