CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Help-ex_fat.

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
kideltn



Joined: 08 Jun 2010
Posts: 13

View user's profile Send private message Yahoo Messenger

Help-ex_fat.
PostPosted: Tue Jun 08, 2010 9:05 pm     Reply with quote

I simulated in Proteus but not with success.
I am trying this problem very much but have not solved it.
Here is my schematic Proteus:
Virtual sd card has formated FAT16

In main.c (I just modifed ex_fat.c in fuse to fit my simulation), fuses:
Code:

#include <18F6722.h>
#device PASS_STRINGS = IN_RAM
#fuses NOWDT, HS, NOPROTECT,NOMCLR,NODEBUG
#use delay(clock=10M)
#use rs232(baud=9600,parity=N,xmit=PIN_D0,rcv=PIN_D1,bits=8)
#include <stdlib.h> // for atoi32
#use fast_io(c)
#define MMCSD_PIN_SCL     PIN_C3 //o
#define MMCSD_PIN_SDI     PIN_C4 //i
#define MMCSD_PIN_SDO     PIN_C5 //o
#define MMCSD_PIN_SELECT  PIN_C2 //o
#include <mmcsd.c>
#include <fat.c>

In fat.c, I defined FAT16.

When I run simulation, TERMINAL (in Proteus) show: ERROR INITIALIZING FAT
Please help me solve it !
Thanks alot !
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jun 08, 2010 9:14 pm     Reply with quote

The data lines (SDO and SDI) are connected incorrectly. You have them
swapped. Look at the schematic in this thread to see the correct way:
http://pic-c.ccsinfo.com/forum/viewtopic.php?p=76808
kideltn



Joined: 08 Jun 2010
Posts: 13

View user's profile Send private message Yahoo Messenger

PostPosted: Thu Jun 10, 2010 9:30 am     Reply with quote

Thank a lot !
But still not working.
Detail, when I swapped the pin, then run the simulation, the command
line appear (mean fat_init() success), however, when I type any
command to operate with Virtual SD card all fail.
Example: type "mkdir abc" on VirtualTerminal, the message appear:
"Making directory '/abc' :"(if success,words "OK" will show) and the
simulation stop working.
I spend alot time in reseaching but not ok. Please help me!
Thanks you very much !
My simulation:
http://www.mediafire.com/file/jutwwztmde4/CCSMassStorage.rar
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 10, 2010 12:33 pm     Reply with quote

I don't have Proteus so I can't help any more on this.
kideltn



Joined: 08 Jun 2010
Posts: 13

View user's profile Send private message Yahoo Messenger

PostPosted: Thu Jun 10, 2010 12:54 pm     Reply with quote

Excuse!
Do you think with above code, when I make a real circuit it will work ?
Thanks alot !
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Thu Jun 10, 2010 5:42 pm     Reply with quote

kideltn wrote:
Excuse!
Do you think with above code, when I make a real circuit it will work ?
Thanks alot !


No. It will destroy the SD/MMC card. These cards run from 2.7 to 3.3 volts and the PIC you are using runs from +5V nominal. You need a regulator for the 3.3volt supply that is capable of delivering 100mA peak currents (very small duration) to the card and you need level conversion logic between the PIC and the card. You also need to put power supply filtering and power supply decoupling capacitors for the 3.3 volt supply as close to the SD socket as practical.

The design would be simpler if you used a 3.3 volt PIC but for most 18F series PIC this would imply you would not be running the PIC at maximum frequency. You could move to a PIC24 (3.3 volts).

You can find several reference designs on my site on the project page demonstrating ways of integrating these cards with +5V PICs.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group