TP277 SD Card 'Incorrect File Size' Error: Causes and Solutions

David Krause12 min read
HMI / SCADASiemensTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

1. Problem Overview

On a SIMATIC TP277 operator panel configured with WinCC flexible, a data log file such as data_log_10.csv stops updating and the runtime raises the following dialog at panel boot or at the moment the file is opened:

The directory entry for data_log_10_csv specifies an incorrect file size,
Do you want this problem repaired now?
Options: Yes / No / Cancel

Selecting Yes triggers the operating system repair routine. The data log file is truncated to size zero, the active logging job is closed, and the panel reports "Data log stopped" or stops updating the entries that follow. Selecting No dismisses the dialog and the same prompt returns within minutes as soon as the runtime reopens the same CSV. Selecting Cancel leaves the system in an inconsistent state in which the file is locked but not written.

The error is independent of the application program, the controller, and the project itself. It is generated by the Windows CE / Windows Embedded file system layer when the directory record and the actual allocation length of a file no longer match. On TP277 panels this is almost always traceable to the storage medium that hosts the \Logs\ or \Storage Card\Logs\ directory.

Symptom class: Data logging fault. Severity: process-critical when the CSV is the only record of regulatory or batch history data. Typical first-occurrence window: between 1 hour and 14 days after enabling a logging job that writes a row every second or faster.

2. Affected Hardware and Firmware

Component Variant Firmware / Image Behavior
SIMATIC TP 277 6" 6AV6 643-0AA01-1AX0 Windows CE 5.0, image >= V11.02.xx SD/MMC slot, FAT16 only
SIMATIC TP 277 10" 6AV6 643-0CD01-1AX1 Windows CE 5.0, image >= V12.01.xx SD/MMC slot, FAT16 only
MP 277 10" Touch 6AV6 643-0CB01-1AX1 Windows CE 5.0 Same file system, same error class
MP 277 10" Key 6AV6 643-0CB01-1AX2 Windows CE 5.0 Same file system, same error class
MP 277 8" Key 6AV6 643-0DC01-1AX1 Windows CE 5.0 Same file system, same error class

The TP277 family is based on the SIMATIC 270/277 architecture. The CE image that ships on the panel exposes only a FAT16 file system driver on the removable media slot. The maximum supported partition size is therefore 2 GB in theory, but in practice the panel only ships with verified media profiles for cards up to 512 MB. Any SD card larger than 512 MB is treated as an unsupported media and may be reformatted, mounted, or written to in a way that produces the incorrect file size error.

3. Root Cause Analysis

The dialog is not a project or HMI tag error. It is a storage media fault. The four reproducible root causes observed in service reports are listed below in order of frequency.

3.1 SD card capacity above the verified profile

Siemens documents the supported storage media in the WinCC flexible / TIA Portal Knowledge Base. The 2x7 panels only list media up to 512 MB as approved. Larger SD and SDHC cards use a different allocation unit geometry and, in many cases, a different addressing scheme. The panel's CE 5.0 file system driver may create a directory entry whose reported file size is the FAT12/16 cluster count rather than the byte count, which is what the OS expects to read. On the next open of data_log_10.csv the system sees the discrepancy and posts the dialog.

3.2 Card formatted as FAT32, exFAT, or NTFS

An SD card that the user has formatted on a Windows 7 or Windows 10 PC is, by default, formatted with FAT32 above 2 GB and with exFAT above 32 GB. The TP277 firmware does not include a FAT32 or exFAT driver for removable media. When the panel mounts such a card it falls back to a compatibility layer that creates valid boot records but cannot correctly maintain directory entries for files larger than the FAT16 2 GB limit. Each write to a CSV that approaches the FAT16 file size boundary produces the same error.

3.3 Premature removal of the card during a write

If the SD card is removed from the panel between two write cycles of the data log, the file allocation table is updated but the directory entry is not flushed. On the next insert the panel reports the orphan cluster and the size mismatch.

3.4 Power loss on the panel while the log is open

A hard reset of the TP277 (battery depletion, breaker trip, USB service cable hot-plug) while a log is open produces the same symptom. The size stored in \Logs\<filename>.csv FAT entry is the truncated length, while the actual chain in the FAT is one cluster longer.

4. Quick Diagnostic Procedure

  1. Insert the SD card into a Windows PC equipped with a card reader. Right-click the card in Explorer and confirm the file system (FAT, FAT32, exFAT, NTFS).
  2. Open the \Logs folder. Right-click data_log_10.csv and inspect Size and Size on disk. A difference greater than 0 bytes is consistent with a corrupted allocation chain.
  3. Run cmd /c chkdsk X: /f where X is the drive letter of the card. The Windows utility will often report "File size mismatch in directory entry" which confirms the fault.
  4. Re-insert the card into the TP277 and read the panel information screen: Start Center → Settings → OP → Storage Card. Verify the reported free space and the reported card name. If the panel reports the card as unknown or as MultiMediaCard when an SD card is inserted, the card type is the cause.
  5. If the panel still raises the dialog after the PC chkdsk, the project is writing to the card with a write cycle that exceeds the throughput of the medium. Proceed to the solution section.

5. Solution Procedure

5.1 Use a Siemens-verified SD card up to 512 MB

Siemens has qualified the following media for the 270/277 series panels:

  • SIMATIC S7 Memory Card (MMC), 8 MB up to 64 MB - for recipe and parameter data only
  • SD card up to 512 MB, FAT16 formatted - for data log and alarm log

Replace the 2 GB card with a 512 MB SD card. The panel formats and mounts the card automatically when it is first inserted. Do not pre-format the card on a PC.

5.2 Recover an existing project on a 2 GB card

  1. On the TP277, press Cancel on the error dialog. Press Yes only if you no longer need the data in the current data_log_10.csv.
  2. Insert the SD card into a Windows PC. Run chkdsk X: /f. The utility will set the directory size to the actual size.
  3. Copy the CSV files to a backup folder on the PC.
  4. Format the SD card with the FAT16 file system and a 32 KB cluster size. The command line in Windows is: format X: /FS:FAT /A:32K /Q.
  5. Recreate the \Logs directory on the card and copy the CSV files back.
  6. If the card is 2 GB or larger, replace it with a 512 MB card per step 5.1.

5.3 Reduce the write rate in the WinCC flexible project

A 512 MB SD card with FAT16 has a sustained write throughput of roughly 200 KB/s on the TP277 platform. Configure the data log so that the average file growth is below 1 MB per minute. Use the following rules:

  • Trigger logging on a tag change rather than on a fixed 100 ms cycle.
  • Disable logging of bit tags that toggle every scan.
  • Set the segmentation mode to daily or weekly and enable overwrite at segment change when long-term retention is not required.

6. SD Card Specification and Compatibility

Card type Capacity File system TP277 support Notes
MMC 8 - 64 MB FAT12/16 Approved Recipes and parameters only
SD (SD 1.0) 16 - 512 MB FAT16 Approved Data log, alarm log, project backup
SD (SD 1.0) 1 GB - 2 GB FAT16 (rare) / FAT32 Not approved Fault "incorrect file size" likely
SDHC (SD 2.0) 4 GB - 32 GB FAT32 / exFAT Not supported Panel cannot mount or read
SDXC (SD 3.0) 64 GB and above exFAT Not supported Driver absent in CE 5.0 image
USB stick (via USB host) Any FAT16 / FAT32 Not on TP277 Only MP 377 / Comfort panels

The TP277 does not support USB storage. The USB port on the 277 family is a service port for project transfer, image update, and recovery only. Adding a USB stick to circumvent the SD card issue is not an option on the TP277.

7. File System and Data Log Format

By default, the WinCC flexible runtime writes data logs as Ring Buffer CSV or Sequential CSV. Both file types share the same .csv extension and the same line terminator (CR+LF). The ring buffer mode keeps the file size at a fixed maximum and overwrites the oldest entry. The sequential mode appends until the configured file count is reached and then starts a new segment.

Both modes rely on FAT16 directory entries. The file size field is a 32-bit value stored in the directory entry. On a FAT16 media, when the logical file size exceeds 2,147,483,520 bytes the value rolls over and the panel's file system driver writes a negative size to the directory. The next time the runtime opens the file, the OS reports the size mismatch.

A common field service mistake is to configure the data log with a 5 MB maximum file size and a cycle of 100 ms. With 20 tags this fills the file in roughly 1 hour. When the runtime splits to a new file, the directory entry of the closed file is not always flushed and the error appears on the next boot.

8. WinCC Flexible Configuration Reference

The data log is defined under Logs in the project tree. Relevant parameters:

Parameter Recommended value Effect
Storage location Storage Card (SD/MMC) Logs go to \Storage Card\Logs
Path \Logs Subdirectory on the card
File name data_log_10 Runtime appends .csv
Mode Ring buffer (overwrite at limit) Avoids the closed-file size mismatch
Max file size 1 MB Stays well below the FAT16 2 GB boundary
Trigger On change of tag Log_Trigger_10 Limits write rate
Segment mode Daily One CSV per calendar day

After changing any of the above parameters, recompile the project and transfer it to the panel. A delta download is not sufficient; use Transfer → Project → with write-protection reset.

9. Alternative Storage Locations on the 270/277 Family

If a 512 MB SD card is not available, the panel can be configured to write to the internal flash memory. The trade-off is limited capacity and a higher risk of data loss on power-down. Settings path: Logs → data_log_10 → Storage location → Internal Flash. The internal flash is mounted at \Flash\Storage in the CE 5.0 file system. Approximately 2 MB of free space is available for logs and recipes combined on a TP277.

For plants that must retain 30 days of process data, the recommended practice is to keep the SD card and to use the panel's Archive function to send the CSV to a PC or to a network share via Ethernet. On the TP277 this requires the ProSave or the WinCC flexible / Sm@rtAccess option and a network storage location that the panel can reach by UNC path.

10. Verification Steps

  1. After the new SD card is inserted, start the runtime on the TP277.
  2. Force a write by toggling the trigger tag from the controller.
  3. On the panel, open Start Center → Information → Storage Card and confirm the free space decreases by the configured segment size within one cycle.
  4. Power-cycle the panel twice. The incorrect file size dialog must not reappear.
  5. On the PC, open the CSV in Excel. The header row must contain the configured column names, and the data rows must have the same number of columns.
  6. After 24 hours of production, remove the card and inspect the directory entries with chkdsk. The utility must report No problems found.

11. Preventive Measures

  • Document the SD card part number in the project functional specification. Siemens part number 6AV6 671-1CB00-0AX2 (512 MB SD card) is a safe default.
  • Do not use the SD card as portable storage. Mark the card with the panel tag number using a label.
  • Set a maintenance reminder in the CMMS to replace the SD card every 24 months. SD card wear is accelerated by the constant small writes of a data log.
  • In the WinCC flexible project, set the Segment change at runtime stop flag so that the CSV is closed and the directory entry is flushed when the panel is stopped in a controlled way.
  • Configure the UPS or 24 V supply of the panel for at least 30 seconds of hold-up so that the file system can flush the FAT and the directory entry on a power-down.

12. Related Error Scenarios

Error message Most likely cause Resolution
"directory entry specifies an incorrect file size" Card larger than 512 MB, FAT32, or premature removal Replace with 512 MB FAT16 card, run chkdsk
"Storage card is not inserted" Card not detected Re-seat card, replace card, check slot contacts
"No space left on device" Card full, segment count exceeded Enable overwrite, reduce retention, replace card
"Data log is not defined" Project not transferred or log name typo Recompile and full transfer of project
"Cannot write to file" Read-only card switch engaged Set write-protect slider to unlock
"File not found: data_log_10.csv" Subdirectory \Logs missing Re-create directory on card, set path in project

13. Frequently Asked Questions

Can I use a 2 GB SD card in a TP277 panel?

Siemens only verifies SD cards up to 512 MB on the TP277. Cards above 512 MB can mount but the FAT16 directory driver on Windows CE 5.0 produces the incorrect file size error on CSV files. Use a 512 MB SD card and format it as FAT16 with 32 KB clusters.

Why does the error appear on every reboot even after I press Yes?

The dialog is raised by the storage media, not by the runtime. Pressing Yes runs the system repair which truncates the file and breaks the link between the FAT chain and the directory entry. The next time the runtime opens the same file, the discrepancy returns. The fix is to replace the card, not to answer the dialog.

Is FAT32 supported on the TP277?

No. The CE 5.0 image on the TP277 does not include a FAT32 driver for removable media. A FAT32 card is mounted through a compatibility layer that produces valid boot records but invalid directory entries for files approaching 2 GB. Format the card as FAT16 instead.

Can I write to internal flash instead of the SD card?

Yes. In the data log settings set Storage location to Internal Flash. The internal flash has roughly 2 MB of free space and is more sensitive to power loss. Use this only as a temporary measure until a verified SD card is available.

How do I recover a corrupted CSV on the PC without losing data?

Insert the card in a Windows PC and run chkdsk X: /f as administrator. The utility will set the directory entry size to the actual chain length and rebuild the FAT. Copy the file to a backup location before running chkdsk, as the repair can still truncate the file if the cluster chain is broken.

Does the TP277 support USB sticks for data logging?

No. The USB port on the TP277 is a service port for project transfer, image update, and recovery only. USB mass storage is supported on the MP 377 and on the Comfort panels but not on the 270/277 family.

Back to blog