• AVR Freaks

Hot!FatFs for external SPI Flash on PIC32MM

Author
sumit809
New Member
  • Total Posts : 23
  • Reward points : 0
  • Joined: 2020/03/08 23:49:39
  • Location: 0
  • Status: offline
2020/07/01 06:14:19 (permalink)
0

FatFs for external SPI Flash on PIC32MM

Hi,
 
I'm using PIC32MM USB Curiosity board. I want to create and store a simple .pdf file in external SPI Flash(Winbond W25Q32) using MCC FATFS library. 
 
I have searched entire forum but it's all about SD card. I'm struggling to run demo code of FATfs which creates the simple .txt file. 
 
#include "ff.h"
#include "drva.h"

void FatFsDemo_Tasks(void)
{
    FATFS drive;
    FIL file;
    UINT actualLength;
    char data[] = "Hello World!";
    if( DRVA_IsMediaPresent() == false)
    {
        return;
    }

    if (f_mount(&drive,"0:",1) == FR_OK)
    {
        if (f_open(&file, "HELLO.TXT", FA_WRITE | FA_CREATE_NEW ) == FR_OK)
        {
            f_write(&file, data, sizeof(data)-1, &actualLength );
            f_close(&file);
        }

        f_mount(0,"0:",0);
    }
}

 
The f_mount returns one of the error code i.e., No file system found. Hence fails to create file.
post edited by sumit809 - 2020/07/01 06:15:54
#1

3 Replies Related Threads

    du00000001
    Just Some Member
    • Total Posts : 3840
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: FatFs for external SPI Flash on PIC32MM 2020/07/06 11:19:05 (permalink)
    0
    Looks as if you have to find out how to "format" the Winbond chip prior applying FatFs  :)
    As 8 MByte SD cards never (?) existed, this might require you to fully understand how a FatFs medium is organized. Good luck with that!

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #2
    sumit809
    New Member
    • Total Posts : 23
    • Reward points : 0
    • Joined: 2020/03/08 23:49:39
    • Location: 0
    • Status: offline
    Re: FatFs for external SPI Flash on PIC32MM 2020/07/08 03:10:31 (permalink)
    0
    Right du00000001
     
    I need to first format the Flash... And that's the challenging part...
     
    The internet is full of SD Card, and SPI Flash FatFS has very little space in it...
    Even the Microchip Official Support has said that there is no Application Note available for this, since it's tricky to create file system on NOR SPI Flash... and they suggested to use SD Card... 
     
    But we can't go for SD Card because of its cost and unnecessary extra size...
    #3
    XorLor
    Junior Member
    • Total Posts : 69
    • Reward points : 0
    • Joined: 2009/10/23 00:17:05
    • Location: 0
    • Status: offline
    Re: FatFs for external SPI Flash on PIC32MM 2020/07/08 07:47:02 (permalink)
    0
    sumit809
    I need to first format the Flash... And that's the challenging part...



    Did you try f_mkfs?
     

    int f_mkfs (uint8_t vol, uint8_t sfd, uint32_t au); /* Create a file system on the volume */

    #4
    Jump to:
    © 2020 APG vNext Commercial Version 4.5