Using MicroSD card on Demo board with FemtoBASIC?
RobotWorkshop
Posts: 2,307
Hello,
I've read about support for SD cards on the DEMO board with FemtoBASIC but what about the MicroSD cards? I have one of the small breakout boards for the MicroSD cards which i'm trying to use with the DEMO board. When I send FemtoBASIC to the DEMO board I made sure that Demo = true and the other two board styles are false. I can bring up FemtoBASIC but when I try to use the FILES command it says it can't mount the SD card. I did format the card under Windows XP using: FORMAT F: /fs:fat /a:8192 which completed successfully. The way it is wired up is:
DO - p0 and pulled to 3.3v through 18K resistor
SCK - p1 and pulled to 3.3v through 18K resistor
DI - p2 and pulled to 3.3v through 18K resistor
CS - p3 and pulled to 3.3v through 18K resistor
CD - pulled to 3.3v through 18K resistor
VCC - 3.3v
GND - Ground
Do the connections above look correct? If so are the MicroSD cards different and in that case do I need to switch to the regular SD cards? I have a little free time this weekend and i'm hoping to finish off the demo system so I can try out some of the other programs for this.
Best Regards,
Robert
I've read about support for SD cards on the DEMO board with FemtoBASIC but what about the MicroSD cards? I have one of the small breakout boards for the MicroSD cards which i'm trying to use with the DEMO board. When I send FemtoBASIC to the DEMO board I made sure that Demo = true and the other two board styles are false. I can bring up FemtoBASIC but when I try to use the FILES command it says it can't mount the SD card. I did format the card under Windows XP using: FORMAT F: /fs:fat /a:8192 which completed successfully. The way it is wired up is:
DO - p0 and pulled to 3.3v through 18K resistor
SCK - p1 and pulled to 3.3v through 18K resistor
DI - p2 and pulled to 3.3v through 18K resistor
CS - p3 and pulled to 3.3v through 18K resistor
CD - pulled to 3.3v through 18K resistor
VCC - 3.3v
GND - Ground
Do the connections above look correct? If so are the MicroSD cards different and in that case do I need to switch to the regular SD cards? I have a little free time this weekend and i'm hoping to finish off the demo system so I can try out some of the other programs for this.
Best Regards,
Robert
Comments
The connections you've listed appear correct. I haven't tried either FemtoBasic or BoeBotBasic with the MicroSD cards yet, but it should work the same. I do have a MicroSD socket, but haven't hooked it up to anything. Do check that the pins are connected to the signals you think they are. I have wired a standard SD card backwards ... didn't work that way, but it survived the error.
Thanks for the reply. Maybe I am missing some other steps. A couple of things that come to mind....
- Do the SD cards need a special volume label when you format them? I labeled mine PROPELLER when I formatted the card.
- When using the FILES command do I first have to mount the SD card or will it automount the SD card and read it?
- The CD signal didn't match up to the ones on the regular SD card. I haven't tried tying it low instead.
I just found this datasheet online that covers some of the MicroSD cards which may help:
http://www.pqi.com.tw/upload/download/micro SD(2).pdf
I'm going to review it and double check all the connections again.
Best Regards,
Robert
Best Regards,
Robert
The CD signal isn't used by the I/O routines. It's an output from the card socket.
I haven't found that anything special is needed for a volume label other than the
usual uppercase only, no spaces, etc.
Thanks for the datasheet.
Do you know if a regular SD card will work if you leave off the two pull-up resistors on the DAT1 and DAT2 lines?? I'm beginning to think this may be my problem. It appears those two lines aren't brought out to the header and as a result don't have anything connected! I think that the CD isn't doing anything and I could have ignored it. I'm going to try soldering on a couple pull-ups on those other two lines and see if that does it.
Robert
I recall reading somewhere that there was also a slow speed version of the SD card support that would allow it to work with more SD cards. For troubleshooting purposes is there any way to use that with FemtoBasic or add some delays to see if it may be a timing issue?
Robert
Try adding a NOP after :recvBit. I'm not sure if there's room in the cog. You'll get an error message if not.
Thanks for your help. I tried adding the nop and it seems there was room since it compiled and ran the code. It still didn't make any difference. I think I am going to try to pickup a couple more SD cards and format them on another system to make sure that it isn't a formatting problem with the cards. If that doesn't help I think i'm just going to set this off to the side and work on other projects. It is probably something I keep on overlooking so the break may help. I may just pickup one of the Propeller protoboards and try these cards out there. Once I have at least one working setup with the SD card I can figure out what is going on with the other one.
Best Regards,
Robert
test and let me know what it shows on the screen.
If you want to try a slower speed, substitute sdspi.spin for sdspiqasm.spin.
This usually turns out to be something reasonably easy.
-tom
I just ran the fsrw_speed.spin and it returned a code of -13. When I changed it to use sdspi.spin instead it returned a code of -41.
Does that suggest anything in particular to look for? I didn't get a chance to pickup any more SD cards but am going to see if I can pick up a different brand tomorrow.
Best Regards,
Robert
The wiring you describe is correct. At this point, I'd upload a detailed picture of the
connections if you could just so we can check and see if we note anything wrong.
Do you have a scope? If you do, scope the pins. Start with DI and make sure it's
wiggling, and also SCK. If they are both wiggling, then check DO and see if it wiggles at all.
Also check both power pins, of course; they should be steady at 0 and 3.3V.
With the SD card out, you should also use an ohmmeter and check for shorts between
combinations of pins. (With power off, of course.)
Next, check the connections, P0 -> D0, P1 -> SCLK, P2 -> DI, P3 -> CS. They should have
a pretty solid connection there. Measure from as close to the Prop to as close to the
SD card as you can, since any miswiring could be anywhere.
If all this fails, just for kicks, rewire it to use pins 4..7 instead of 0..3. (This just in case
there is something wrong with the 0..3 pins, which is unlikely.)
When you run fsrw_speed, with sdspi.spin, do you get anything on the screen at all? Let's
see the entire screen contents. If you want, go ahead and add debugging code to
sdspi.spin and fsrw.spin to see where it blows up.
This does work for many people, so we just need to work through what the problem is here.
If you don't have a scope and you are adventurous, you might try the 80MHz scope that
was put together by Hanno; that is a really cool app.
I'm sure you'll figure it out.
Dean
Not to change the subject, I also wired up my sparkfun SD breakout board.
I will follow the direction you posted to look for errors in my wireing set up.
·You wrote:
·When you run fsrw_speed, with sdspi.spin, do you get anything on the screen at all? Let's
·see the entire screen contents. If you want, go ahead and add debugging code to
·sdspi.spin and fsrw.spin to see where it blows up.
My screen reads :
Mounting.
Returned from start
-20
When I run the fsrw_speed
Is this also some type of timing error?
Rob7
Post Edited (Rob7) : 7/3/2007 3:05:14 PM GMT
data; it couldn't find the FAT16 marker in either block 0 or in the first block referenced by the
partition table).
Do you always get a -20 on fsrw?
(I need to write a debugging version of fsrw that dumps out the process, what it saw, and what
it expected to see, for situations like this.)
If you have access to linux, can you do the following:
1. Insert your SD card into your linux box; figure out where it's mounted. I'm going to assume
/dev/sdc1
2. Type
dd if=/dev/sdc1 of=datadump bs=512 count=2048
That will dump the first MB into a file called datadump. Now upload this file to
http://tomas.rokicki.com/cgi-bin/upload.pl
and let me know it's there and I'll take a look at it to figure out what might be wrong.
If you don't have linux, get it; you can just download Knoppix and burn it to a CD
and boot off that to follow my instructions above.
-tom
Yes,
This is the screen I always get .
I loaded a file to my SD card, however I dont think that I am formatting it correctly ?
Do you have any sugustions on formatting my card with Win XP home edition SP2.
I formated the card under Win XP :command prompt C:> FORMAT J: /fs:fat /a:8192
I also found after checking my file in the SD card, it is listed as an .eeprom extension.
What extension .xxx should I use for the prop to read it ?
This is the extension.
Post Edited (Rob7) : 7/3/2007 3:58:52 PM GMT
format. But a 1GB card with 8,192 byte sectors would give you 131K sectors, so that would be FAT32 and that
won't work (and will fail as you describe).
I recommend using format j: /fs:fat /a:32768
This will always give you a FAT16 for any SD card larger than 128MB (and most cards these days are larger
than 128MB), and it will give you nice big sectors so things are fast.
To read an ".eeprom" extension you would give it a filename ending with ".eep".
If we're lucky the only problem is the format command.
My Fios has been giving my trouble now for two days. Verizon has me up and running again !
Have to run out now for a B-day party.
I will try it tonight when I get back.
Rob7
I am using a pqi 1GB micro-sd card and the sparkfun adapter. It worked great as soon as I wired it up.
I used Femto Basic and didn't even have to change it.
Here is how I wired it to my DemoBoard.
Demo Socket resistor Demo
VDD
VCC
P0
DO
10K
VDD
P1
SCK
10K
VDD
P2
DI
10K
VDD
P3
CS
10K
VDD
CD
10K
VDD
Be careful to not let the long legs of the resisters touch. I made this mistake a couple of times.
It the whole bible off the card very slowly in femto basic one byte at a times. It ran for several days like that.
It took more than 24 hours to read the whole file, bible13.txt, and display it on the screen.
It also worked well for storing programs.
I hoped that helps.
Doug
It is possible that your socket is bad. Did you solder a pin header on it so you could plug it into a breadboard?
Take Care,
Doug
The problem was the SD and MicroSD breakout boards from SparkFun. I had purchased one SD breakout and two MicroSD boards. It was just my luck that the SD breakout board and the MicroSD breakout board I was using were both bad. I finally tried out the extra MicroSD breakout board and everything started working perfectly! Upon closer inspection the solder pads on the SD breakout board didn't look so good. I used an exacto to clean off the leads on the socket where it is soldered and then re-soldered each connection. Once that was done the SD card adapter started working fine as well. Still no luck on the original MicroSD adapter but at least I now know that is bad and I can try to clean that up as well. If not i'll see if SparkFun will provide a warranty and replace it.
So, if anyone else is having issues with the SD and MicroSD cards and use one of these breakout boards then don't assume the adapter is ok. Check the way it is soldered onto the board and if it doesn't look good then send it back....
Best Regards,
Robert
i finally stumbled over this thread , which exactly describes my problem (error codes -41 and -13 depending on subroutine used):
„Using MicroSD card on Demo board with FemtoBASIC? „
started on 6/30/2007 by RobotWorkshop.
I,ve tried all 4 submodules to fsrw.spin, from sdspi.spin to sdspiqasm.
I get exactly the same error codes with the different subroutines, as mentioned in that posts.
I see signals on DI, CLK, SELECT and DO), which are 3.3V conform. I have added a 0,33uf Capacitor to the SD Card powerpins, since there was a significant voltage drop on Vdd during SD Card access.
Still errors -41 and -13.
I used SD-cards: 128MB,256MB( dead,,but this was the only card which got to Directory detected and showed me the contents of my card, and even a file called „newfilex.txt“,which however couldn´t be rcognized by WindowsXP)and 3 1GB cards, which resulted in the same errors.
The wires on my SD-board are in average appr. 1 inch , the longest is appr. 2 inches.
CLK looks very good : some 8 or 9 pulse trains
DI: a somewhat strange signal , too short to analyze with my 20 MHz osciloscope, at least a 10 to 20% positive overshoot detectabel
SEL: a relative long negative pulse
DO: some negative pulses
René
I'm a little surprised about your "significant voltage drop during SD card access"; I don't think that should be happening.
That sounds like, maybe, you've got an output hooked up to an output somewhere, or there's a short somewhere.
Did you format your cards in FAT16? But actually, if the cards are FAT32 you should be getting a -20 error.
How about a photo of your setup? Maybe we can spot something. Failing that, you're just going to have to
struggle on. Frankly the signals you describe sound all good.
if there is a problem inside my SD card socket, i have no possibilty to verify it, since i have no access to the card pins. On the card socket pins i see the signals as mentioned. I have verified connections from the card pins solder connections inside the SD card socket to my external soldering,they were ok.
Since in Germany i can only get the same type of SD Card Adapter, i need to order one abroad in the USA,
which will cost me (there was a link for a propeller-ready module in the range of appr. USD$12, but i can not find it anymore). However, with USPS charges of US$ 39 (that will taken into accound for the customs value) and german custom charges of 19% ( they charge on shipping too),i will end up with more than 60 bucks.
That results in ----> need to find my problem
regards, Ren
I finally found the problem. Vdd wasn´t connected inside the SD card holder. This card holder is an SMD-type with the SMD contacts in the center of the card slot ( so i think, it can only be soldered with hot air).
So i had to bend the contacts, in order to get them to a thru-hole mount board solder side(we call this a piece of a euro card board, actually it has 1/10 inch spaced solder pads ).
2 pins broke during bending , so i had to solder wires from the boards solder side to the SD card holder pins.
When i added the 0,33 uf between Vdd and Vss (due to noise problems on Vdd) the wire to the Vdd pin inside the card socket got desoldered.
Without the capacitor i sometimes had success to get up to the point, that „newfilex.txt“ got created , but was not readable by WINXP (probably errors due to +/- 0,5 Volts noise on Vdd, with the cap it was reduced to around 50mV).
So SD card access is now working (128MB, 256 is dead by applying incorrect voltages , 1 GB SD cards work).
Still open is
- german keyboard support
- mouse doesn´t work (data in has output from propeller)
- can´t get VGA 512*384 bitmap demo to work (unsupported frame rate)
but that will be subject to other threads.
René
Post Edited (propelleruser999) : 2/10/2008 5:07:18 PM GMT
I finally found the problem. Vdd wasn´t connected inside the SD card holder. This card holder is an SMD-type with the SMD contacts in the center of the card slot ( so i think, it can only be soldered with hot air).
So i had to bend the contacts, in order to get them to a thru-hole mount board solder side.
2 pins broke during bending , so i had to solder wires from the boards solder side to the SD card holder pins.
When i added the 0,33 uf between Vdd and Vss (due to noise problems on Vdd) the wire to the Vdd pin inside the card socket got desoldered.
Without the capacitor i sometimes had success to get up to the point, that „newfilex.txt“ got created , but was not readable by WINXP (probably errors due to +/- 0,5 Volts noise on Vdd, with the cap it was reduced to around 50mV).
So SD card access is now working (128MB, 256 is dead by applying incorrect voltages , 1 GB SD cards work).
Still open is
- german keyboard support
- mouse doesn´t work (data in has output from propeller)
- can´t get VGA 512*384 bitmap demo to work (unsupported frame rate)
but that will be subject to other threads.
René