/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / File quantity limit???

Username:     
Password:     
             

Forum

# 1   2009-09-30 23:56:15 File quantity limit???

logictechs
Member
Registered: 2009-05-07
Posts: 68

File quantity limit???

Have a weird problem now with my Primer2.  I've upgraded the OS to V3.8 and Ride to the latest 9/15 release.  I have three programs that need to write binary files.  It checks to see if the file exists and if so seeks to the end and appends data.  If the file is not found, a new one is created.  Each are named different.  When I run each program, it creates and retains the first file but when I run the 3rd program the second one created is replaced with the 3rd file.  If I run the 2nd program, the 3rd program is replaced with the file created with the 2nd program.  For example:

Program 1 creates file name ABCD.BIN.

Program 2 creates file name EFGH.BIN.

Program 3 creates file name IJKL.BIN but EFGH.BIN gets deleted.

Anyone experiencing this problem?  Any ideas what I'm doing wrong?  Each program creates the files using the same code except for the name.  SD is initialized the same way also.

Here's the code:

cr = FS_OK;
    u32  successcount;
    u8 NumFile = 1;
    char str[20];   
    NVIC_InitTypeDef NVIC_InitStructure;

    NVIC_InitStructure.NVIC_IRQChannel = SDIO_IRQChannel;
      NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
      NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
      NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
      NVIC_Init(&NVIC_InitStructure);

    // mount MMCSD
    StartMBR=FS_Mount(MMCSD_SDIO);
    if (StartMBR == 0xFFFFFFFF)
        {
        DRAW_Puts("\n No SDCARD");
       
        }

    // Open volume on first partition (0)
    if (FS_GetVolumeInfo(0, StartMBR, &volume_info))
        {
        DRAW_Puts("\nErr: GetVolInfo");
       
        }

    // Open root directory
    if (FS_OpenDirectory(&volume_info, "", &directory_info))
       {
       DRAW_Puts("\nErr: Open Root");
       
       }

    // Open new file
    memset((void *) &file_info, 0, sizeof(file_info));


cr = FS_OpenFile(&volume_info, "ABCD.BIN", FS_WRITE, &file_info);
if(file_info.filelen != 0)
    {
        FS_Seek(&file_info, file_info.filelen + 1 );   
    }

Any help would be greatly appreciated!  Thanks!

Offline

 

# 2   2009-10-05 20:54:00 File quantity limit???

logictechs
Member
Registered: 2009-05-07
Posts: 68

Re: File quantity limit???

Disregard my problem.  Not sure what I did but it is working correctly now.

Is there a way to increase the name length of files?  I would like to have a 16 character file name length with the normal 3 character extension. 

Example:  ABCDEFGHIJKLMNOP.TXT

Offline

 

# 3   2009-10-09 11:59:47 File quantity limit???

wex
New member
Registered: 2009-09-21
Posts: 3

Re: File quantity limit???

Hello Logictechs,

I'm having the same problem as you were having and it will be very appreciated if you would tell me what you have done which would have probably killed the bug. Thanks! Wex

Offline

 

# 4   2009-10-09 12:44:38 File quantity limit???

logictechs
Member
Registered: 2009-05-07
Posts: 68

Re: File quantity limit???

Only suggestion I have is to have the file names very different than each other.  I had the first 4 characters the same in the file names then changed them and that corrected my problem.

Example: 

CHARA.BIN and CHARB.BIN will likely cause the problem.
AKARA.BIN AND CHARB.BIN will not.

Problem only seemed to occur when I made a third file that was similar to the second.  The second file was deleted and replaced by the third file.

Offline

 

# 5   2009-10-09 13:20:55 File quantity limit???

wex
New member
Registered: 2009-09-21
Posts: 3

Re: File quantity limit???

I have tried it out. I wrote a second file with the name "61927.txt" and then a third file with the name "76376.txt" which I think is quite different from the second file's name, but the second file was nevertheless deleted. But thanks any way! Any ideas or suggestions are appreciated!

Offline

 

# 6   2009-10-09 16:55:11 File quantity limit???

logictechs
Member
Registered: 2009-05-07
Posts: 68

Re: File quantity limit???

Ok.  Try putting different letters at the beginning then numbers.  I was using 2 letters and then 4 numbers and it was causing the problem.  I resorted to having 4 letters of different values then 2 numbers. 

Example:  ABCD00.BIN and ABCD01.BIN then EFGH00.BIN

Having numbers only for the file name caused weird things to happen.

Offline

 

# 7   2010-01-23 19:37:55 File quantity limit???

logictechs
Member
Registered: 2009-05-07
Posts: 68

Re: File quantity limit???

Ok, I've finally overcome the file writing problem again hopefully.  I am now faced with the file quantity limit problem again.  This time it happens when I try to write a 4th file.  There seems to be a limit of 3 files now before the FAT gets corrupted or something.  My file names are like the following:

ABCDE01.TXT
ABCDE02.TXT
ABCDE03.TXT

When I open and write to a file then called ABCDE04.TXT, ABCDE03.TXT gets turned into ABCDE04.TXT.

In order to write any file and have it actually accessable by Windows afterwards, I need to have at least one file on the SD card.  It must not be of zero length.  I've been putting a PDF file on the card in Windows after formatting in FAT16 to overcome this.  It disappears though when I write a 4th file to the card in my Primer2 application though.

Has anyone figured this problem out yet?

Offline

 

Board footer