Shop OBEX P1 Docs P2 Docs Learn Events
RAISD QS-KIT - The Project — Parallax Forums

RAISD QS-KIT - The Project

msrobotsmsrobots Posts: 3,709
edited 2013-02-01 18:26 in Robotics
A while ago in some Parallax Forum Thread I stumbled over the idea of a RAID array of SD cards. A perfect job for the Parallax Propeller!

Kenichi Kato (@MacTuxLin) said he already has some 4 SD card board - his SD duplicator. He agreed to build me 2 Prototypes to help me on the hardware-side of the project, since I am better at the software-side of things.

And then THE FUN began!

Since HUB memory on the Propeller is a rare resource I decided from the beginning to 'double use' some areas for program code AND sector buffer and reload the code as needed from EEPROM.

So I split all used Objects in to parts,one for SPIN code and one for PASM code. This allowed me to keep half of the memory as sector buffer (16.5K).

The fastest way to talk to SD cards is save_spi from Jonathan Dummer (@Lonesock). I really like his code. Besides splitting PASM and SPIN I just added some code to read the checksum for a sector.

The next step was the prop2prop communication. The RAISD server need fast communication with your own project board. Since Pins are also a rare resource I build 3 versions of the cache-driver. You can use 2, 4 or 6 data lines to connect the RAISD server with your own project.

While I was coding along Kenichi Kato (@MacTuxLin) designed and build the RAISD QS-KIT for me. A nice addon board for the QickStart board with 4 SD cards and a battery backuped Real Time Clock. (available at propellerpowered).

The communication between the Propellers is based on Beau Schwabe's HS-serial. I extended the concept of the 2-wire version to more data lines for the 4-wire and 6-wire versions of RAISD server and RAISD clients..

In your own project you can use FSRW or Fat_Engine, both changed to use the RAISD server.

The RAISD server supports a Serial User Interface on Pin30/31 for configuration and both File System are have some methods to output (debug?) info on the server console.

Besides the Serial User Interface (running in SPIN) everything else is just PASM talking to PASM.
This little Propeller is quite a powerful chip.

In the next posts I will go thru some details of this thing but here the links:


Website RAISD QS-KIT http://www.msrobots.net/raisd-qs-kit.aspx
Schematic RAISD QS-KIT RAISDR1_2013-01-07-0946.pdf
Soldering RAISD QS-KIT soldering-instructions.pdf
Software RAISD server
Software RAISD Fat_Engine clients
Software RAISD FSRW clients

As usual all software etc is provided under the MIT licence like in the OBEX.

Enjoy!

Mike

Comments

  • msrobotsmsrobots Posts: 3,709
    edited 2013-02-01 16:02
    The Memory Layout.

    The RAISD-block-server (code) is the main object and includes first all SPIN objects and then all PASM objects. A PASM object just contains the DAT section with the PASM and some methods to get adresses and size for the PASM blob.
    OBJ
      I2C           : "I2C_Engine"    
      TERM          : "JDCogSerial-SPIN"    
     ... 
      STARTBUFFER   : "RAISD-startbuffer"
      TERMPASM      : "JDCogSerial-PASM"
     ...
      CPYDISKPASM   : "RAISD-cpydisk-PASM"
      RESTBUFFER    : "RAISD-restbuffer"
    
    

    Example PASM blob
    ''=======[ PUBlic Spin Methods ]===
    PUB getPASMstartAdress
    RESULT:=@main_cmd_entry
    PUB getPASMpatchAdress
    RESULT:=@RXmask
    PUB getPASMsize
    RESULT:=@CardType+4-@main_cmd_entry
    ''=======[ Assembly Cog... ]=======
    DAT
    ''-------[ Init ]---------------------------------------
                            ORG 0
    main_cmd_entry
    ...
    CardType                long    0
    

    On start of the RAISD-block-server this methods are called once for each PASM objec and the results saved for later use.
    ''=======[ PUBlic Spin Methods ]===============================================
    PUB Run
      ifnot term_pasm_adress
        term_pasm_adress    := TERMPASM.getPASMstartAdress
        term_pasm_size      := TERMPASM.getPASMsize
        sd_pasm_adress      := SDPASM.getPASMstartAdress
        sd_patch_adress     := SDPASM.getPASMpatchAdress
        sd_pasm_size        := SDPASM.getPASMsize
    ...
        cpydisk_patch_adress := CPYDISKPASM.getPASMpatchAdress
        cpydisk_pasm_size    := CPYDISKPASM.getPASMsize
        
        hubadr              := STARTBUFFER.bufadress
        endadr              := RESTBUFFER.endadress
      \RunStandalone
      reboot  
    
    

    Now I can use the HUB memory area between hubadr and endadr as buffer and reload the PASM out of the EEPROM if needed :smile:

    Enjoy!

    Mike.
  • msrobotsmsrobots Posts: 3,709
    edited 2013-02-01 16:27
    The Main Program Loop

    runs in the spin cog and provides a Serial User Interface for configuration and Status output.
    The spin cog starts and stops all other (PASM) cogs and reloads PASM from EEPROM if needed.

    The current Firmware contains 3 different driver to chose from, depending how much pins you can use to connect to the RAISD server.

    All configuration gets saved into the EEPROM and survives reboot.

    So you do not need to have a serial Terminal connected after first configuration.

    The second cog uses JDcogSerial (who is JD?) a great serial driver with buffer in the PASM cog and simple mailbox interface.
    This serial driver is used by the SPIN cog for the User Interface and by the RAISD server for (debug?) output from your own project.

    The RAISD system itself runs on 5 PASM cogs and is independend of the SPIN Main Loop.

    Enjoy!

    Mike
  • msrobotsmsrobots Posts: 3,709
    edited 2013-02-01 17:33
    The SD Access

    save_spi (pasm, spin) from Jonathan Dummer (@Lonesock) provides a nice mailbos interface usable from PASM. And since we run 4 cogs we can access 4 SD cards in the same time as one SD card :smile:

    So for security and speed the RAISD server writes every sector on every SD card. On read access it can read 4 times as fast.

    A funny thing is that even if you switch off the need for CRC in the SPI driver (as every driver does) the SD card still send you a CRC after transmitting a sector. This comes in handy for a RAID array so I changed save_spi to store the CRC and give access to the value.

    So the main PASM cog communicates with the client and the 4 SD card cogs, providing a 16K cache for faster access.

    The RAISD server firmware contains driver for 2-wire, 4-wire and 6-wire communication to the RAISD client. Depending on the number of pins you can use in your own project you can use one of three available drivers to connect your project to the RAISD server. All 3 driver are pretty alike and just use different code for Init rx and tx.

    Enjoy!

    Mike
  • msrobotsmsrobots Posts: 3,709
    edited 2013-02-01 18:26
    The File Systems

    If your project is using FSRW or Kye's Fat_Engine we have plugin replacements using the RAISD server.

    Both RAISD FSRW and RAISD Fat_Engine are using the Real Time Clock of the RAISD QS-KIT and provide methods to output (debug?) information on the Serial User Interface of the RAISD System.

    The RAISD QS-KIT provides a switch and terminals for VIN and switched VIN to connect your own Board and power the QS, the RAISD server and your Board from one powersource.

    Did I mentioned that the RAISD QS-KIT is available at propellerpowered?

    Enjoy!

    Mike
Sign In or Register to comment.