P1 SD Minimal Boot Test for P2 ROM - Please test :)

Cluso99Cluso99 Posts: 12,976
edited November 10 in Propeller 1 Vote Up0Vote Down
SD Boot Test for P1 v111

I would be really pleased if any of you can test the attached code on any SD/microSD cards that you may have.
SanDisk cards seem to work the best, although I have tried all sorts of cards.

The code is compiled for 5MHz*PLL16 (80MHz) and uses P0=DI, P1=CLK, P2=DO, P3=/CS. PST is used as a terminal on the PC.
Let me know if you require any other builds (crystal or SD pins).

Output is logged to the PST terminal screen and may be copied by CTL-C and pasted into Notepad or the forum.

Would you mind trying any cards you have and post the results to this thread. I am particularly interested in any failures. There is quite a complete diagnostic for me to see where it failed.

We are trying to validate the code for inclusion into the P2 ROM so that we can boot directly to SD Card if the user/designer wishes.

Here is a sample of the output...
SD testing v111
SD card type: 3 = SDHC/SD V2(block)  (passed)
4404: CS1 CLK0 ;
4408: CS1 CLK0  0 00000040 00000000 00000095 000000FF (1) 00000001 ;
4430: CS1 CLK0  8 00000048 000001AA 00000087 000000FF (1) 00000001 000001AA ;
445C: CS1 CLK0 55 00000077 00000000 00000087 000000FF (1) 00000001 ;
4484: CS0 CLK0 41 00000069 40000000 00000087 000000FF (1) 00000000 (7) (43736 clocks) 0ms ;
44BC: CS1 CLK0 58 0000007A 00000000 00000087 000000FF (1) 00000000 C0FF8000 ;
44E8: CS1 CLK0 16 00000050 00000200 00000087 000000FF (1) 00000000 ;
4510: CS1 CLK0  9 00000049 00000000 00000087 000000FF (1) 00000000 000000FF (1) 000000FE ;
4548:      (16 bytes) CRC: 0000008B 0000008F ;
4558: CS1 CLK0 10 0000004A 00000000 00000087 000000FF (1) 00000000 000000FF (1) 000000FE ;
4590:      (16 bytes) CRC: 00000062 000000D1 ;
45A0: CS1 CLK0 17 00000051 00000000 00000087 000000FF (1) 00000000 000000FF (348) 000000FE ;
45D8:     (512 bytes) CRC: 0000003B 00000084 ;
45E8: CS1 CLK0 17 00000051 00000001 00000087 000000FF (1) 00000000 000000FF (166) 000000FE ;
4620:     (512 bytes) CRC: 00000000 00000000 ;
4630: <eof>      (815700 clocks) 8ms
CSD register...
0000: 40 0E 00 32 5B 59 00 00 3B 7F 7F 80 0A 40 00 09  @..2[Y..;....@..
CID register...
0000: 12 56 78 41 53 54 43 00 34 00 00 14 6C 01 03 5B  .VxASTC.4...l..[
MBR/VBR sector 0 ...
0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
01A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
01B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 82  ................
01C0: 03 00 0B E6 DC CA 00 20 00 00 00 E0 ED 00 00 00  ....... ........
01D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
01E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
01F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 AA  ..............U.
Valid MBR
proposed use--> 01AE: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
PTN 0: Typ=$0B  01BE: 00 82 03 00 0B E6 DC CA 00 20 00 00 00 E0 ED 00  ......... ......
PTN 1: Typ=$00  01CE: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
PTN 2: Typ=$00  01DE: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
PTN 3: Typ=$00  01EE: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
VOL sector 1 ...
0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
01A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
01B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
01C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
01D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
01E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
01F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
My Prop boards: P8XBlade2, RamBlade, CpuBlade, TriBlade
Prop OS (also see Sphinx, PropDos, PropCmd, Spinix)
Website: www.clusos.com
Prop Tools (Index) , Emulators (Index) , ZiCog (Z80)

Comments

  • 27 Comments sorted by Date Added Votes
  • Great, Cluso99!

    I ordered an SD card breakout board today, so that I can try SD code out, too.
  • In my reading on SD cards, one of the articles says that a pullup is required on DO for some cards. I haven't ever used this and don't recall a card requiring it. Just mentioning here so we don't forget if we find cards that we cannot read.

    The code has a very complete set of routines for SPI read/write of commands and data sector/registers. I have been careful not to drive this at full speed as it's a boot loader we want to guarantee to work. We can load a better/faster one subsequently if desired.

    BTW Chip, I realised my cards have been booting faster the first time, because my board has an eeprom sd booter in it that attempts to initialise the card before I can get in to do it by download. I will have to enable the eeprom to overwrite it. Note some SD cards can take 100's of ms to initialise.
    My Prop boards: P8XBlade2, RamBlade, CpuBlade, TriBlade
    Prop OS (also see Sphinx, PropDos, PropCmd, Spinix)
    Website: www.clusos.com
    Prop Tools (Index) , Emulators (Index) , ZiCog (Z80)
  • Chip,
    FWIW code size without sector buffer...
    Code initialisation ~100 longs
    Subroutines ~100 longs
    Pre-initialised working registers ~25
    Un-initialised working registers ~30
    This includes some debug instructions and registers which will come out.
    My Prop boards: P8XBlade2, RamBlade, CpuBlade, TriBlade
    Prop OS (also see Sphinx, PropDos, PropCmd, Spinix)
    Website: www.clusos.com
    Prop Tools (Index) , Emulators (Index) , ZiCog (Z80)
  • I need a build for the Activity Board WX (P22 - DO; P23 - CLK; P24 - DI/CD; P25 - /CS)
  • Mike,
    Activity Board WX (P22 - DO; P23 - CLK; P24 - DI/CD; P25 - /CS) 5MHz version
    My Prop boards: P8XBlade2, RamBlade, CpuBlade, TriBlade
    Prop OS (also see Sphinx, PropDos, PropCmd, Spinix)
    Website: www.clusos.com
    Prop Tools (Index) , Emulators (Index) , ZiCog (Z80)
  • Activity Board WX Rev A with generic 2GB (MicroCenter) card:
  • Propeller Board of Education with 8GB SanDisk card
    Feel the need for speed between your PC's com port and Prop?
    Try the FTDI 245 and the FullDuplexParallel Object.

    Check out my spin driver for the Parallax "96 x 64 Color OLED Display Module" Product ID: 28087
  • Propeller Board of Education with 64GB SanDiskUltra card

    Feel the need for speed between your PC's com port and Prop?
    Try the FTDI 245 and the FullDuplexParallel Object.

    Check out my spin driver for the Parallax "96 x 64 Color OLED Display Module" Product ID: 28087
  • Activity Board (Not WX) Rev A.

    3 - 2GB Generic SD cards (Made in China) (Purchased used from Ebay).
    Along with 'Antimatter' and 'Dark Matter' we've recently discovered the existence of
    `Doesn't Matter`, which appears to have no effect on the universe whatsoever.
  • Activity Board (Not WX) Rev A.

    Found another card, card passed, but its data looks a little different than the others:

    RiData 2GB MicroSD card.
    Along with 'Antimatter' and 'Dark Matter' we've recently discovered the existence of
    `Doesn't Matter`, which appears to have no effect on the universe whatsoever.
  • Thanks guys :)

    I am out so cannot check the data right now. As long as they pass, it's all good.
    The different sector data will depend on whether boot code was written or not, even though the boot is not used much any more.
    My Prop boards: P8XBlade2, RamBlade, CpuBlade, TriBlade
    Prop OS (also see Sphinx, PropDos, PropCmd, Spinix)
    Website: www.clusos.com
    Prop Tools (Index) , Emulators (Index) , ZiCog (Z80)
  • Here is a quick summary so far...
    All 15 cards passed
    Only 6 are SanDisk
    9 are #3 (V2 block mode), 5 are #2 (V2 byte mode), 1 unknown( 1GB SanDisk missing top log section)
    All contain Partition data in the MBR/Sector 0
    12 contain 00's in the rest of the MBR, except 2 with pre-partition block $1AE with data, 3 contain some form of boot data
    13 contain 00's in sector 1, and 2 contain FF's
    1 is 1GB is unknown version
    5 are 2GB and V2(byte mode)
    9 are 4-32GB and V2(block mode)
    My Prop boards: P8XBlade2, RamBlade, CpuBlade, TriBlade
    Prop OS (also see Sphinx, PropDos, PropCmd, Spinix)
    Website: www.clusos.com
    Prop Tools (Index) , Emulators (Index) , ZiCog (Z80)
  • I'd like to be of assistance But I did not try anything yet. Do the sdcards have to be formatted in a special way or does the test format the card itself?
    Maybe you could add a linux format howto to prepare the disk before doing the test?
    I Am One With the Forth and the Forth Is With Me
  • Cluso99Cluso99 Posts: 12,976
    edited November 12 Vote Up0Vote Down
    The test program only initialises the SD Card, reads the CSD and CID registers, and reads sectors 0 & 1.
    No writes are done.

    Do not do anything to prepare the SD card. I am interested in whether it works (initialises and reads), and what data is on sectors 0 & 1.

    Just download the binary into the P1 propeller and run as you would normally do on whatever OS you use (Windoze, Linux, MacOS). You will need to run a terminal program immediately to catch the output.
    eg Ctl-F10 followed by F12 in PropTool/Windows.

    Thanks.
    My Prop boards: P8XBlade2, RamBlade, CpuBlade, TriBlade
    Prop OS (also see Sphinx, PropDos, PropCmd, Spinix)
    Website: www.clusos.com
    Prop Tools (Index) , Emulators (Index) , ZiCog (Z80)
  • Finally had a chance to re-test all my microSD cards. Results attached.

    My Prop boards: P8XBlade2, RamBlade, CpuBlade, TriBlade
    Prop OS (also see Sphinx, PropDos, PropCmd, Spinix)
    Website: www.clusos.com
    Prop Tools (Index) , Emulators (Index) , ZiCog (Z80)
  • Here is a summary of the cards tested...
    SD%20Cards%20V111.jpg
    688 x 453 - 117K
    My Prop boards: P8XBlade2, RamBlade, CpuBlade, TriBlade
    Prop OS (also see Sphinx, PropDos, PropCmd, Spinix)
    Website: www.clusos.com
    Prop Tools (Index) , Emulators (Index) , ZiCog (Z80)
  • These are from the Prop BOE, same pinout as the Activity Board WX program you made Mike: (P22 - DO; P23 - CLK; P24 - DI/CD; P25 - /CS).
    Samsung 32GB, Patriot 32 GB, Sony 16GB, Patriot 16GB, all passed. :thumb:
  • Thanks DrProp.
    I am interested to know for these larger cards, whether they are marked SDHC or SDXC and if they have a Class "Cnn" and/or "Un" speed, please.
    My Prop boards: P8XBlade2, RamBlade, CpuBlade, TriBlade
    Prop OS (also see Sphinx, PropDos, PropCmd, Spinix)
    Website: www.clusos.com
    Prop Tools (Index) , Emulators (Index) , ZiCog (Z80)
  • DrPopDrPop Posts: 149
    edited November 14 Vote Up0Vote Down
    Cluso99 wrote: »
    Thanks DrProp.
    I am interested to know for these larger cards, whether they are marked SDHC or SDXC and if they have a Class "Cnn" and/or "Un" speed, please.

    They are all Class 10; Micro SD HC I, with the little symbol of a U with a 1 inside.
    The Sony 16GB card says 40MB/s; the others don't list a speed on them, but the Samsung 32GB is the EVO version and even faster.
    Hope that helps a little! If you want smaller cards tested, I can dig up them up if I still have them. :smile:
  • I am going to bump this thread as I would love to see more test results.

    What I am seeing is that the MBR (sector 0) is rarely used, other than for the Partition Blocks.
    Similarly, sector 1 is rarely used either.
    This is confirmed by some manufacturers card specs too.
    My Prop boards: P8XBlade2, RamBlade, CpuBlade, TriBlade
    Prop OS (also see Sphinx, PropDos, PropCmd, Spinix)
    Website: www.clusos.com
    Prop Tools (Index) , Emulators (Index) , ZiCog (Z80)
  • Cluso99 wrote: »
    I am going to bump this thread as I would love to see more test results.

    What I am seeing is that the MBR (sector 0) is rarely used, other than for the Partition Blocks.
    Similarly, sector 1 is rarely used either.
    This is confirmed by some manufacturers card specs too.

    I can confirm that just from experience, in fact a properly formatted card always has a few meg totally unused (and inaccessible to the PC) before the start of the FAT32 partition, and I do mean unused, except for mandatory MBR partition information in sector 0. Cameras should format a card correctly, just as Panasonic's SD formatter software does too, but WIndows nor Linux does not AFAIK as it does not leave this SD optimizing gap. An SD card after all is not just serial Flash, it has a controller that tries to manage it as best as it can.

    BTW, any pre-SDHC card such as 2GB cards etc should be lumped in with the floppies, they are irrelevant for any new design and work differently anyway since SDHC addresses blocks, not bytes.

    Tachyon Forth - compact, fast, forthwright and interactive
    useforthlogo-s.png
    Tachyon Forth News Blog
    TACHYON DEMONSTRATOR
    Brisbane, Australia
  • Peter,
    I detect SD & SDHC cards V2.0 in byte or block mode correctly, so there are no problems here. It is simple enough to support both, and the extra code is minimal.

    There were no old V1.0 SD cards tested. I did find a bug in my code although it has not caused any problems so far. I had been trying to minimise the code as far as possible, and make the subroutines as usable as possible to make the commands as simple to use as possible, with generic calling methods.
    My Prop boards: P8XBlade2, RamBlade, CpuBlade, TriBlade
    Prop OS (also see Sphinx, PropDos, PropCmd, Spinix)
    Website: www.clusos.com
    Prop Tools (Index) , Emulators (Index) , ZiCog (Z80)
  • Here are results for 8 cards in the 64M to 32G range with their info in the file name. (The 64M is an older card I had lying around; all the others are 1G or larger).

    The cards that have a speed number have it in parentheses in the filename, otherwise its listed as "x".
  • Thanks David. I will check when I get home later.
    My Prop boards: P8XBlade2, RamBlade, CpuBlade, TriBlade
    Prop OS (also see Sphinx, PropDos, PropCmd, Spinix)
    Website: www.clusos.com
    Prop Tools (Index) , Emulators (Index) , ZiCog (Z80)
  • Peter JakackiPeter Jakacki Posts: 6,636
    edited 4:54AM Vote Up0Vote Down
    Here is a cluster map of the first 40 or so megabytes of a 64G SD card, just to give you an idea. Each character in the dump represents 32KB so each line is 2MB. A * indicates non-zero data present. Of the first 32kB there is only the partition table in sector 0.
    TAQOZ$ 0 $20000 SDMAP2
     $00.0000: *...............................................................
     $00.1000: ................................................................
     $00.2000: ................................................................
     $00.3000: ................................................................
     $00.4000: ................................................................
     $00.5000: ................................................................
     $00.6000: ................................................................
     $00.7000: ................................................................
     $00.8000: *...............................................................
     $00.9000: ................................................................
     $00.A000: ................................................................
     $00.B000: ................................................................
     $00.C000: *...............................................................
     $00.D000: ................................................................
     $00.E000: ................................................................
     $00.F000: ................................................................
     $01.0000: *...*...*...*.......*...*...*...*...****........................
     $01.1000: ........................*.......................................
     $01.2000: ............*****...*******.*...********************************
     $01.3000: ****************************************************************
     $01.4000: ****************************************************************
     $01.5000: ****************************************************************
     $01.6000: *********...*...............*...*...*...*...********************
     $01.7000: ****************************************************************
     $01.8000: ****************************************************************
     $01.9000: **********************************..*...*.......................
     $00.0000: *...............................................................
     $00.1000: ................................................................
     $00.2000: ................................................................
     $00.3000: ................................................................
     $00.4000: ................................................................
     $00.5000: ................................................................
     $00.6000: ................................................................
     $00.7000: ................................................................
     $00.8000: *...............................................................
     $00.9000: ................................................................
     $00.A000: ................................................................
     $00.B000: ................................................................
     $00.C000: *...............................................................
     $00.D000: ................................................................
     $00.E000: ................................................................
     $00.F000: ................................................................
     $01.0000: *...*...*...*.......*...*...*...*...****........................
     $01.1000: ........................*.......................................
     $01.2000: ............*****...*******.*...********************************
     $01.3000: ****************************************************************
     $01.4000: ****************************************************************
     $01.5000: ****************************************************************
     $01.6000: *********...*...............*...*...*...*...********************
     $01.7000: ****************************************************************
     $01.8000: ****************************************************************
     $01.9000: **********************************..*...*.......................
    
    Tachyon Forth - compact, fast, forthwright and interactive
    useforthlogo-s.png
    Tachyon Forth News Blog
    TACHYON DEMONSTRATOR
    Brisbane, Australia
  • Yes Peter. That's precisely my expectations.

    With ~256B (~64 instructions) we can get enough to determine where to load more code from, by utilising the ROM subroutines already loaded in the boot code.

    With this method, we will not care what format the SD card has. And we can cover any future standard.

    I am hoping I might be able to have the MBR code workable for both P2 and P1 :)

    FWIW FAT32 will work to 1TB cards, and they are probably 5 years out. So that means they should be readily available (new) for +10 years after that.
    My Prop boards: P8XBlade2, RamBlade, CpuBlade, TriBlade
    Prop OS (also see Sphinx, PropDos, PropCmd, Spinix)
    Website: www.clusos.com
    Prop Tools (Index) , Emulators (Index) , ZiCog (Z80)
Sign In or Register to comment.