cancel
Showing results for 
Search instead for 
Did you mean: 

SPI Flash FatFs Problem

mechatronicsx
Associate II
Posted on January 21, 2016 at 08:53

Hi everyone ,

I develop FatFs file system on SST26VF016B 2MB  SPI Flash.I have done raw read/writes. I can success Fully read/write all SPI flash addresses.

My problem is i create file system and i create file but i'm not write any data on file.Because disk is full error.

I am using this define in ffconf.h

&sharpdefine    _MIN_SS        512

&sharpdefine    _MAX_SS        512

My diskio.c implementation like this,

DRESULT disk_ioctl (

    BYTE pdrv,        /* Physical drive nmuber (0..) */

    BYTE cmd,        /* Control code */

    void *buff        /* Buffer to send/receive control data */

)

{

    DRESULT res;

     uint8_t status;

     status=SST_Status();

  switch(cmd)

    {

        case CTRL_SYNC:

             if(status & 0x01)

                 res=RES_ERROR;

             else

                 res=RES_OK;

            break;

        case GET_SECTOR_COUNT:

               *(DWORD*)buff=4096;  

         res = RES_OK;  

            break;

        case GET_SECTOR_SIZE:

              *(WORD*)buff=512;              

               res = RES_OK;  

            break;

        case GET_BLOCK_SIZE:

               *(DWORD*)buff=1;            

                res = RES_OK;  

            break;

    };

    return res;

}

and

i use f_mkfs('''',0,4096);

Whats the wrong?Why i get disk_full error?

Thanks for help

Best Regards

#stm32 #fatfs #spi-flash
0 REPLIES 0