BootI2C Slot?

rjandsam

Member
A quick question, when you use boot i2c to update slot0 does the command have to run from slot0?

I have updated for a long time now slots 1,2,3 no problem with the booti2c updates zone running in slot3 but i have just tried to update slot0 the same way and it fails.

I programed a blank chip to only go to its update screen in slot0 and ran the updates as slot3,slot2,slot1,slot0 and all was well but once the chip is programmed with booti2c running from slot3 it fails when programming slot0.

any ideas would be welcome.

Thanks

Rich
 

rjandsam

Member
Hi Westaust55, yes the information in that thread is useful and works but when I try to run this code from slot3 and want to update slot0 from EEPROM it fails to transfer all of the code for some reason.

Code:
[color=Blue]if [/color][color=Purple]Data_CMD1[/color][color=DarkCyan]=[/color][color=Navy]$51 [/color][color=Blue]then let [/color][color=Purple]Data_CMD2[/color][color=DarkCyan]=[/color][color=Red]"1" [/color][color=Blue]gosub [/color][color=Black]flashing[/color]
[color=Blue]else if [/color][color=Purple]Data_CMD1[/color][color=DarkCyan]=[/color][color=Navy]$52 [/color][color=Blue]then let [/color][color=Purple]Data_CMD2[/color][color=DarkCyan]=[/color][color=Red]"2" [/color][color=Blue]gosub [/color][color=Black]flashing[/color]
[color=Blue]else if [/color][color=Purple]Data_CMD1[/color][color=DarkCyan]=[/color][color=Navy]$53 [/color][color=Blue]then let [/color][color=Purple]Data_CMD2[/color][color=DarkCyan]=[/color][color=Red]"3" [/color][color=Blue]gosub [/color][color=Black]flashing [/color]
[color=Blue]else if [/color][color=Purple]Data_CMD1[/color][color=DarkCyan]=[/color][color=Navy]$54 [/color][color=Blue]then let [/color][color=Purple]Data_CMD2[/color][color=DarkCyan]=[/color][color=Red]"4" [/color][color=Blue]gosub [/color][color=Black]flashing[/color]
[color=Blue]endif
goto [/color][color=Black]updatex:

Flashing:[/color]
[color=Blue]SerOut LCD_data_out[/color][color=Black],[/color][color=Blue]t38400_64[/color][color=Black],[/color][color=Blue]([/color][color=Red]"t12.txt="[/color][color=Black],[/color][color=Navy]$22[/color][color=Black],[/color][color=Red]"Flashing C"[/color][color=Black],[/color][color=Purple]Data_CMD2[/color][color=Black],[/color][color=Navy]$22[/color][color=Blue])gosub [/color][color=Black]terminate[/color]
[color=Blue]SerOut LCD_data_out[/color][color=Black],[/color][color=Blue]t38400_64[/color][color=Black],[/color][color=Blue]([/color][color=Red]"t0.txt="[/color][color=Black],[/color][color=Navy]$22[/color][color=Black],[/color][color=Red]"Please Wait"[/color][color=Black],[/color][color=Navy]$22[/color][color=Blue])gosub [/color][color=Black]terminate[/color]
[color=Blue]pause [/color][color=Navy]15000[/color]

[color=Blue]pokesfr [/color][color=Navy]$0E[/color][color=Black], [/color][color=Navy]1[/color]
[color=Blue]hi2csetup OFF
pause [/color][color=Navy]50[/color]

[color=Blue]if [/color][color=Purple]Data_CMD2[/color][color=DarkCyan]=[/color][color=Red]"1" [/color][color=Blue]then BootI2c [/color][color=Navy]4     [/color][color=Green]'update from eeprom to 0[/color]
[color=Blue]elseif [/color][color=Purple]Data_CMD2[/color][color=DarkCyan]=[/color][color=Red]"2" [/color][color=Blue]then BootI2c [/color][color=Navy]5  [/color][color=Green]'update from eeprom to 1[/color]
[color=Blue]elseif [/color][color=Purple]Data_CMD2[/color][color=DarkCyan]=[/color][color=Red]"3" [/color][color=Blue]then BootI2c [/color][color=Navy]6  [/color][color=Green]'update from eeprom to 2[/color]
[color=Blue]elseif [/color][color=Purple]Data_CMD2[/color][color=DarkCyan]=[/color][color=Red]"4" [/color][color=Blue]then BootI2c [/color][color=Navy]7  [/color][color=Green]'update from eeprom to 3[/color]
[color=Blue]endif
reset[/color]
 

westaust55

Moderator
when I try to run this code from slot3 and want to update slot0 from EEPROM it fails to transfer all of the code for some reason.
The data transfer commands appear to be correct.

How do you ascertain that some but not all of the code is being transferred ? :confused:

Do you set a new and increasing revision to the code in the EEPROM slot each time you undertake an EEPROM to PICAXE program transfer?
As per the manual and on-line information:
The booti2c command is only processed if the program revision number (set by the #revision directive during download) in the 24LC128 memory slot is greater than the revision number currently in the internal program slot. This means that the program copying will only occur once after a new 24LC128 is fitted.
Guessing that since at post 1 you indicate that you have had no problems transferring to slots 1,2 and 3 that you are aware of that requirement, but lets be sure.

This otherwise may need some input from hippy or Technical.

If I may make some further comment with respect to your code (not going to fix the problem but makes it easier for those helping to follow/read).
If you are going to have multiple commands on one line, please separate them with a colon.
So for example the lines:
Code:
if Data_CMD1=$51 then let Data_CMD2="1" gosub flashing
else if Data_CMD1=$52 then let Data_CMD2="2" gosub flashing
become:
Code:
if Data_CMD1=$51 then [B][COLOR="#FF0000"]:[/COLOR][/B] let Data_CMD2="1" [B][COLOR="#FF0000"]:[/COLOR][/B] gosub flashing
else if Data_CMD1=$52 then [B][COLOR="#FF0000"]:[/COLOR][/B] let Data_CMD2="2" [B][COLOR="#FF0000"]:[/COLOR][/B] gosub flashing
currently your code "survives"/works by virtue of the fact that while a colon is the designated newline character, the PE does make endeavours to determine when a space also should be taken as a newline chracter but occasionally this may fail.
 

rjandsam

Member
Hi Westaust55,
Thanks for the tips, the problem however still occurs but if I run the same upgrade technique from slot0 it works fine. I can jumble around all of my code so that the update side only runs from slot0 but was just wondering why.
Also the revision does not need changing as I'm using Hippys poke sfr get around.

"How do you ascertain that some but not all of the code is being transferred ?"
I Have a Debug serial out that spits out the revision number of software on boot up this still occurs but the program does not run, as such I can only assume corruption or only a partial update?


Rich
 

Technical

Technical Support
Staff member
We'll look into it, there may be an issue/workaround, it is an unusual situation as it was only really envisaged that booti2c for slot 0 would be used from within slot 0.
 
Top