SD card does not initialize


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2014
    Posts
    1

    Default SD card does not initialize

    i am running a simple code that is supposed to create a txt file on sd card and write a line in it. My code starts from initializing command. i checked the return value. and the card does not initialize. what do i do now??? what can be the possible reasons for this???
    please help.
    Just for information i am using 8gb sd card. if it has anything to do with it. My code now is as follows
    My code is as follows

    i checked the return value. and yes the card does not initialize. what do i do now??? what can be the possible reasons for this???
    please help.
    Just for information i am using 8gb sd card. if it has anything to do with it. My code now is as follows
    My code is as follows

    void delay (unsigned int k)
    for (i=0;i<=k;i++)
    {
    ;
    }
    void main(void)
    {
    FSFILE *MyFile;
    unsigned char txt[ ]="This is a TEXT message";
    TRISB=0;
    //
    // Initialize the SD card routines
    //
    FSInit( );
    if (FSInit()!=TRUE)
    {PORTB=0xFF;
    delay(10000);
    PORTB=0x0;
    delay(10000);
    }
    //
    // Create a new file called MESSAGE.TXT
    //
    MyFile = FSfopenpgm("MESSAGE.TXT", "w+");
    //
    // Write message to the file
    //
    FSfwrite(txt, 1, 22, MyFile);
    // Close the file
    //
    FSfclose(MyFile);
    while(1);
    }

    When i run the code, the portb leds blink. which means the sd card does not initialize.
    Attached Files Attached Files
    Last edited by bushratariq; - 21st August 2014 at 12:27.

  2. #2
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: SD card does not initialize

    This is "C". Maybe you should check one of those Arduino forums or Microchip forums depending on which processor you are using.
    Dave Purola,
    N8NTA
    EN82fn

Similar Threads

  1. Do you have to initialize an on-Screen Display module?
    By Ramius in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 28th April 2011, 01:53
  2. PortB pins will not initialize LOW, only HIGH?
    By ronbowalker in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 8th December 2009, 20:27
  3. Replies: 2
    Last Post: - 27th May 2008, 16:49
  4. HOW do you initialize PortC to normal I/O??
    By Len in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 11th June 2005, 19:56
  5. SD-Card
    By glaubertadeu in forum General
    Replies: 1
    Last Post: - 27th April 2005, 15:57

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts