Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

How to clear flash memory - I'm stuck!

Hitec robotics including ROBONOVA humanoid, HSR-8498HB servos, MR C-3024 Controllers and RoboBasic
9 postsPage 1 of 1
9 postsPage 1 of 1

How to clear flash memory - I'm stuck!

Post by ozfiddler » Mon Dec 06, 2010 12:50 am

Post by ozfiddler
Mon Dec 06, 2010 12:50 am

OK, I've done something stupid (not surprisingly). I mistakenly loaded a new program that had a subroutine right at the top - so when it starts up I assume it goes into a frantic loop and won't talk to me at all. So now I can't even get a connection established to reload the old program code. Unfortunately I'm using the 2.72 firmware and so the evil program is loaded into the flash memory. I can revert to the 2.5 firmware and load a new program and Robo runs OK like that, but as soon as I upgrade to 2.72 the program that is presumably still stored in flash takes over and it loses the ability to establish a serial connection.

Can anyone tell me how to clear the program out of flash memory?? Please!!!
OK, I've done something stupid (not surprisingly). I mistakenly loaded a new program that had a subroutine right at the top - so when it starts up I assume it goes into a frantic loop and won't talk to me at all. So now I can't even get a connection established to reload the old program code. Unfortunately I'm using the 2.72 firmware and so the evil program is loaded into the flash memory. I can revert to the 2.5 firmware and load a new program and Robo runs OK like that, but as soon as I upgrade to 2.72 the program that is presumably still stored in flash takes over and it loses the ability to establish a serial connection.

Can anyone tell me how to clear the program out of flash memory?? Please!!!
ozfiddler
Savvy Roboteer
Savvy Roboteer
Posts: 93
Joined: Tue Oct 26, 2010 1:01 am

Post by i-Bot » Mon Dec 06, 2010 11:05 am

Post by i-Bot
Mon Dec 06, 2010 11:05 am

I don't have aprogram to clear the region of flash to store robobasic code, but it should be easy to make one. We can crate a small loadable asm firmware to do that. It may take me a while to find all the files though !

Alternatively, it may be enough just to set a "START: GOTO START" into the flash. Or maybe better to fix 2.72 ?

I don't quite understand the failure, since the robobasic code is interpreted out of flash and not executed directly. Could you post the code that caused the problem, so I can understand why it might upset the interpreter.
I don't have aprogram to clear the region of flash to store robobasic code, but it should be easy to make one. We can crate a small loadable asm firmware to do that. It may take me a while to find all the files though !

Alternatively, it may be enough just to set a "START: GOTO START" into the flash. Or maybe better to fix 2.72 ?

I don't quite understand the failure, since the robobasic code is interpreted out of flash and not executed directly. Could you post the code that caused the problem, so I can understand why it might upset the interpreter.
i-Bot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by ozfiddler » Mon Dec 06, 2010 11:34 am

Post by ozfiddler
Mon Dec 06, 2010 11:34 am

Hi i-Bot - great to hear from you! This is the code (I was modifying the program produced by VRbot).

Code: Select all
'================================================
'
' VRbot Template
'
'================================================

' VRbot definitions and routines

GOSUB led_off

CONST RES_ERROR = 255
CONST RES_TIMEOUT = 254
CONST RES_WAITING = 253
CONST RES_BUILTIN = 32

CONST SDA = 46 'Use port 46 for Data, constant SDA
CONST SCL = 47 'Use port 47 for Clock, constant SCL

DIM I2cBuf AS BYTE
DIM I2cAddr AS BYTE
DIM I2cReg AS BYTE
DIM I2cData AS BYTE
DIM I2cBit AS BYTE
DIM I2cTx AS BYTE
DIM I2cRx AS BYTE

' VRA = protocol command/status byte
' VRA1 = first in/out argument
DIM VRA AS BYTE, VRA1 AS BYTE

' VRLED = led status
'DIM VRLED AS BYTE
'VRLED = 1 'off

led_on:
OUT 52,0
RETURN

led_off:
OUT 52,1
RETURN

' main program begins at Startup label
GOTO Startup

CONST CMD_BREAK       = &H62   ' abort recog or ping
CONST CMD_SLEEP       = &H73   ' go to power down
CONST CMD_KNOB       = &H6B   ' set si knob <1>
CONST CMD_LEVEL       = &H76   ' set sd level <1>

etc etc


I meant to move the led_on and led_off down to the bottom but forgot. Now when I start it up it just gives a pathetic squawk and sits there. It's fine if I go back to 2.5 (I can load up new programs and run them) but as soon as I try 2.72 or your revised firmware it just won't communicate at all.

Would be very grateful for any help.
Hi i-Bot - great to hear from you! This is the code (I was modifying the program produced by VRbot).

Code: Select all
'================================================
'
' VRbot Template
'
'================================================

' VRbot definitions and routines

GOSUB led_off

CONST RES_ERROR = 255
CONST RES_TIMEOUT = 254
CONST RES_WAITING = 253
CONST RES_BUILTIN = 32

CONST SDA = 46 'Use port 46 for Data, constant SDA
CONST SCL = 47 'Use port 47 for Clock, constant SCL

DIM I2cBuf AS BYTE
DIM I2cAddr AS BYTE
DIM I2cReg AS BYTE
DIM I2cData AS BYTE
DIM I2cBit AS BYTE
DIM I2cTx AS BYTE
DIM I2cRx AS BYTE

' VRA = protocol command/status byte
' VRA1 = first in/out argument
DIM VRA AS BYTE, VRA1 AS BYTE

' VRLED = led status
'DIM VRLED AS BYTE
'VRLED = 1 'off

led_on:
OUT 52,0
RETURN

led_off:
OUT 52,1
RETURN

' main program begins at Startup label
GOTO Startup

CONST CMD_BREAK       = &H62   ' abort recog or ping
CONST CMD_SLEEP       = &H73   ' go to power down
CONST CMD_KNOB       = &H6B   ' set si knob <1>
CONST CMD_LEVEL       = &H76   ' set sd level <1>

etc etc


I meant to move the led_on and led_off down to the bottom but forgot. Now when I start it up it just gives a pathetic squawk and sits there. It's fine if I go back to 2.5 (I can load up new programs and run them) but as soon as I try 2.72 or your revised firmware it just won't communicate at all.

Would be very grateful for any help.
ozfiddler
Savvy Roboteer
Savvy Roboteer
Posts: 93
Joined: Tue Oct 26, 2010 1:01 am

Post by i-Bot » Mon Dec 06, 2010 1:02 pm

Post by i-Bot
Mon Dec 06, 2010 1:02 pm

OK, I will take a look,

I cut the code down to this:
Code: Select all
'================================================
'
' VRbot Template
'
'================================================

' VRbot definitions and routines

GOSUB led_off

CONST RES_ERROR = 255
CONST RES_TIMEOUT = 254
CONST RES_WAITING = 253
CONST RES_BUILTIN = 32

CONST SDA = 46 'Use port 46 for Data, constant SDA
CONST SCL = 47 'Use port 47 for Clock, constant SCL

DIM I2cBuf AS BYTE
DIM I2cAddr AS BYTE
DIM I2cReg AS BYTE
DIM I2cData AS BYTE
DIM I2cBit AS BYTE
DIM I2cTx AS BYTE
DIM I2cRx AS BYTE

' VRA = protocol command/status byte
' VRA1 = first in/out argument
DIM VRA AS BYTE, VRA1 AS BYTE

' VRLED = led status
'DIM VRLED AS BYTE
'VRLED = 1 'off

led_on:
OUT 52,0
RETURN

led_off:
OUT 52,1
RETURN

' main program begins at Startup label
Startup:
GOTO Startup


Which compiles to this in bytecode:
Code: Select all
0x10 GOSUB [ 0x18]
0x13 OUT 52, 0
0x17 RET
0x18 OUT 52, 1
0x1C RET
0x1D GOTO [ 0x1D]
0x20 GOTO [ 0x20]


I am guessing the problem is the RETURN without the GOSUB getting an odd stack value.

I will look to either setting the flash, or maybe just a temporary version of 2.72 with the interpreter disabled to allow the download to work.
OK, I will take a look,

I cut the code down to this:
Code: Select all
'================================================
'
' VRbot Template
'
'================================================

' VRbot definitions and routines

GOSUB led_off

CONST RES_ERROR = 255
CONST RES_TIMEOUT = 254
CONST RES_WAITING = 253
CONST RES_BUILTIN = 32

CONST SDA = 46 'Use port 46 for Data, constant SDA
CONST SCL = 47 'Use port 47 for Clock, constant SCL

DIM I2cBuf AS BYTE
DIM I2cAddr AS BYTE
DIM I2cReg AS BYTE
DIM I2cData AS BYTE
DIM I2cBit AS BYTE
DIM I2cTx AS BYTE
DIM I2cRx AS BYTE

' VRA = protocol command/status byte
' VRA1 = first in/out argument
DIM VRA AS BYTE, VRA1 AS BYTE

' VRLED = led status
'DIM VRLED AS BYTE
'VRLED = 1 'off

led_on:
OUT 52,0
RETURN

led_off:
OUT 52,1
RETURN

' main program begins at Startup label
Startup:
GOTO Startup


Which compiles to this in bytecode:
Code: Select all
0x10 GOSUB [ 0x18]
0x13 OUT 52, 0
0x17 RET
0x18 OUT 52, 1
0x1C RET
0x1D GOTO [ 0x1D]
0x20 GOTO [ 0x20]


I am guessing the problem is the RETURN without the GOSUB getting an odd stack value.

I will look to either setting the flash, or maybe just a temporary version of 2.72 with the interpreter disabled to allow the download to work.
i-Bot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by i-Bot » Mon Dec 06, 2010 5:58 pm

Post by i-Bot
Mon Dec 06, 2010 5:58 pm

The quickest was to make a build of 2.72 with the interpreter disabled. This does not run the errant code, but the download etc should still work, so you can download some good code to flash.

It is in the hex file in this zip:
http://robosavvy.com/Builders/i-Bot/c3024ozz.zip
just download with roboflash, send some good robobasic code to flash, then load the proper 2.72.

This was a quick and dirty to avoid too much work and testing. If this does not work, then we need to look in more detail.
The quickest was to make a build of 2.72 with the interpreter disabled. This does not run the errant code, but the download etc should still work, so you can download some good code to flash.

It is in the hex file in this zip:
http://robosavvy.com/Builders/i-Bot/c3024ozz.zip
just download with roboflash, send some good robobasic code to flash, then load the proper 2.72.

This was a quick and dirty to avoid too much work and testing. If this does not work, then we need to look in more detail.
i-Bot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by ozfiddler » Mon Dec 06, 2010 7:31 pm

Post by ozfiddler
Mon Dec 06, 2010 7:31 pm

Brilliant! Just Brilliant!! Thank you so much for this. It worked and I now have it all back to normal. I definitely owe you a beer or three.

I'll keep that special file safely stored away in case of future stuff-ups. Cheers mate.
Brilliant! Just Brilliant!! Thank you so much for this. It worked and I now have it all back to normal. I definitely owe you a beer or three.

I'll keep that special file safely stored away in case of future stuff-ups. Cheers mate.
ozfiddler
Savvy Roboteer
Savvy Roboteer
Posts: 93
Joined: Tue Oct 26, 2010 1:01 am

Re: How to clear flash memory - I'm stuck!

Post by Magicace » Fri Dec 26, 2014 10:28 pm

Post by Magicace
Fri Dec 26, 2014 10:28 pm

Hi All
Im Stuck in a loop.

every time I switch on RN1 it starts doing the goalkeeper movement and I cant
download anything else to clear it . I get communication error from robotbasic 2.5 & 2.7
I using a serial to usb connection an all has been fine.
Ive not done any firmware update. robo flash says robonova port is closed, so cant do a flash either.
any help please.
Hi All
Im Stuck in a loop.

every time I switch on RN1 it starts doing the goalkeeper movement and I cant
download anything else to clear it . I get communication error from robotbasic 2.5 & 2.7
I using a serial to usb connection an all has been fine.
Ive not done any firmware update. robo flash says robonova port is closed, so cant do a flash either.
any help please.
Magicace
Newbie
Newbie
Posts: 3
Joined: Fri Dec 26, 2014 10:19 pm

Re: How to clear flash memory - I'm stuck!

Post by PaulL » Sun Jan 04, 2015 11:51 pm

Post by PaulL
Sun Jan 04, 2015 11:51 pm

Is what you're experiencing similar to this?

http://robosavvy.com/forum/viewtopic.php?f=4&t=14120
Is what you're experiencing similar to this?

http://robosavvy.com/forum/viewtopic.php?f=4&t=14120
PaulL
Savvy Roboteer
Savvy Roboteer
Posts: 423
Joined: Sat Sep 15, 2007 12:52 am

Re: How to clear flash memory - I'm stuck!

Post by Magicace » Thu Jan 08, 2015 1:40 am

Post by Magicace
Thu Jan 08, 2015 1:40 am

PaulL wrote:Is what you're experiencing similar to this?

http://robosavvy.com/forum/viewtopic.php?f=4&t=14120




Thanks for reply ...Problem SOLVED bad serial socket connection on the Mr-3024
re solder should sort the problem.
PaulL wrote:Is what you're experiencing similar to this?

http://robosavvy.com/forum/viewtopic.php?f=4&t=14120




Thanks for reply ...Problem SOLVED bad serial socket connection on the Mr-3024
re solder should sort the problem.
Magicace
Newbie
Newbie
Posts: 3
Joined: Fri Dec 26, 2014 10:19 pm


9 postsPage 1 of 1
9 postsPage 1 of 1