Shop OBEX P1 Docs P2 Docs Learn Events
Sd card loader - fat 32 — Parallax Forums

Sd card loader - fat 32

In the past I used an SD program loader that resides in the lower eeprom memory. It was posted on the forum.
It checks the SD for an eeprom image, in that case it loads it in the upper eeprom space (you need a 64+ eeprom).
It then deletes the program from sd and runs the program from upper memory.
If sd has not an image file it simply runs from upper memory.
It works perfectly but only with fat16 file systems. The current cheapest memory cards use fat 32, so I’m wondering if there is a fat32 version.
Thanks in advance,
Massimo

Comments

  • Cluso99Cluso99 Posts: 18,069
    Kyes FATEngine supports FAT32
  • FSRW 2.6 also supports FAT32. Maybe the original program is using FSRW 1.6. Do you have the source for the program?
  • This program uses FSRW 1.4, which is an early version that only supports FAT16. You should be able to upgrade it to use FSRW 2.6, but it appears that Mike Green modified FSRW, which will complicate things. The sdspiFemto.spin file actually contains more I2C code than SPI, which provides the EEPROM routines.

    I would suggest renaming sdspiFemto.spin to eeprom.spin, and remove the SPI routines from it. Replace fsrwFemto.spin with fsrw.spin from the FSRW 2.6 repository, and also add the SPI driver from FSRW 2.6.
  • max72max72 Posts: 1,155
    Thanks,
    I'll try to follow your suggestion.
    I hoped there already was an updated version.
    I'l let you know how it goes.
    Thanks again,
    Massimo
  • I played around with the code, and was able to get it to compile with FSRW 2.6. I didn't try running, but hopefully it will work OK. The new code is in the attached zip file.
  • max72max72 Posts: 1,155
    Wow!
    Tomorrow I’ll give it a whirl.
    Thanks,
    Massimo
  • max72max72 Posts: 1,155
    I tested it, and it was missing a bit (an ldr.start). Now it seems fine. I'll test it a little more, clean it up and upload it.
    Thanks,
    Massimo
  • max72max72 Posts: 1,155
    I added the old sd.start method, now called sd.ldrstart for name conflicts. It should be the i2c driver running in a dedicated COG for the eeprom loader.

    note: run method is not working (for my understanding in the former version used the I2C driver to access the SD during the run method, stopping all the other cogs, now it's not possible).

    Thanks again,
    Massimo
  • I've got to ask the "burning" question, what are you trying to do with this method? It sounds like a work-around or kludge.
  • max72max72 Posts: 1,155
    I have a couple of boxes that my friends are testing, and asking them to program the propeller might prove to be too difficult.
    I was considering Tachyon + bluetooth too, but besides my limited (read null) forth programming skills it would be too complex for them to reprogram via terminal.
    Saving a file on an SD card and plugging it in the box is probably the simplest option.
    Massimo
  • I normally have an extra row of 4 pins next to the 4 pin programming header, so a 4x2 footprint on my boards, even if I do have built-in USB sometimes. The other 4 pins are +5V and I2C and I send out a small Prop board all setup so that when you plug it into the target board, it will reprogram the EEPROM. Of course you need those 4 pins but you don't need a Prop to load it but it is handy for me.

    Alternatively, you can reload it via the serial port with one of the simple command line loaders that work in Windows or Linux or Mac.

    But if they can't program the Prop, how can you send them a card when you need to program the Prop?
  • max72max72 Posts: 1,155
    Reprogramming via the SD It's rather easy.
    The board already has the SD slot and a card in it.
    I can send them an eeprom image via mail, they simply have to move the SD from the board to the pc, copy the file on the SD, and plug it back in the board.
    During the next boot the system will update and delete the image form the SD.
    Massimo
  • But you have got to get that SD bootloader program into eeprom first?
  • max72max72 Posts: 1,155
    Yes, in the first 32k of the eeprom resides the bootloader. The board should ship with the bootloader installed.
    The bootloader then checks the SD, and in case there is an image file it copies it to the upper 32k of the eeprom, and then deletes the image file (optional).
    During normal operation the bootloader checks the SD, and then it runs the main program that resides in the upper part of the memory.
    Massimo
  • Ok, so you are referring to the FAT16 version bootloader then I guess, although I'm still confused.
    However it's not just that the old version was FAT16, but it is also because it used standard SD cards that addressed memory in bytes and has a slightly different initialization. The newer cards than those, but still old, are the SDHC cards that addressed memory in blocks.

    So you want to get the new SDHC FAT32 version of your bootloader onto an old SD FAT16 card to then upgrade the units in the field? If you have a solution then good, but let me know if you are stuck, I am sure I can whip up a bootloader to suit easily enough.
  • max72max72 Posts: 1,155
    I'm still completing the units, so they will be shipped with the new bootloader, and a new SD.
    Nowadays it's difficult and expensive to find 2Gb cards.

    The bootloader is also able to upgrade itself (depending on the file name you write in the lower or upper eeprom), so in theory older units on the wild should be upgradable if the 2Gb SD is still usable.
    Anyway the question is academic because older projects are all dead.

    Thanks,
    Massimo
Sign In or Register to comment.