Shop OBEX P1 Docs P2 Docs Learn Events
SD Card won't mount — Parallax Forums

SD Card won't mount

highplainsbubbahighplainsbubba Posts: 34
edited 2013-11-29 18:37 in Learn with BlocklyProp
I am trying to follow the tutorial http://gadgetgangster.com/tutorials/331 on mounting an SD card (OBEX FAT16 routines with secure digital card layer), but my card fails to mount. Using the serial terminal I was able to track the abort to the safe_spi module. The last line on the serial term is "read block line 111" with the value of "@" for SPI_command . I don't quite understand why the code is not indented below the repeat statement and what the repeat accomplishes. I also don't understand why the repeat aborts if SPI_command is just set to "r" in the statement 2 lines above.


PUB readblock( block_index, buffer_address )
   pst.Start(115_200)
   waitcnt(clkfreq*4 + cnt) 
  if SPI_engine_cog == 0
     pst.str(string( 13, "read block line 101",13))  
    abort ERR_SPI_ENGINE_NOT_RUNNING
  if (buffer_address & 3)
     pst.str(string( 13, "read block  line 104",13))  
     abort ERR_BLOCK_NOT_LONG_ALIGNED
  SPI_block_index := block_index
  SPI_buffer_address := buffer_address
  SPI_command := "r"
  repeat while SPI_command == "r"
  if SPI_command < 0
    pst.str(string( 13, "read block  line 111",SPI_command,13)) 
    abort SPI_command
 pst.str(string( 13, "read block  line 113",13)) 

Comments

  • highplainsbubbahighplainsbubba Posts: 34
    edited 2013-06-22 08:27
    I ran the Mount_test.spin again with Viewport support and got the following LSA plot. The traces are as follows:
    0 = Data out
    1 = Clock
    2 = Data In
    3 = Chip Select
    See attached file.
    The clock line doesn't look like any clock I have ever seen. Any ideas?
    1024 x 576 - 81K
  • kuronekokuroneko Posts: 3,623
    edited 2013-06-23 17:25
    What is the actual abort code (currently you print its address)? Use pst.dec(SPI_command) before the abort.
  • highplainsbubbahighplainsbubba Posts: 34
    edited 2013-06-27 14:13
    Solved the problem today. I had purchased a cheap SD/Micro SD adapter from Ebay and was using that when I had the problem. It had circuitry for 5 volts and 3 volt selection. I ordered a MicroSD adapter from Parallax and plugged that in today and the tutorial and SD card profiler file ran fine. I noticed on the cheap card the resistance from hookup pin to card pin was 20K. I don't know if that makes a difference or not, but the new adapter is working fine and it has 10K like the programs call for. Apparently it was hardware gremlins.

    Ran again with the cheap card and got -255 for the error code for SPI_command. Thanks for the help kuroneko.

    Stripped all the extraneous circuitry off the cheap adapter and wired it like the Parallax card and both the SD card profiler and the tutorial software ran fine. I guess I didn't waste $4 after all.
  • joeysr20detjoeysr20det Posts: 8
    edited 2013-11-29 18:37
    highplainsbubba, I think I have the same $4 ebay adapter you do lol. What did you do to the adapter to make it work? I'm running into the same issue and none of the Propeller SD card modules seem to be around anywhere :(
Sign In or Register to comment.