View previous topic :: View next topic |
Author |
Message |
kideltn
Joined: 08 Jun 2010 Posts: 13
|
Help-ex_fat. |
Posted: Tue Jun 08, 2010 9:05 pm |
|
|
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 ! |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
![](templates/subSilver/images/spacer.gif) |
kideltn
Joined: 08 Jun 2010 Posts: 13
|
|
Posted: Thu Jun 10, 2010 9:30 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jun 10, 2010 12:33 pm |
|
|
I don't have Proteus so I can't help any more on this. |
|
![](templates/subSilver/images/spacer.gif) |
kideltn
Joined: 08 Jun 2010 Posts: 13
|
|
Posted: Thu Jun 10, 2010 12:54 pm |
|
|
Excuse!
Do you think with above code, when I make a real circuit it will work ?
Thanks alot ! |
|
![](templates/subSilver/images/spacer.gif) |
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Thu Jun 10, 2010 5:42 pm |
|
|
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!! |
|
![](templates/subSilver/images/spacer.gif) |
|