PDA

View Full Version : STRINGS routines replacement corrupted flash?


sengle
03-24-07, 09:51 PM
Been working on learning about the ServoPod-USB (IsoMax V0.82), combined with initial coding of a robotics application. I needed the ability to manipulate character strings, the "STRINGS routines replacement" code looked perfect <http://www.newmicros.com/isopod/appnotes/STRINGS.TXT>. I downloaded it, spent a lot of time reading through it (and New Micro's documentation) to see how this code worked. Got a good understanding except the code associated with the the PARSE>P, EEALLOT, and EE words. After SCRUBing, I downloaded the code to the ServoPod-USB. Experimentation from the console indicated code was working great. I powered down the ServoPod, and the powered it back up, expecting the code to still be present (EEWORDs in code to load to Flash ROM). But no, the STRING words were not in the dictionary. Further reading showed that some information about the words I defined are kept in RAM. One must save the RAM data to be restored on reset using the word SAVE-RAM. So I SCRUBed and downloaded again, did a quick check that the new words were present, and then did a SAVE-RAM. I then powered down and powered back up.

Some, but not all, of the newly defined words (such as STRING) were not working!

" This is test" TYPE This is test OK
" This is test" OK
TYPE This is test OK
40 STRING A$
STRING ?
S!
S! ? STACK EMPTY

A dump of the dictionary showed corruption!

WORDS
----- COMMON -----
592F S= 5922 SUB 58FE S+
58F0 RIGHT$ 58DD LEFT$ 58C5 MID$
58BA LEN 58A2 S! 5898 MLEN
5888 STR$ 5878 VAL 5847 "
86DD š‘ďŢ=Ö:LtuŁ#^Q`Żl#—X’}%,Řđ; FF5 ##ö 1. p÷ń»#
7DA1 „ „˘„¤„„„¨„Ş„¬„®„ě„#„´„¶„¸„ş„<367C ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙
3F58 C-IN 3F57 ANALOGIN 3F53 SCIS
[snip]

The new words SRCH, STRING, IB (a buffer), EEALLOT, and EE have been clobbered. I powered down the board, repowered, and enter SCRUB. SCRUB is not recognized! Listing the via WORDS lists nothing! But I do get the interpreter back. Power down, power up. Enter WORDS again and the board freezes. Reset, try WORDS again, it freezes. Reset, enter any word, it freezes. And that is where I am now.

What did I goof up? Is there a problem with the strings code? Have I corrupted IsoMax? Do I have to reflash IsoMax? I will be ordering a JTAG cable to reflash. Where do I locate the IsoMax V0.82 binary to download to the processor?

Thanks!

Steve Engle
Garland, TX

nmitech
03-25-07, 07:23 AM
Try this to restore IsoMax,
- Put a jumper (or short out) pin 2(GND) & 4(SCLK/PE4) of J3
- Press reset button
- Enter SCRUB
- Remove jumper
- Enter WORDS . If words are listing, IsoMax is restored

sengle
03-25-07, 12:39 PM
nmitech, thanks for the feedback. Ok, the jumper routine got me back in so I could SCRUB. I had noted this procedure for bypassing autostart, should have applied to this as well.

After the SCRUB, I downloaded a fresh version of the "STRINGS routines replacement" code, just to make sure I had not messed up the original while reviewing it, and downloaded to the ServoPod-USB. Immediately after I did WORDS and got the expected (not corrupted) listing.

WORDS
----- COMMON -----
592F S= 5922 SUB 58FE S+ 58F0 RIGHT$
58DD LEFT$ 58C5 MID$ 58BA LEN 58A2 S!
5898 MLEN 5888 STR$ 5878 VAL 5847 "
F02B EE, F021 EEALLOT F00A PARSE>P 5841 IB
5820 STRING 5809 SRCH 329F TASK 4028 LOOPINDEX
4024 LOOPINDEXES 3FD6 QUADS 3FD2 QUAD1 3FCE QUAD0
[snip]

I did a SAVE-RAM and a reset and got the same listing. I powered down and powered up and it hangs on WORDS (or anything else). So obviously something important is not being saved in flash, and thus going away on power cycle.

Comparing the ServoPod memory map to the addresses listed above, the following words are in the User Program Flash (correct).

592F S=
5922 SUB
58FE S+
58F0 RIGHT$
58DD LEFT$
58C5 MID$
58BA LEN
58A2 S!
5898 MLEN
5888 STR$
5878 VAL
5847 "
5841 IB
5820 STRING
5809 SRCH

However, these below are in User program RAM, and thus not saved on power cycle. This is the problem.

F02B EE,
F021 EEALLOT
F00A PARSE>P

Looking at the code I noted these words are not trailed by an EEWORD. I added EEWORD to each, SCRUBed, reloaded, and then viewed the resulting WORD output. They are all now in User Program Flash. After a SAVE-RAM I powered down and powered up, did a WORD, and it worked. I am currently exercising the "STRINGS routines replacement" routines, everything appears nominal.

Why does the “ (double quote) word use an IMMEDIATE EEWORD, vs. just an EEWORD? Reviewing documentation, all I could find was that IMMEDIATE has to become before EEWORD, not after. What is does I don't know.

Steve