No announcement yet.

Mounting GCI and displaying images from subfolders

  • Filter
  • Time
  • Show
Clear All
new posts

  • Mounting GCI and displaying images from subfolders

    I have a gen4-uLCD-70DT display with a 4GB uSD card formatted as FAT16. I have a large number of GCI/DAT files that I would like to store on the uSD card to be able to mount and display images. However, the FAT16 format restricts the number of files I am able to store in the root directory of the uSD.

    Is it possible to use file_Mount, file_LoadImageControl, and img_Show for GCI/DAT files that are not located in the root directory (i.e. a GCI/DAT file is located in a subdirectory of the root folder)? If so, what is the correct way to call a file from a sub directory using these commands? Is it possible to "change directory" like in a Windows or Linux command window using "cd" ?

    Thanks in advance

  • #2
    There is no folder support, it would require a lot more memory to do this without degrading performance a lot.

    It's not FAT16 that restricts the number of files in the root directory, but the way the card is formatted.

    There is a utility available MkDosFS, I think, maybe from here (the original link I had is now dead) You can use that to create a FAT16 with a root directory that can hold thousands of files, if you want to.


    • #3
      Thanks for the information. Are the specific requirements for the uSD card listed in the documentation anywhere, or will any FAT16 partition be readable by the display?


      • #4
        Any FAT16 partition will be readable by the card.

        I'm not quite sure why you need more than the max '512' files support by the standard FAT16 root directory, so perhaps a bit more information would help.

        The actual limit is more like 509 files as Windows adds a 'System Volume Information' folder that uses 3 directory entries.

        You see each 13 bytes of a long file name occupies 1 directory entry, so the above mentioned folder occupies 2 lfn entries plus 1 'actual' entry.

        Similarly creating a file 'file1.txt' occupies 2 entries, since, because it is in lower case, it is an LFN and thus needs an additional dir entry

        A file called 'FILE1.TXT' only occupies a single entry.

        It turns out that MkDosFS does not work usefully anymore. It has several problems with partition sizes and locations, so that will not help you.

        Theoretically the FAT16 root folder can hold 65520 files, if the volume was suitably formatted, unfortunately Windows does not have a 'root dir entries' parameter, so you can't format it with anything other than 512 entries.

        65520 is not practical as the max number of clusters on the disk comes into play and it's very hard to create that many files. I made a test and with the uSD I used I could only create 65492 files, but I could read all of them in both Windows and on a Display. The test uSD had 65,494 clusters, one went to the 'System Volume Information' folder, one went to the file in that folder, hence the limit mentioned above.

        I 'expanded' the default root folder size using the attached 4DGL program.

        Attached Files


        • #5

          Thanks for putting the code together! I will have to try this in a week or so when I can return to the hardware. The display is being used in a test setup for some CV processing codes. A series of images is loaded to the display and the CV code attempts to process what is on the screen from a camera. This particular test has MANY iterations; not all will be exercised, but I want the test team to have full flexibility in choosing what to test based on what works and what does work.. This means ~1300 files total need to be loaded onto the uSD card (GCI and DAT). The filenames are short (at most 4 characters plus the filetype: XXXX.GCI or XXXX.DAT).

          I will attempt to use your code for 2048 files and let you know how it works.