+ Post New Thread
Results 1 to 5 of 5
  1. #1
    Newbie level 5
    Points: 139, Level: 1

    Join Date
    Jun 2017
    Posts
    9
    Helped
    0 / 0
    Points
    139
    Level
    1

    SD card using FAT file and File i/o libraries

    Hello,

    I am interfacing SD card on ARM: LPC3250, I am able to read write single sector.Now i am trying FAT16 with 2GB card.

    PROBLEM: I googled, getting FAT library without application I/o (I mean without File operation File_open, File_read etc..) libraries. I tried few FAT16 library it is pointing to dummy file operation definition or through SPI(I am not using SPI).

    Please suggest any links to FAT with file operation libraries/ open source code.

    Thanks,

    •   Alt13th September 2017, 14:46

      advertising

        
       

  2. #2
    Advanced Member level 4
    Points: 8,031, Level: 21
    Easyrider83's Avatar
    Join Date
    Oct 2011
    Location
    Tallinn, Estonia
    Posts
    1,439
    Helped
    330 / 330
    Points
    8,031
    Level
    21

    Re: SD card using FAT file and File i/o libraries

    Love me or hate me. All infractions will be ignored.


    1 members found this post helpful.

    •   Alt13th September 2017, 15:22

      advertising

        
       

  3. #3
    Newbie level 4
    Points: 89, Level: 1

    Join Date
    Jul 2017
    Posts
    6
    Helped
    1 / 1
    Points
    89
    Level
    1

    Re: SD card using FAT file and File i/o libraries

    Chan's FatFs library is definitely the best option.



    •   Alt15th September 2017, 20:27

      advertising

        
       

  4. #4
    Newbie level 5
    Points: 139, Level: 1

    Join Date
    Jun 2017
    Posts
    9
    Helped
    0 / 0
    Points
    139
    Level
    1

    Files in SD card getting deleted after write single block

    Hello All,

    I am interfacing SD card on ARM: LPC3250, I am able to read write single sector.Now i am trying FAT16 with 2GB card using Chan's FatFs library.

    I read 512 bytes from Doc1.txt and trying to overwrite 512 bytes of Doc2.txt.

    Problem is after writing i am facing below issue:
    1) Some times file in SD card deleted.
    2) It asking for SD card format.
    3) Not responding to command deselect or put card to to Idle.

    When i open SD card in hexa editor data is written but root directory size of file is not updated and MBR is replaced by BOOT Sector.

    Code snippet below and attached the files i am working. Please suggest what am i missing .
    Code:
    void c_entry(void)
    {
    	
     ............
    
    	/* Read Doc1.txt */
    	str_copy(&pFileName,"Doc1.txt");
    
    	f_mount (fs, "", 0);        
    	retres = f_open(&filp,pFileName, FA_READ);
    
    	if(retres == FR_OK)
    	{
    		f_read(&filp,pbuff,512,&bytesread);
    	}
    
    	/* write Doc2.txt */
    	str_copy(&pFileName,"Doc2.txt");
    	bytesread = 0;
    
    	retres = f_open(&filpw,pFileName, (FA_READ | FA_WRITE));
    
    	if(retres == FR_OK)
    	{
    		f_write(&filpw,pbuff,512,&bytesread);
    	}
    	retres = f_close(&filp);
    	retres = f_close(&filpw);
    
    	/* Deselect card */
    	sdmmc_cmd_send(SDMMC_SELECT_CARD, 0, &resp);
    
    	/* Place card into idle to shut it down */
    	sdmmc_cmd_send(SDMMC_IDLE, 0, &resp);
    
    	sdmmc_close();
    
    	/* Enable SDMMC power */
    	phy3250_sdpower_enable(FALSE);
    
    	/* Disable interrupts in ARM core */
    	disable_irq_fiq();
    }
    Last edited by FvM; 30th October 2017 at 08:34. Reason: Merged with previous SD-Card thread



  5. #5
    Newbie level 5
    Points: 139, Level: 1

    Join Date
    Jun 2017
    Posts
    9
    Helped
    0 / 0
    Points
    139
    Level
    1

    Read and write from SD card using DMA Controller

    Hello,

    I have interfaced SD-CARD with ARM-LPC Raw read and write working well with FAT. Now I want introduce DMA for read and write to avoid CPU.

    Please suggest how to read and write from SD card using DMA Controller.

    Thanks



--[[ ]]--