Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

SD Card Help!!

Status
Not open for further replies.

Tech350

New Member
Hello,

I'm new to this site and this is my first post. I'm using a PIC18F8520 controller. I'v started a SD card project where I format the SD card in FAT16/FAT32 format and write a "test.txt" file from my desktop and try to initialize, read and write to the SD card from my controller. I have a blurry code and I'm able to detect the card and check if it is FAT formatted successfully, but I'm not able to read the file "test.txt". I'm not very happy with my code as it seems complex, so if any code, advice, hints, etc. please help. Waiting for a reply. Thanks in advance:)

Best Regards.
 
Last edited:
How big is the file? is it tiny enough to fit within a single SD block?

Have you verified that the file that has been written (by the uC) is ok?

Is this your own FAT libraries or some of the freebie ones?


Notice all the questions? it's because you haven't supplied a lot of detail.

Can we see a bit of your code?
 
Hi UTMonkey, thanks for the reply.

The file is close to 0kb so I'm guessing that shouldn't be a problem.

I still have not tried writing from the uC yet, just trying to read from the SD card as of now.

I'm not using any FAT libraries as such. Written a code to check if the SD card is FAT formatted thats all. I'm doing this by reading the first cluster of the SD card using the 'SD_READ_BLOCK' command and storing it in an array. If FAT formatted, the values 'F','A','T','1','16' will be stored in particular locations of the array. Thats how I know if it is FAT formatted.

I'm sorry I don't have access to my code as of now. Will update the code ASAP.

The main problem as of now is reading a file from the SD. I still haven't tried writing a file, so will try the same and update the result.

Best regards.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top