Shop OBEX P1 Docs P2 Docs Learn Events
Can I upload bin or eeprom from prop application? — Parallax Forums

Can I upload bin or eeprom from prop application?

R PankauR Pankau Posts: 127
edited 2011-08-01 18:38 in Propeller 1
I committed cardinal sin #1, I didn't backup my source code and I dropped my Laptop baking the SSD. Soooo... the only thing that was truly lost was one spin program that was finished and working. If I could upload that app from the EEPROM on the finished product, then at least I could archive the binary file. If I wanted to make more hardware copies of my project I would not need to write the thing over from scratch.... assuming no future bugs appear.

I guess I could write a program to accomplish this but it seems dangerous with only one copy of the bin living in the EEPROM of my app. I'd much rather use a proven tool to get the program backed up.

thanks, and Yes I'm a big advocate of Mirrored drives, backing up source code offsite, and ghosting periodically. I was just lazy and I got burned.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-07-30 10:38
    There are no programs that will directly upload the EEPROM. What you can do is connect an SD card to a group of 4 I/O pins on the Propeller, then use a program like DongleBasic (from the Object Exchange) to copy the EEPROM to an SD card file using its COPY statement. You can take the SD card and put it into your PC (or use an SD card reader). The file on the SD card is in the same format as a .bin file and can be used with the Propeller Tool to download to another Propeller's EEPROM. The documentation included with DongleBasic shows how to connect an SD card. You can use any group of 4 I/O pins other than 28-31. Remember not to download DongleBasic to EEPROM. That will erase what you have there. You want to download to RAM.

    If you use I/O pins other than 8-11 for the SD card, you'll have to change the I/O pin definitions in BB_definitions.spin and recompile DongleBasic.
  • R PankauR Pankau Posts: 127
    edited 2011-07-30 11:00
    Sounds like a good solution especially since my app is logging to an onboard SD card already. I'll give it a shot,

    thanks.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2011-07-30 18:05
    Hi , here is a VB .Net application that reads and writes binary files to and from the Prop EEPROM with various options including a file compare feature. For your purpose Upload and Save the binary to the HD of your PC.

    Jeff T.
  • R PankauR Pankau Posts: 127
    edited 2011-07-31 11:55
    Unsoundcode,
    thanks! what version of .NET framework do I need? Evidently I'm behind. I assume the latest will do the trick.
  • R PankauR Pankau Posts: 127
    edited 2011-07-31 12:13
    I don't have any .net compilers installed on my machine so maybe that's why I get exceptions?? I did upgrade to framework 4 but that does not seem to help.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2011-07-31 13:55
    I have .Net Framework 3.5 SP1 , all you should need are the .Net framework, Windows installer 3.1 and the Propellent.dll.

    The Propellent.dll is available at this link and should be in the System32 folder

    http://www.parallax.com/ProductInfo/Microcontrollers/PropellerGeneralInformation/PropellerMediaPage/tabid/832/Default.aspx

    Did the app install but fails to run , when and what were the exceptions.

    The upload feature works by using the Parallax Propellent dll to download a small program into the RAM of the Prop, this in turn reads the EEPROM and feeds it back to the PC.

    One test worth running would be to hit the Load Ram and Run button, this would not cause a threat to the program in EEPROM and runs soley dependent on the Propellent.dll. The test would narrow the problem down.

    thanks
    Jeff T.
  • R PankauR Pankau Posts: 127
    edited 2011-07-31 21:47
    Yes, app installed but resulted in the error "unhandled exception" and you are quite right if I read the error message further it tells me that I need the DLL named Propellent.......
  • R PankauR Pankau Posts: 127
    edited 2011-07-31 22:00
    OK, seems to be working...

    If I "Upload Binary" from my project it appears to do so with 2720 bytes presumably uploaded, should I expect the "compare Image" command to result in "true" when compared to the binary of the same project saved with the Prop tool? This is not the lost app but one for which I have the source to be sure that I'm doing this correctly. I'm getting false when I upload from the hardware then compare with the binary.
  • R PankauR Pankau Posts: 127
    edited 2011-07-31 22:05
    More info

    When I try to open the file that was uploaded with your tool with the Prop tool it complains, saying...that the file is truncated or not a Propeller application file, and "File size is less than 16 bytes or is less than word 4 (VarBase) indicates." not sure about that last statement's meaning.

    Also the file has a size of 0 bytes according to windows. I did see a transfer of data from the proto board, blinking lights and your app appeared to be counting bytes.
  • Dave HeinDave Hein Posts: 6,347
    edited 2011-08-01 05:57
    If I were you I would write a small Spin program to dump out the contents of the EEPROM to a serial port. You can do this with the Basic I2C Driver and FullDuplexSerial. At least this way you have a hex dump of the contents, which can be manipulated to generate a binary file, or it can be diassembled to Spin byte codes. In theory, you could regenerate a Spin source from the Spin bytecodes.

    The VarBase, or VBASE, is located at WORD[4] in memory. It is the starting address of the first VAR section, and is also equal to the size of the binary file.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2011-08-01 06:08
    Hi, if it's possible comparing the uploaded image with the same binary on disk is verification that the upload was successful and should indicate True.

    If your getting False then there was/is a problem with the upload process which is proven when the Prop tool fails to recognize the binary you save.

    It sounds as though the Propellent side of things is OK, that's to say downloading works fine. The uploaded number of bytes 2720 should match the file size of the binary on disk and also the value of bytes 8 and 9.

    The application should have dumped the binary into the text box where the upload can be compared visually with the original, at 2720 bytes then byte 8 should equal $A0 and byte 9 $0A.

    The display also indicates the file size by numbering each displayed line. The error the Proptool reports makes me think that the app is failing to read the first 16 bytes correctly.

    It's always done fine for me but obviously there is an issue, I will look at it more closely later today, thanks for the perseverance.

    Jeff T.
  • R PankauR Pankau Posts: 127
    edited 2011-08-01 11:06
    I'm not sitting at the same cpu now, but one thing I remember is that the view window did not have any text in it at all after the upload. (actually it never had any text)
  • Mike GreenMike Green Posts: 23,101
    edited 2011-08-01 11:11
    Do consider using DongleBasic since you already have an SD card socket in your setup. It will make a .bin file from the contents of EEPROM.
  • Dave HeinDave Hein Posts: 6,347
    edited 2011-08-01 13:32
    Here's a small program that will dump the EEPROM to the serial port. It also computes the checksum, and should display a checksum of zero if it read the EEPROM OK. Note, I haven't tested this program, but it should work. If you use this I suggest testing it on another board first to make sure it works OK. After you run the program, copy and paste the contents of the PST to a file to save it.

    Dave
    con
      _clkmode = xtal1+pll16x
      _clkfreq = 80_000_000
    
    obj
      ser : "FullDuplexSerial"
      i2c : "Basic_I2C_Driver_1"
    
    pub main | size, addr, checksum, value
      ser.start(31, 30, 0, 115200)
      i2c.Initialize(28)
      waitcnt(clkfreq*3 + cnt)
    
      size := i2c.ReadWord(28, $A0, 8)
    
      checksum := -$14
      repeat addr from 0 to size - 1
        value := i2c.ReadByte(28, $A0, addr)
        checksum += value
        ser.hex(value, 2)
        if (addr & 15) == 15
          ser.tx(13)
        else
          ser.tx(" ")
    
      ser.str(string(13, "Checksum = "))
      ser.hex(checksum & 255, 2)
      ser.tx(13)
    
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2011-08-01 18:38
    I can't re-create the errors you describe and I did try on several different Prop platforms, I even downloaded the previous attachment to see if the error was in that particular build. I'm sorry it's not working on your system, probably some subtlety I'm missing, but you still have the two previously mentioned options by which to recover the binary.

    regards
    Jeff T.
Sign In or Register to comment.