element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Avnet Boards Forums
  • Products
  • Dev Tools
  • Avnet & Tria Boards Community
  • Avnet Boards Forums
  • More
  • Cancel
Avnet Boards Forums
PicoZed Hardware Design Zynq 7020 SD FAT corruption
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Avnet Boards Forums to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 2 replies
  • Subscribers 336 subscribers
  • Views 538 views
  • Users 0 members are here
Related

Zynq 7020 SD FAT corruption

EniX2000
EniX2000 over 1 year ago

Hi there!

I'm encountering a very nasty FAT corruption problem. The problem appears systematically after a first write in a file stored in an uSD card.

There is a workaround: to place the file at the very beginning of the uSD card or in the first 2Gb of uSD space. In this case the problem is avoided whaterver the number of writes (hundreds) !

The problem does not appear during file reads. For instance I can place the BOOT.BIN at the very end of the uSD card (after 23Gb of data) and the system boots OK every time! I manage to read without probles configuration files placed also at the high end of the uSD capacity.

The FAT corruption is quite strange since I use standard ff.c functions (version R0.10b, 19 May 2014, included in Vivado 2015.2 ) in order to open the pre-existing file and to write data into.

The file is contiguous and its size remains constant so there should be no cluster allocation/change. Despite this after the first write in the file I see the first sector number truncated. Runing chkdsk detects an file entry crossing which is quite abnormal since once again I use standard access functions.

My application:

  -Bare Metal on PicoZed (Zynq 7020)

  -Vivado 2015.2 (project legacy reasons)

  -xilffs 3.0

  -uSD SanDisk MaxEndurance, 32Gb HC I    U3  C10

  -Standard factory FAT32 formatting (512bytes sector size, 32768bytes cluster size).

 I force a uSD check-up and the card is free from errors prior to an atomic writing. After a first write, if the file is in a "high" position the portion of FAT concerning the respective file appears to be corrupted.

 One hypothesis is that the initial formatting of the uSD is not compatible with the xilff library. What formatting works for you and with what capacity ?

Any help will be greatly appreciated.!!!

Regards,

 

  • Sign in to reply
  • Cancel
Parents
  • EniX2000
    EniX2000 over 1 year ago

    Hi all,

    In the mean time I tried with different cluster sizes  and different uSD cards sizes (32Gb from SanDisk and 16Gb from Transcend). The problem remains the same.

    In order to separate problems I run the example code code provided by Xilinx: FfsSdPolledExample()

    It creates a 8Mb TEST.bin file by writing numerical values and then reads the file content in order to check that the values were correctly written.

    The function FfsSdPolledExample() (provided as example with the library) returns no error but after the TEST.bin file is creating, forcing an "Analyse and Repair" option on the uSD card results in errors found at the FAT level.

    One call of the FfsSdPolledExample() is enough to have the problem.

    I also tested on two different hardwares: 

          -PicoZed with an external (motherboard) uSD slot

          -MicroZed with its own uSD slot. The second configuration was ment to detect some potential hardware problems with the first setup.

    Both configurations (tested with the same software) exhibit the FAT corruption problem.

    The procedure I'm using is the following:

       -logical format the uSD card with the desired cluster size (8kb,16kb,32kb)

       -write 5 empty files of 1Gb each. This is ment to force an offset on the TEST file creation regarding the uSD data start.

       -write the bootable BOOT.bin

       -perform a uSD integrity check in order to be sure that at this step the uSD has a viable FAT

       -boot the PicoZed/MicroZed from the uSD. This launches the creation of the file TEST.bin

       -leave enough time in order to allow the execution of the function FfsSdPolledExample(). The function is executed only once. No other writing operation is allowed.

       -extract the uSD card and force an integrity check (despite the Windows messages that it's not needed)

      Running this procedure I systematically find the FAT corrupted.

      I would very gratefull if some charitable soul could reproduce the procedure and find the same results or NOT and give me some hints...

     Regards,

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • EniX2000
    EniX2000 over 1 year ago in reply to EniX2000

    Hi All,

    I also tried to use 2 partitions (as advised by a forum member).

    The first partition serves as boot partition (less than 2 GB) The second holds the main SD capacity (roughly 27GB). Second partition serves for storing log data in multiple 1GB files. Both partitions are formatted as FAT32.

    I managed to create/write files on the second partition but the problem remains the same.

    If the start of the second partition is occupied by more than 2GB of data then creating a file or writing to it creates a FAT corruption.

    It looks like you cannot write more than 2GB of data even if the SD card has 32GB capacity.

    bhfletcher  You were very helpfull and knowledgeable in previous posts !  Did you see such a problem (2GB limitation) before? I use xilffs 3.0.

    Regards,

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • EniX2000
    EniX2000 over 1 year ago in reply to EniX2000

    Hi All,

    I also tried to use 2 partitions (as advised by a forum member).

    The first partition serves as boot partition (less than 2 GB) The second holds the main SD capacity (roughly 27GB). Second partition serves for storing log data in multiple 1GB files. Both partitions are formatted as FAT32.

    I managed to create/write files on the second partition but the problem remains the same.

    If the start of the second partition is occupied by more than 2GB of data then creating a file or writing to it creates a FAT corruption.

    It looks like you cannot write more than 2GB of data even if the SD card has 32GB capacity.

    bhfletcher  You were very helpfull and knowledgeable in previous posts !  Did you see such a problem (2GB limitation) before? I use xilffs 3.0.

    Regards,

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube