Shop OBEX P1 Docs P2 Docs Learn Events
BS2pe Data Storage — Parallax Forums

BS2pe Data Storage

NewzedNewzed Posts: 2,503
edited 2007-01-12 15:31 in BASIC Stamp
I have the Propeller receiving temperature data from a remote Stamp.· The Propeller then sends this data to a BS2pe for data storage in Bank 8, which is supposed to be 2047 bytes.· I just had the Propeller read back the data stored in the BS2pe.· The Prop VGA displays the data stored at addresses 0 to 234 in 9 byte increments.· 234 x 9 = 2106 bytes, which is 59 bytes more than the stated capacity of Bank 8.· I continued storing data.· At address 252 - 2268 bytes - the data was still good.· The next entry rolled over and garbled the data at address 0.· Can anyone explain the discrepancy between the apparent 2268 bytes stored and the stated size of Bank 8.

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com
·

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-01-11 15:20
    Sid,

    Actually the bank is 2048 bytes (address 0 – 2047). I don’t see how you could store data to addresses which don’t exist. My guess is if you calculate the wrapping point you will find that data above 2047 matches data at the beginning of the EEPROM up to where your data went wrong.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • NewzedNewzed Posts: 2,503
    edited 2007-01-11 15:57
    Chris, here is a screen shot of the last few data entries before it apparently rolls over.· Note that the temp, time and date are all current and correct.· I just don't understand it.

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Don't have VGA?

    Newzed@aol.com
    525 x 308 - 15K
  • NewzedNewzed Posts: 2,503
    edited 2007-01-11 15:58
    Correction - that wasn't a screen shoot - it was a photo.

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Don't have VGA?

    Newzed@aol.com
    ·
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-01-11 17:03
    Sid,

    Have you compared the readings that exceed 2047 with the ones starting at 0 after the logging was completed? Also, are you storing 9 bytes per event?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • NewzedNewzed Posts: 2,503
    edited 2007-01-11 17:28
    Yes, each event is 9 bytes.· There are actually 8 bytes of data but the pointer increments by 9 each time.· I'm going to set Bank 8 to all 0's and start over.· I'll take a picture of the first four or five entries and the last four or five and send you a copy of them.· It will be a couple of days.

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Don't have VGA?

    Newzed@aol.com
    ·
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-01-11 17:43
    Sid,

    If there are 8 bytes of data, why do you increment by 9? If you increment by 8 each event will be logged on an even boundary giving you exactly 256 events within that 2K block of EEPROM. There is a trick posted by Tracy Allen which allows you to seamlessly write to contiguous slots during logging in case you use more than 2K.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • NewzedNewzed Posts: 2,503
    edited 2007-01-11 17:54
    Chris, when I originally wrote the program, IK thought I might want to enter the location of the temp data - O(utside), I(nside) or S(hop).· That is why the 9 bytes.· I never used the location but I left the extra byte in the address in case I changed my mind.

    I have no problem jumping from Bank 8 to Bank 9 - I just haven't had a need to do that yet.

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Don't have VGA?

    Newzed@aol.com
    ·
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-01-11 18:06
    Sid,

    I would recommend going to 8-byte blocks…Unless your application is unique and you’re logging data from multiple sources at the same time you could just tag the block once and waste one section (first packet/8 bytes) with the location. Also, I don’t know what data you’re logging, but if you are sampling at a fixed interval, it is not necessary to store date/time information for every sample.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2007-01-11 18:32
    Hi Sid,

    That is quite puzzling. Either you have the Midas touch with the BS2pe memory banks, or there is some subtle point you have overlooked in how your data is being stored and read out. Post code, the write and read rouitine at least, if you'd like us to take a look at it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • NewzedNewzed Posts: 2,503
    edited 2007-01-11 19:15
    Hi, Tracy.· I was hoping you would pop in.

    Here is the write and read rotuines for the data:

    datastore:
    DEBUG "Writing to EEPROM", cr
    SERIN si, baud, [noparse][[/noparse]DEC3 dat]
    DEBUG DEC ? dat,cr
    GOSUB getclk
    STORE 15
    READ 0, word addr
    DEBUG DEC ? addr, cr
    STORE 8
    WRITE· addr, word dat
    WRITE addr + 2, hrs,mins,secs
    WRITE addr + 5, month,date,year
    addr = addr + 9
    STORE 15
    WRITE 0, addr
    GOTO start

    readeep:
    DEBUG "reading EEPROM", cr
    SEROUT so, baud, 30, [noparse][[/noparse]"··················· Shop Temperature Log",13,13]
    addr = 0
    readeep1:
    STORE 8
    READ addr, word dat, hrs, mins, secs,month,date,year
    IF dat = 0 OR dat >1000 THEN
    SEROUT so, baud, [noparse][[/noparse]10]
    GOTO start
    ENDIF
    IF addr<10 THEN
    L = 10
    ENDIF
    IF addr>9 THEN
    L = 9
    ENDIF
    IF addr>99 THEN
    L = 8
    ENDIF

    SEROUT so, baud, 20,[noparse][[/noparse]"··· ",DEC addr, REP 32\L,DEC dat/10,".",DEC1 dat, "····· ", HEX2 hrs, ":",HEX2 mins,
    ":",HEX2 secs, "····· ",HEX2 month,"/",HEX2 date,"/", "20",HEX2 year,13]
    addr = addr + 9
    DEBUG DEC ? addr, cr
    GOTO readeep


    The value of L has nothing to do with the data - this is a value sent to the Propeller for formatting the VGA display.· Has to do with columnar spacing.

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Don't have VGA?

    Newzed@aol.com
    ·
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2007-01-11 22:08
    Hi Sid,

    When you write the address back to bank 15, you are writing a byte. It should be a word.

    There is an RTC? Why not store the address in battery backed RAM instead of banging location zero in bank 15?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • NewzedNewzed Posts: 2,503
    edited 2007-01-11 22:53
    Good catch, Tracy.· Overlooked the fact it should be a word.· I'll correct it and start over.

    The RTC is a piggyback DS1302 running from the Stamp Vdd.· It was just easier to store the address in Bank 15 than it was to store it in the clock RAM.

    Sid



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Don't have VGA?

    Newzed@aol.com
    ·
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-01-11 23:20
    Sid,

    An easy example of how to write to the DS1302 RAM and read from it is listed in the Demo Code in the Projects Forum. It’s really only a couple of lines and would save wearing out the EEPROM location from repeated writes. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • NewzedNewzed Posts: 2,503
    edited 2007-01-11 23:50
    Chris, wouldn't the "wearing out" process also apply to the clock RAM?

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Don't have VGA?

    Newzed@aol.com
    ·
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-01-11 23:55
    Sid,

    No, SRAM doesn’t really have a write cycle life…It’s downfall is it is volatile. But, on the DS1302 you can back it with the same battery that backs the clock, so it offsets it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-01-12 14:15
    Because the "clock ram" is true static RAM (battery-backed in the case of the RTC chip). You can write to that any number of times.

    The 'eeprom' storage you're accessing on the BS2p is eeprom. Each location can only be written to a million times or so. For program storage, that's not a problem. If you're updating it every second, it will wear out.
  • NewzedNewzed Posts: 2,503
    edited 2007-01-12 14:35
    I am writing to EEPROM maybe 10 times a day.· With 1,000,000 rewrites that would last me about 270 years, so I really am not too concerned.

    Thanks anyway.

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Don't have VGA?

    Newzed@aol.com
    ·
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-01-12 15:31
    Excellent, I'm glad you did that analysis. That issue sometimes gets past people, who don't even realize it could be an issue.
Sign In or Register to comment.