/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / SD card write size limitation

Username:     
Password:     
             

Forum

# 1   2010-12-22 11:10:40 SD card write size limitation

xuwa0800
Member
From: Sweden
Registered: 2010-05-20
Posts: 27

SD card write size limitation

Hej!

I have a problem with SD card in OS3.7.
i try to write something in sd card, but when the created txt size goes to 32kb, it will fail, and can not return to the main window.

I know there are update for SD file system in OS4.1, so i try the same code in OS4.1, it works quite fine, no size limitation! but since i still have a problem described in post http://www.stm32circle.com/forum/viewtopic.php?id=1294, i can not just switch to OS4.1 right now.

Can someone tell me what have changed for the sd filesystem in OS4.1. in the code i have used 32-bit aligned buffer(not sure if i use it right)


Code:

union TUnionTag
{
    u8                Buf[13];
    unsigned int  i; // force 32-bit int alignment
} SD_Test;



/****************************Initialization*****************************/
enum MENU_code Application_Ini ( void )
{
    u8 i;
   
    for(i=1;i<12;i++)
        SD_Test.Buf[i-1]='a';
    
    SD_Test.Buf[11]=0x0d;
    SD_Test.Buf[12]=0x0a;
    

   StartMBR=FS_Mount(MMCSD_SDIO);

   if (StartMBR == 0xFFFFFFFF)
   {
      DRAW_DisplayString(20,100,"No SDCARD",19);
   }

   if (FS_GetVolumeInfo(0, StartMBR, &volume_info))
   {
     DRAW_DisplayString(20,100,"\nErr: GetVolInfo",19);
   }

   if (FS_OpenDirectory(&volume_info, "", &directory_info))
   {
      DRAW_DisplayString(20,100,"\nErr: Open Root",19);
   }

   if(FS_OpenFile(&volume_info, "Data.txt", FS_WRITE, &file_info))
   {
      DRAW_DisplayString(20,100,"No File",19);
   }

    if(FS_OpenFile(&volume_info, "Data.txt", FS_WRITE, &file_info))
    {
        DRAW_DisplayString(20,100,"No File",19);
    }
   FS_Seek(&file_info, (file_info.filelen));

   return MENU_CONTINUE_COMMAND;
}



enum MENU_code Application_Handler ( void )
{
                           
    FS_WriteFile(&file_info,SD_Test.Buf, &successcount,13);
        

   if ( BUTTON_GetState() == BUTTON_PUSHED ) //wheather joystick is pressed or not 
   {
    FS_Close(&file_info);
    FS_Unmount(MMCSD_SDIO);
 
    BUTTON_WaitForRelease();
    return MENU_Quit();
   }
   return MENU_CONTINUE;
}

Last edited by xuwa0800 (2010-12-22 11:14:14)


/Wang

Offline

 

# 2   2010-12-22 20:52:48 SD card write size limitation

xuwa0800
Member
From: Sweden
Registered: 2010-05-20
Posts: 27

Re: SD card write size limitation

the code works quite fine in OS3.82!


/Wang

Offline

 

Board footer