Shop OBEX P1 Docs P2 Docs Learn Events
Memory Stick Datalogger: warning & question — Parallax Forums

Memory Stick Datalogger: warning & question

xanatosxanatos Posts: 1,120
edited 2013-10-02 13:25 in General Discussion
Memory Stick Datalogger users: Beware the PNY 8 GB memory stick that is in the picture below... it works, but won't complete the write of the previous operation until the next write operation comes along!

I have several dozen of these guys (the dataloggers, not the PNY sticks) in the field working flawlessly, but I noticed that on this project, during testing, that the last operation performed before the box was powered down, opened, and the stick removed and read in a regular laptop, was consistently absent. After checking my code (which, as I said, is working perfectly in many identical copies out there), I just tried a different memory stick, and voila! Everything worked perfectly. I tried again with the PNY stick, and same thing. If I do 7 tests, I'll get data from test 1 - 6. If I do 12, I'll get 1 - 11.

So there's the warning.

The question: Since it's possible a customer in the field may use their own memory stick for this, and therefore it's possible they could use one of these or one like it, what might be happening in these? And is there something that I might want to do in my code, other than doing a bogus write after every valid write, to ensure the file gets written to the stick AND stored by the stick, after every write. According to my debug tests, the write operation and file closing are all happening properly, so it's definitely in the stick itself.

My stick-writing code is below; the datalogger is flashed with a setup to preset the baud rate etc.
OPEN_WRITE_CLOSE:
  SEROUT DLTX, DBaud,[$09, $20, "FMLOG.csv", CR]  ' Open file
  SERIN DLRX, DBaud,[WAIT (">")]
  DEBUG "Open", CR

  IF pr = 1 THEN
    READ 1, DI                           ' Get Var values stored in EEPROM in FMS1-kbd.bpx for power-cycle data recovery
    READ 2, Word TRN
    READ 4, Word TRKMLG
    READ 6, Word TRKMLG2
    READ 8, GDL
    READ 9, tenths
    READ 10, Word passCode

    SEROUT DLTX, DBaud, [$8,$20,$0,$0,$0,DEC 46,CR, DEC2 DI, ",", DEC3 TRN, ",", DEC3 TRKMLG, DEC3 TRKMLG2, ",", DEC4 passCode, ",", HEX2 month, "/", HEX2 date, "/", HEX2 year, " ", HEX2 hrs, ":", HEX2 mins, ":", HEX2 secs, ",", DEC3 GDL, ".", DEC1 tenths, " *", CR, $0A]  ' 6th code is write size in DEC (with firmware set to 4800/IPA/SCS)
    DEBUG "Written (PR)",CR
  ELSE
    SEROUT DLTX, DBaud, [$8,$20,$0,$0,$0,DEC 44,CR, DEC2 DI, ",", DEC3 TRN, ",", DEC3 TRKMLG, DEC3 TRKMLG2, ",", DEC4 passCode, ",", HEX2 month, "/", HEX2 date, "/", HEX2 year, " ", HEX2 hrs, ":", HEX2 mins, ":", HEX2 secs, ",", DEC3 GDL, ".", DEC1 tenths, CR, $0A]  ' 6th code is write size in DEC (with firmware set to 4800/IPA/SCS)
    DEBUG "Written",CR
  ENDIF

  SEROUT DLTX, DBaud,[$0A, $20, "FMLOG.csv", CR] ' Close file
  SERIN DLRX, DBaud,[WAIT (">")]
  DEBUG "Closed",CR
  WRITE 0, 0    ' Return power recovery data flag to 0.
RETURN
1000 x 437 - 41K

Comments

  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2013-09-20 06:19
    Hi , I know some sticks gave problems. Initially I might try a wait after each write
    SERIN DLRX, DBaud,[WAIT (">")]
    DEBUG "Written",CR
    

    Jeff T.
  • CuriousOneCuriousOne Posts: 931
    edited 2013-10-02 13:17
    I want to use this adapter too, but I'm worried about compatibility. Parallax datasheet mentions too old and too small in capacity flash drives. What about the current models?
  • xanatosxanatos Posts: 1,120
    edited 2013-10-02 13:25
    CuriousOne wrote: »
    I want to use this adapter too, but I'm worried about compatibility. Parallax datasheet mentions too old and too small in capacity flash drives. What about the current models?

    I've used these successfully with sticks as small as 1GB, and as large as 8GB. I *think* I used a 16GB unit once just as a quick test for something else. It may be that the units will not recognize memory above a certain size, but the devices certainly work for everything I've ever used them for. And since usually I'm writing datalines that are seldom in excess of 100 characters, 8GB is a LOT of datalines!
Sign In or Register to comment.