SD Card won't mount
highplainsbubba
Posts: 34
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
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?
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.