Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#7 Hang in file_fopen()

closed-fixed
nobody
None
5
2006-03-15
2006-03-09
Mike Anton
No

This is really a followup to the file_fopen() hang
issue first reported by nocciolone.

I am currently using EFSL 0.2.6 with the LPC SD card
support, on an Olimex LPC-P2148 demo board.

After using the EFSL library for a bit, I have run
into a major snag. I am using ls_openDir() and ls_next
() to run through a large directory of MP3 files on a
1GB SD card. When a file is found, an attempt is made
to open it, and if successful, close it. Usually
file_fopen() will fail on opening the 36th file. I can
extend this somewhat by increasing IOMAN_NUMBUFFER.
If I change IOMAN_NUMBUFFER from 6 to 16, I can
usually get to the 80th file before a hang.

My testing indicates that file_fopen() hangs in the
call to dir_findinCluster() because ioman_getSector()
returns an IOMAN_ERR_NOMEMORY error. I'm not sure why
this occurs yet, but I'm still working on it.

Other than this issue, I've been successful in getting
files to play, if I can open them. I haven't tried
writing yet.

For interest sake, I am getting about 360KB/s transfer
rates on this ARM7 running at 60MHz.

I've attached my code, so that you can try this.

Thanks,

Mike

Discussion

  • Mike Anton
    Mike Anton
    2006-03-09

    file_fopen() test code

     
    Attachments
  • Mike Anton
    Mike Anton
    2006-03-10

    • status: open --> open-fixed
     
  • Mike Anton
    Mike Anton
    2006-03-10

    Logged In: YES
    user_id=1471492

    I have found out how to fix this issue.

    The real problem can be found in dir_findinCluster() which
    has an IOMGR memory leak. The part_relSect() function
    needs to be called inside the for loop, rather than outside
    it. Just move the part_relSect() call at the end of the
    routine to inside the braces.

    If more sectors than one need to be read from the cluster,
    then only the last one fetched will actually be released.
    Eventually the ioman_getSector() function will be unable to
    find a free sector in the cache, and return an out of
    memory error, then all hell breaks loose.

    I hope you will integrate this fix into the stable and
    unstable branches, especially since it is easy to do.

    Thanks for creating a fairly stable and useful library. It
    has saved me a great deal of work, and I'm more than happy
    to help in finding the bugs...

    Thanks,

    Mike

     
  • Logged In: NO

    Hei Mike

    Can you send me the driver low level function for the
    LPC2000. I redesign the driver but I would like to compare
    your implementation with mine.

    For your info I'm not the designer of the EFSL, so I can't
    integrate the fix to solve the problem.

    Thank you

     
  • Mike Anton
    Mike Anton
    2006-03-14

    Logged In: YES
    user_id=1471492

    The driver code I used for the LPC2000 is already included
    in EFSL build 0.2.6. I didn't have to do very much to make
    it work, other than copy the conf/config-sample-lpc2000.h
    to a conf/config.h file, and make sure the settings were
    what I wanted.

    Hopefully, this is what you wanted,

    Mike

     
  • Lennart
    Lennart
    2006-03-14

    Logged In: YES
    user_id=1223110

    Fixed in 0.2.7

    Thanks Mike!

     
  • Lennart
    Lennart
    2006-03-15

    • status: open-fixed --> closed-fixed