PDA

View Full Version : SDFS3 SD Card File System Errors



mityeltu
- 27th September 2017, 13:42
I have been struggling for a LOOOONGG time to get a working SD Card file system running. I have tried MPLABX with both PICC18 and XC8 (I hate that software) to no avail. I have tried Sourceboost BoostC++, also to no avail. I found SDFS3 and thought my problems might be over. Not so lucky it seems.

I have the 18F4550 with 20MHz crystal as specified in the file. I am NOT using the level shifters. I am running everything from 3.3V regulator LM1117T. I have the UART working fine. I have the SD card setup the best I can with what I know. The program runs but shows the following when the card is trying to initialize: "Init: 6 1 255"

At this point the program stops as it has encountered FAT Error (presumably Fatal Error) 6. I have no idea what that means, and can't find anything on the net that gives me a clue. Does anyone know?

A problem I MIGHT be having is with the SD card connections. I do not have an SD card slot, so I have taken the libery of using connectors to each of the "pins" on the SD card. I have the normal pinout for the SD card showing that there are only 9 "pins", so I had to do some research to find that the referenced 10, 11, and 12 pins are switches on the sd card slot used for making sure the card is in position and is not write protected.

OK, it looks like the code never uses the write protect or card detect features, so I may not need them anyway. However, since I do not have access to all 12 "pins" listed on the schematic, I did not originally have the 10k pull-up resistors on pins 8 an 9. I added them and the UART output changed to "Init: 6 3 1"

I have no real idea what I'm doing here. Can anyone help me, please?

mpgmike
- 27th September 2017, 15:22
Boy did you get my attention! I have a project sitting on the shelf that is supposed to data log and store data on an SD card. I can't get it working either. However, I'm posting what I was working with for the FAT16 SD cards (2 GB or less).

8466

8467

The ZIP came from Microchip. The .bas is an include file I think put together by Daryl Taylor that essentially converted Microchip's C code to PBP Basic. This is what I've been fighting with. I'll be following along the bouncing ball on this one.

mityeltu
- 27th September 2017, 16:24
Thanks, I'll look at it in a bit.

I've tried using Microchip's stuff in the past. Frankly, I'd rather be set on fire. I can never get their stuff to work right.

HenrikOlsson
- 27th September 2017, 17:26
For a basic logging application where all you want to do it write data to an SD-card I'd suggest you take a look at the OpenLog project. It originates from Sparkfun (and they're selling it) but you can find it on EBAY for a couple of bucks. Stick an micro SD card in the socket, connect it to the PIC and throw ASCII data it at 9600 baud (default setting) and it just writes it to a text file. You can set it up to either append data to an existing file or create a new file each time it boots. There are provisions for Reading files as well but I have not tried it and I don't know how userfriendly it would be to do with a PBP.

With that said, I'd love to get an SD card working for reading/writing so I can possible do a SD-card bootloader etc.

mityeltu
- 27th September 2017, 18:43
I have one of the OpenLog cards. It works well, but I want to use a full size SD card and have it run either from my native code or at worst, a pic18f. You're right thoguh, it works well and will work for my current application. I just want something different (full size sd card, or maybe thumb drive). Either way, I would also like to understand how all this works, and right now I'm drowning.

J. Mark Wolf
- 3rd October 2017, 13:04
I don't know if you're aware of the uMMC from Rogue Robotics (see link below). They're kinda pricey but they might save your hair.

https://roguerobotics.com/products/ummc

Also, check out the link below for thumb drive interface;

http://www.futureelectronics.com/en/technologies/development-tools/development-tool-hardware/Pages/2744712-VDRIVE2.aspx?IM=0

mityeltu
- 4th October 2017, 11:21
Yeah, that uMMC is a bit on the "way over my budget" side of things. BUT... the Vdrive looks promising. Thank you for the info. I would llike to be able to do this for myself, but at this point, maybe it's a "who cares" moment and I should just cut my losses.

Thanks again.

J. Mark Wolf
- 4th October 2017, 20:31
I would llike to be able to do this for myself, but at this point, maybe it's a "who cares" moment and I should just cut my losses.

Thanks again.

Been there, done that! :)

Art
- 12th October 2017, 13:29
Microchip’s MDDFS works flawlessly (albeit slow compared with Chan’s FatFS),
but it’s written in C, and meant to be compiled with one of MC’s C compilers.
It beats me how Darrel could have used it with BASIC without converting the whole library.

Older versions of this library also suffer some serious bugs, and don’t support SDHC until later on.

mackrackit
- 22nd October 2017, 01:36
Taylor did not write SDFS.bas for the record, I believe it was Jeff Schmoyer from MeLabs.

Anyway, here is an old example that might help.
http://www.picbasic.co.uk/forum/content.php?r=272-USB-SD-LOGGING