Need help understanding writing to upper 32K on eeprom
Don M
Posts: 1,653
I have programmed Kye's I2C Rom Demo. It allows you to read and write bytes, words & longs in the eeprom.
As I understand it the propeller uses the lower 32K of an AT512 eeprom during programming and bootup etc. So I am reading and writing to a location well above the 7FFF limit - 9000. I can write to the location, read the data that I wrote to the location, press reset on the board and even power down the board and power back and read the location ok. But if I reload the program the data is now gone from that location. Using Propeller Tool V1.3.
I thought that it wasn't supposed to touch anything above 7FFF?
As I understand it the propeller uses the lower 32K of an AT512 eeprom during programming and bootup etc. So I am reading and writing to a location well above the 7FFF limit - 9000. I can write to the location, read the data that I wrote to the location, press reset on the board and even power down the board and power back and read the location ok. But if I reload the program the data is now gone from that location. Using Propeller Tool V1.3.
I thought that it wasn't supposed to touch anything above 7FFF?
Comments
Mike- If that was the case wouldn't a dump of the memory at 8000 show the same contents as 0000? Everything above 8000 is all 0's unless I store something there. It stays until reprogrammed by the Prop Tool.
EEPROM[$9000] = 16
To display the contents of a location:
PRINT EEPROM[$9000]
The address can be any expression, so you could write a short loop to set all the bytes in an area to the same value or a calculated value
or you could write a loop that displays several locations in a row.
DUMP [$9000],16
-Phil
-Phil
That doesn't make any sense. You can't load to ROM. The Propeller's bootloader, when it's copying RAM to EEPROM, stops at $8000 after copying $7FC0-$7FFF, so it's incapable of affecting the upper 32K of an EEPROM. The bootloader's source code is available, so you can look at it and verify this.
But you're right, I do need to figure out what the heck is going on, because it shouldn't be doing that.
As in the demo... "getl 32768" gets the first four bytes of the upper eeprom.
[You could have looked at the code and saved your self alot of time... the functions to read and write have alot of verbose function calls to "decimalToInteger" and "integerToDecimal"] - Guess its my fault for not being clearer.
Thanks,
In the version that Don M posted, a number of routines use "result &=" in calling lower level routines. Since result is initialized to zero, this will never return the error result from the lower level routines since zero & anything always == zero. Also, in the lower level routines, it looks like the high order bit of the 16 bit address is not shifted properly before being masked off, so it's effectively ignored. That could explain why it looks like the upper 32K of the EEPROM is being erased.
The only complaint I get from this driver it that it expects a pull up resistor on the CLK and DAT lines (Per I2C spec). Never had a problem with anything else in it.
My code is more clever than that Mike. Look again...
I'm sorry. I mis-read your code. It does take more effort than I initially put in to really figure it out ( ... self-flagellation ... grovelling ... ah ooooh )
Nope, no sanity check; it just assumes it's there. If it's not there, it loads zeros. I first thought it was a 12blocks thing, so I tried everything using bst, with the same effect. I also thought that the program might like to have the memory storage object loaded a little later; so I moved the "init" code as late as possible. Again no success. The other issue I'm having is that the board no longer boots up from the eeprom from a cold start. It used to - before I added in the memory management code. And it still does; if I load a program that contains no memory management code. Memory storage starts at 8020, BTW.
The only thought I've got at this point is that I called some of my local variables the same thing as some of the storage locations in the upper 32k - perhaps they are interfering with each other somehow? I made them the same to make the code easier to understand. But enough of hijacking someone else's thread with my own - I'll start a new thread if I can't figure this out on my own.