MicroSD Cards and SDFS


Closed Thread
Results 1 to 34 of 34

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    704


    Did you find this post helpful? Yes | No

    Default

    Hi,

    I will use the SPI mode for the SDFS as you guys suggested. I've already ordered my MicroSD socket from mouser. So, I will keep you posted if I get it to work or not.

    About all the extra pins that the MicroSD card doesn't use like the WP, I guess that I can comment out these lines of code that I don't need in the SDFS program. I'm going to have to study this SDFS code to see how it works.

    Robert

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    When not using Write Protect do a search through SDFS for "SD_WE" and comment out anything to do with it. It only shows up in about 6 places.
    Comment this
    Code:
    SD_WE_TRIS = 1
    And all occurrences of this
    Code:
    If (SD_WE) Then
            FAT_error = CE_WRITE_PROTECTED
            Return        ' Return Byte FAT_error.
        Endif
    The PIC® pin assignments will look something like this
    Code:
    SDI        Var    PORTB.2    ' SPI data in SD #7
    SDI_TRIS    Var    TRISB.2    ' SPI data in direction
    SCL        Var    PORTB.1    ' SPI clock  SD #5
    SCL_TRIS    Var    TRISB.1    ' SPI clock direction
    SD_CS        Var    PORTB.3    ' SD card chip select SD #1
    SD_CS_TRIS    Var    TRISB.3    ' SD card chip select direction
    SD_CD        Var    PORTB.4    ' SD card detect
    SD_CD_TRIS    Var    TRISB.4    ' SD card detect direction
    SDO        Var    PORTC.7    ' SPI data out   SD #2
    SDO_TRIS    Var    TRISC.7    ' SPI data out direction
    If you are not using the hardware SPI from the PIC® and need to use other pins put this in your code
    Code:
    SDC_UseHardSPI = FALSE
    If you run into problems let us know.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    704


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    If you run into problems let us know.
    Thank you. As soon as I get the parts, I will start playing with the SDFS and the MicroSD card. I am sure I will have some questions.

    Robert

  4. #4
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    704


    Did you find this post helpful? Yes | No

    Default FAT16 and Windows XP

    Hi,

    I finally got the parts that I needed and started playing with SDFS. Since I'm running my 18F4550 at 3.3V I connected all the MicroSD card pins directly to the PIC. I did not install the 10k resistors since my configuration is a little bit different. Do I need to use these 10K resistors?

    I ran the SDTEST.BAS and it worked. It created a file TEST1.TXT with the text "ABC". I could see the file in my cell phone that runs Windows Mobile 6.1. Now, I can't read this card in my Windows XP PC. Somehow, XP does not like FAT16 format in the SD cards. How do you read your SD files in your computer? Is there any work around for this? I don't want to install Win98 in one of my old computers just for this .

    Robert

  5. #5
    Join Date
    Oct 2004
    Posts
    440


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by rsocor01 View Post
    Now, I can't read this card in my Windows XP PC. Somehow, XP does not like FAT16 format in the SD cards. How do you read your SD files in your computer? Is there any work around for this? I don't want to install Win98 in one of my old computers just for this .

    Robert
    Try formatting the card with XP using right click on SD drive > format > file system FAT(FAT16).
    Be sure you have the correct drive or data loss will occur.

    Norm

  6. #6
    Join Date
    Oct 2004
    Posts
    440


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by rsocor01 View Post
    Hi,

    I finally got the parts that I needed and started playing with SDFS. Since I'm running my 18F4550 at 3.3V I connected all the MicroSD card pins directly to the PIC. I did not install the 10k resistors since my configuration is a little bit different. Do I need to use these 10K resistors?
    Robert
    I haven't seen the wiring diagram but a 10k resistor would only be required for a 5 volt PIC to
    pull up the PIC in-data line as well as others to split the PIC 5 volt lines to SD 3.3 volts.

    Norm

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Running at 3.3 volts I still pull up pins 8 and 9 on the full size SD cards, the remainder I run straight.

    Norn is correct about the formatting. I read my FAT16 cards on XP, Vista, Vista 7, and Linux. No problems.
    Dave
    Always wear safety glasses while programming.

  8. #8
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    704


    Did you find this post helpful? Yes | No

    Default

    Hi,

    Thank you guys for your help. Yes, Norm is correct about the formatting of the MicroSD card. It works .

    Quote Originally Posted by mackrackit View Post
    Running at 3.3 volts I still pull up pins 8 and 9 on the full size SD cards, the remainder I run straight.
    The breakout board that I got from sparkfun.com doesn't have the connection for the NC pad. Maybe, the resistor at NC is not necessary after all .

    http://www.sparkfun.com/commerce/pro...roducts_id=544


    Now, I have a question about SDTEST.BAS. The code to write to the card is

    Code:
    ' Write to file
    	FAT_src[0] = "A"
    	FAT_src[1] = "B"
    	FAT_src[2] = "C"
    	FAT_count = 3
    	Gosub FSfwrite
    	Serout2 PORTC.6, 84, [ "Write ", Dec FAT_error, $d, $a]
    	If (FAT_error != 0) Then Stop
    This code will write "ABC" to the card

    Code:
    ABC
    But, for data logging I need the entries in diferent lines

    Code:
    A
    B
    C
    Can you do that with SDFS? Thank you for your help.

    Robert

Members who have read this thread : 0

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