Using BASIC stamp to access SD via SPI
bunni
Posts: 38
Hello,
This is the dilemma I am currently in. I am working on a team at the University of Advancing Technology to launch a nearspace balloon, we had everything ready to go, sensors, radios, etc. We were going to use the radio to send positional data as well as voltage and internal temperature, all other sensors were just going to record data on an SD card. We had the very handy sparkfun MicroSD device ordered so we could just send serial data from the stamp and have it be recorded. The device is on backorder for months and we are scheduled for launch on the 16th of August. Now we are forced to do all of the bit-banging ourselves. There was a thread a while back of someone getting communication working properly:
http://forums.parallax.com/forums/default.aspx?f=5&m=62712
I can't, I am stuck and need help. If anyone has code that they would be willing to post I would greatly appreciate it. Either way, here is my code:
This will just take in a few bytes (like 0x400000000095 to put the device in SPI mode) and shift them out and then shift the response back. I get nothing, it seems like it didnt even understand my transmission, there are no flickers on the MISO line.
I have switching MOSFETs for MOSI and SDCLK, those show up fine on my o-scope and at the correct voltage levels, just no response back.
Thank you to anyone that can offer advice.
-Bunni
This is the dilemma I am currently in. I am working on a team at the University of Advancing Technology to launch a nearspace balloon, we had everything ready to go, sensors, radios, etc. We were going to use the radio to send positional data as well as voltage and internal temperature, all other sensors were just going to record data on an SD card. We had the very handy sparkfun MicroSD device ordered so we could just send serial data from the stamp and have it be recorded. The device is on backorder for months and we are scheduled for launch on the 16th of August. Now we are forced to do all of the bit-banging ourselves. There was a thread a while back of someone getting communication working properly:
http://forums.parallax.com/forums/default.aspx?f=5&m=62712
I can't, I am stuck and need help. If anyone has code that they would be willing to post I would greatly appreciate it. Either way, here is my code:
' {$STAMP BS2p} ' {$PBASIC 2.5} SDCLK PIN 14 MOSI PIN 15 MISO PIN 13 aword VAR Word bword VAR Word cword VAR Word recv VAR Byte main: OUTPUT SDCLK OUTPUT MOSI INPUT MISO DEBUGIN HEX aword DEBUGIN HEX bword DEBUGIN HEX cword SHIFTOUT MOSI, SDCLK, MSBFIRST, [noparse][[/noparse]aword\16, bword\16, cword\16] SHIFTIN MISO,SDCLK,MSBPOST, [noparse][[/noparse]recv\8] DEBUG HEX2 recv GOTO main
This will just take in a few bytes (like 0x400000000095 to put the device in SPI mode) and shift them out and then shift the response back. I get nothing, it seems like it didnt even understand my transmission, there are no flickers on the MISO line.
I have switching MOSFETs for MOSI and SDCLK, those show up fine on my o-scope and at the correct voltage levels, just no response back.
Thank you to anyone that can offer advice.
-Bunni
Comments
I would still like to know if anyone has a BASIC code example for communicating with an SD card, just to solve me original issue. I hate leaving open ends when I start a project.
-bunni
Unfortunately, I don't have the hitt consulting data logger. Instead, I have this:
http://store.gravitech.us/micaad.html
It does not come with a manual, unfortunately.
Is it possible to send about 5 values per minute to this microSD card using this adapter and a BS2?
Thanks,
Jeff