Go to Post Backwards PWMs happen to the best of us. - Woolly [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 03-09-2002, 11:51 PM
ChrisA's Avatar
ChrisA ChrisA is offline
Registered User
#0857 (Superior Roboworks)
Team Role: College Student
 
Join Date: Feb 2002
Location: Michigan Tech
Posts: 157
ChrisA is on a distinguished road
Send a message via AIM to ChrisA
Question bad scratchpad ram locations

after finding that our piece of code that we had implemented was giving off some really really weird values (0,3,2,1,0,3,2,1,...etc) our programming team (well 2/3 of it... one person was sleeping most of the time ) spent a few hours of debugging to find, that we had some errors in the code that we didnt know about before, but more importantly we had some bad scratchpad ram locations in last years rc (3 total so far i think).

has anyone else had any problems with this?
  #2   Spotlight this post!  
Unread 03-10-2002, 04:01 AM
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
Have you identified what scratchpad addresses are bad?

Quote:
Originally posted by ChrisA
but more importantly we had some bad scratchpad ram locations in last years rc (3 total so far i think).

has anyone else had any problems with this?
I vaguely remember seeing something on the Parallax BASIC Stamp discussion list about someone having problems with some bad memory locations in either the scratchpad RAM or in EEPROM. If I remember right, it was related to a particular rev mod of the BASIC Stamp2.
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me

Last edited by Greg Ross : 03-10-2002 at 04:04 AM.
  #3   Spotlight this post!  
Unread 03-10-2002, 07:32 PM
ChrisA's Avatar
ChrisA ChrisA is offline
Registered User
#0857 (Superior Roboworks)
Team Role: College Student
 
Join Date: Feb 2002
Location: Michigan Tech
Posts: 157
ChrisA is on a distinguished road
Send a message via AIM to ChrisA
now we're really stumped...

after writing a code to test each of the scratchpad ram locations we found that none of them seem to be bad... but if we use them in our coding they give us strange and also inconsistent values
if we switch from these bad sectors to what we have deemed as good locations the code works just fine and the values are what they should be.

the bad locations when used in our robots code will always give data in a patern such as the one that i posted earlier (0,3,2,1,0,3,2,1...etc) and have no relation to any data given to the locations by any piece of our code
__________________
Programmer
----------------
Team#857
Superior Roboworks

WildStang Alum
  #4   Spotlight this post!  
Unread 03-10-2002, 09:06 PM
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
i've heard of scratchpad ram, but i don't know what it is. i probably should, seeing as i'm 1/2 the programming team. anyone care to explain?
__________________
AIM --> Woloi
Email --> ian@woloschin.com
  #5   Spotlight this post!  
Unread 03-10-2002, 09:52 PM
ChrisA's Avatar
ChrisA ChrisA is offline
Registered User
#0857 (Superior Roboworks)
Team Role: College Student
 
Join Date: Feb 2002
Location: Michigan Tech
Posts: 157
ChrisA is on a distinguished road
Send a message via AIM to ChrisA
ooh i wish keith were here...

ill try my best here and maybe someone can help me out

ram (standing for random access memory) is a memory that you read and write numbers to. it is erased every time you disconnect power for about 10-15 secs (or however long it takes power to discharge from the circuit). when you download code into the robot it is stored into whats known as eeprom which is a type of memory that doesnt get changed until someone goes in and changes it (ie downloading new code). the scratchpad ram is what is used when you are trying to save a temporary value that will be changed at different points in the code (aka a variable). you have 62 scratchpad ram locations total in each bank.

to sum this all up...
scratchpad ram is the physical memory area inside the robot controller where all your variable values are stored.

hope that helps

(dont feel sad for not knowing... i dont know a lot of things and im about 1/3 of my programming team) (well maybe 1/4... keith is probably 1/2 of our team )

Last edited by ChrisA : 03-10-2002 at 09:54 PM.
  #6   Spotlight this post!  
Unread 03-11-2002, 01:38 PM
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
Unhappy Sounds like it must be a programming error.

Quote:
Originally posted by ChrisA
after writing a code to test each of the scratchpad ram locations we found that none of them seem to be bad... but if we use them in our coding they give us strange and also inconsistent values
if we switch from these bad sectors to what we have deemed as good locations the code works just fine and the values are what they should be.

the bad locations when used in our robots code will always give data in a patern such as the one that i posted earlier (0,3,2,1,0,3,2,1...etc) and have no relation to any data given to the locations by any piece of our code
I'm not sure what to make of your "pattern". Maybe you can post your code (or a snippet.)

My best guess is that you're saying that your program writes data to a scratchpad ram location, and when you read it back, the value is say a 0 (even though the value you had written was non-zero.) The next time you read it, the value is 3, and the next time it's 2 and so forth. Does this describe your situation at all? (Or are you storing data in a sequence of cells, and when you read them back, these are the values you're seeing in those cells?)

Some questions:
  • Are you writing data every time between reads?
  • Are you using scratchpad RAM in other places in your program? Is it possible you are overwriting your data elsewhere?

Some things to keep in mind:
  • You can only write BYTE data to scratchpad RAM. If you try to write a WORD value, it will get truncated to a byte. (I'm guessing that it's the high order byte that gets lopped off.)
  • Calculations are carried out internally to 16 bit precision. If you're writing the result of a calculation to scratchpad RAM, and the result is bigger than 8 bits, it will be truncated.
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me

Last edited by Greg Ross : 03-11-2002 at 02:02 PM.
  #7   Spotlight this post!  
Unread 03-11-2002, 01:56 PM
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
Maybe this is your problem

Quote:
Originally posted by ChrisA
you have 62 scratchpad ram locations total in each bank.

to sum this all up...
scratchpad ram is the physical memory area inside the robot controller where all your variable values are stored.
A couple of problems here:
  • There are only 64 scratchpad RAM bytes (not 62) for the entire BASIC Stamp. Scratchpad RAM is shared by the programs in all EEPROM banks. (A very important point to keep in mind!)
  • Scratchpad RAM is separate from the variable space. (You have 26 bytes of variable space available PLUS the 64 bytes of scratchpad RAM. Both are shared by all program banks.)

Also a couple more details you left out of your description:
  • Scratchpad RAM data is accessed with the GET and PUT commands.
  • Before you can use data you have previously PUT into into scratchpad RAM, you have to GET it into a normal variable (one of your 26 bytes.)
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me

Last edited by Greg Ross : 03-11-2002 at 02:04 PM.
  #8   Spotlight this post!  
Unread 03-12-2002, 12:17 AM
ChrisA's Avatar
ChrisA ChrisA is offline
Registered User
#0857 (Superior Roboworks)
Team Role: College Student
 
Join Date: Feb 2002
Location: Michigan Tech
Posts: 157
ChrisA is on a distinguished road
Send a message via AIM to ChrisA
oops i meant to put 64... ooh well
also forgot about the part that there is only one set of scratchpad ram which is what you have to use to share values with the other banks

anyways i would go with you on that programming error (which is what we thought it was at first) but when we took that var and changed its location (no there werent 2 vars using the same location, we did check that) it worked exactly how it was supposed to. weve had this happen at least 3 times and it definitly is the locations because weve tried different vars in a couple of those locations. like i said we spent like a couple hours debugging the code to find that that was the problem. id post a piece of code to show you that its fine but i dont have the code at my home computer.

the pattern as i remember it is always a pattern of numbers that sequentially run (0,3,2,1,0,3,2,1...) i think we had a pattern like 35,38,37,36...also but they dont really seem to relate to any values that we give it. (this is just one memory location which we are writing a value to then reading the value and finding it not to be the value we put there) an example, we were setting all of our drive wheels to the same value in the code...
(we changed it to look something like this for debuggin purposes)
PUT s_lf_wheel, 127
PUT s_rf_wheel, 127
PUT s_lb_wheel, 127
PUT s_rb_wheel, 127
upon reseting, after having downloading the new code to the rc, we found that the value for one of the wheels was running 0,3,2,1... while all the others (which had the same values) were stopped (at 127 as they should have been)

this whole thing has spooked us and we really dont know what to make of it. all we do know is that we cant use those locations otherwise well get some really really weird values.

maybe this will make some sense out of the issue for you (if you can understand what ive written here)

note: all scratchpad ram locations relating to pwms are set to 127 upon reset by a piece of our code
__________________
Programmer
----------------
Team#857
Superior Roboworks

WildStang Alum

Last edited by ChrisA : 03-12-2002 at 12:22 AM.
  #9   Spotlight this post!  
Unread 03-12-2002, 01:37 PM
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
Quote:
Originally posted by ChrisA
...id post a piece of code to show you that its fine but i dont have the code at my home computer....
I'd still like to take a peek at the code when you get a chance. If you could extract a small piece of code that shows the failure, that would be ideal.


Quote:
Originally posted by gwross

I vaguely remember seeing something on the Parallax BASIC Stamp discussion list about someone having problems with some bad memory locations in either the scratchpad RAM or in EEPROM. If I remember right, it was related to a particular rev mod of the BASIC Stamp2.
I checked the BASIC Stamps mailing list archives to refresh my memory, and I see it is a problem with the BASIC Stamp 2P. (We have the BASIC Stamp 2SX.)

On the 2P, they have 126 bytes of scratchpad RAM, and the capability of accessing any of the EEPROM slots from a program running in any other slot. The 2P STORE command determines which EEPROM slot the READ and WRITE commands access.

The problem on the 2P is with the STORE command. It corrupts scratchpad locations 110 and 111 whenever it executes. The reporter stated that the STORE command always sets location 110 to 59 and 111 to 0.

So that's not your problem.


Quote:
Originally posted by ChrisA
an example, we were setting all of our drive wheels to the same value in the code...
(we changed it to look something like this for debuggin purposes)
PUT s_lf_wheel, 127
PUT s_rf_wheel, 127
PUT s_lb_wheel, 127
PUT s_rb_wheel, 127
upon reseting, after having downloading the new code to the rc, we found that the value for one of the wheels was running 0,3,2,1... while all the others (which had the same values) were stopped (at 127 as they should have been)
So are you saying that you can execute a PUT to one of these bad locations, immediately do a GET, and the value has changed? Or do you have to go through the control loop before it gets changed?

How are s_lf_wheel, s_rf_wheel, s_lb_wheel and s_rb_wheel defined? They should be constants. If they are variables, could they be being corrupted?
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Scratchpad RAM Access Time Ian W. Programming 1 02-13-2003 12:31 AM
Bad, bad, bad!!! archiver 2000 13 06-23-2002 10:29 PM
BS-2sx RAM access times archiver 2000 2 06-23-2002 10:10 PM


All times are GMT -5. The time now is 11:49 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi