SDHC (FAT32 for SD cards)


Closed Thread
Results 1 to 23 of 23

Hybrid View

  1. #1
    Join Date
    Oct 2004
    Posts
    440


    Did you find this post helpful? Yes | No

    Default

    See PIC iPod wav player for my FAT16 SD card reader.
    Reads and plays mono CD quality (16bit 44k) or stereo 8bit 44k from SD cards.
    Utilizes multiblock for fast sequential read and play of wav data.
    Also data for Nokia GLCD pictures or scrolling menu.

    The code was written based on information from the Microchip USB framework
    and Jan Axelson's book, USB Mass Storage. Details on SD and MMC cards and
    the FAT file system can be found there.
    Does Jan's book have any insight on 4 bit Bus mode?
    I have the CRC routine worked out but haven't had success with Bus mode yet.

    Norm

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


    Did you find this post helpful? Yes | No

    Default

    More from Jeremy:::
    See PIC iPod wav player for my FAT16 SD card reader.
    Reads and plays mono CD quality (16bit 44k) or stereo 8bit 44k from SD cards.
    Utilizes multiblock for fast sequential read and play of wav data.
    Also data for Nokia GLCD pictures or scrolling menu.
    Does Jan's book have any insight on 4 bit Bus mode?
    I have the CRC routine worked out but haven't had success with Bus mode yet.
    Agreed...Multi-block transfers aren't hard to program at all, and a heck of a lot faster than the single block mode used right now.
    Problem is the PIC doesn't have the room to store much of it! Therefore, at present, it wasn't worth the time to write that code.
    When I get my hands on one of those I2C SRAM chips, I'll get on it.
    Same thing for the GLCD/menu type stuff, and decoding BMPs (easy), JPEGs (hard), etc. Not enough room to store everything.

    Don't know about Jan's book and the SD bus mode. Haven't played with that, but I've got datasheets on it, and I think I've got decent CRC5/CRC16 (?) routines laying around somewhere.
    I'm concentrating on keeping the hardware to a bare minimum for now (5 pins vs 9 pins).
    Again, when I get that I2C SRAM chip, I'll expand out the code to handle multi-block read/write/storage, SD-bus, and whatever else I can think of.

    Found the fix for the failures relating to FS_SPEED:

    In the SectorWrite subroutine (the fix is in bold 9 lines down):
    Code:
    @ ifdef FS_SPEED
                ' Write a sector's worth of data. (optimized for speed)
                if (!FAT_FSfast) then
                    For SDC_index = 0 To (MEDIA_SECTOR_SIZE - 1)
                        SDC_data_out = SDC_buffer[SDC_index] : gosub writespim    ' Write Byte SDC_data_out.
                    next SDC_index
                else    'fast clock toggler. may have to add extra SCL = 1 : SCL = 0 if running into R/M/W issues
                    for SDC_index = 0 to (MEDIA_SECTOR_SIZE - 1)
                        FAT_sdbyteout = SDC_buffer[SDC_index] : sdo = FAT_sdbyteout.7 : scl = 1 : scl = 0 : sdo = FAT_sdbyteout.6 : scl = 1
                        scl = 0 : sdo = FAT_sdbyteout.5 : scl = 1 : scl = 0 : sdo = FAT_sdbyteout.4 : scl = 1 : scl = 0
                        sdo = FAT_sdbyteout.3 : scl = 1 : scl = 0 : sdo = FAT_sdbyteout.2 : scl = 1 : scl = 0 : sdo = FAT_sdbyteout.1
                        scl = 1 : scl = 0 : sdo = FAT_sdbyteout.0 : scl = 1 : scl = 0
                    Next SDC_index
                endif
    @ endif
    Dave
    Always wear safety glasses while programming.

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