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.