|
|
View previous topic :: View next topic |
Author |
Message |
farouk_baya
Joined: 18 Jun 2010 Posts: 27
|
MMC code problem |
Posted: Sat Feb 22, 2014 4:03 am |
|
|
Hello,
I'm working actually on a project using an SD card FAT32.
I'm using ISIS Proteus 7.8 SP2 and I'm using PIC C 5.007.
The problem is that the fat_init() returs always 0.
Code: | #include <18F2550.h>
#device PASS_STRINGS = IN_RAM
#fuses NOWDT, HS, NOPROTECT
#use delay(clock=20M)
#use rs232(baud=9600, UART1, errors)
#include <stdlib.h> // for atoi32
//media library, a compatable media library is required for FAT.
// SPI master PIN configuration
#use fast_io(c)
#define MMCSD_PIN_SCL PIN_B1 //o
#define MMCSD_PIN_SDI PIN_B0 //i
#define MMCSD_PIN_SDO PIN_C7 //o
#define MMCSD_PIN_SELECT PIN_C0 //o
#include <mmcsd.c>
//FAT library.
#include <fat.c>
void main(void)
{
int i; // pointer to the buffer
printf("\r\n --------------");
printf("\r\n Program begin");
printf("\r\n --------------");
printf("\r\n ");
// initialize the FAT
// keep in mind that this will automatically initialize the media
i = fat_init();
if (i)
printf("\r\n\nERROR INITIALIZING FAT\r\n\n");
// main loop
while(TRUE)
{
}
} |
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19544
|
|
Posted: Sat Feb 22, 2014 4:19 am |
|
|
How are you converting the voltage levels between the PIC, and the SD card?.
This is the oldest, commonest problem....
The PIC2550 is a basically 5v device (it can operate down to 4.2v minimum). The SD card is 3.3v. The PIC SDI input, requires the signal to go up to at least 0.8*Vdd to be seen as '1' (4v with the 5v PIC). The SD card only guarantees to produce 2.475v for Voh (with a 3.3v supply). Result, PIC can't see the signal.....
You need to either be using a 3.3v PIC (best solution), or have proper buffers between the chips. Look at the 'ethernet reference design' on the Brush Electronics site:
<http://www.brushelectronics.com/index.php?page=projects>
Which shows using a logic chip as a buffer.
5.007, is a little 'borderline' for V5, A slightly later version, or 4.141, is generally more reliable. Also look in the code library, for the fixes to handle MBR operation with the CCS drivers (and fix one long standing error). These are 'needed'. |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Sat Feb 22, 2014 7:15 am |
|
|
Quote: | I'm using ISIS Proteus 7.8 SP2 and I'm using PIC C 5.007 |
_________________ Google and Forum Search are some of your best tools!!!! |
|
|
|
|
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
|