carlk3 / no-OS-FatFS-SD-SDIO-SPI-RPi-Pico

A FAT filesystem with SDIO and SPI drivers for SD card on Raspberry Pi Pico
Apache License 2.0
76 stars 15 forks source link

f_mkdir() causes file system errors when mounted back in windows #45

Open tgiacchi opened 3 weeks ago

tgiacchi commented 3 weeks ago

image

when creating a directory the directory is created, but when going to a command prompt in windows with the SD card mounted, I will get 'The parameter is incorrect.' This happens on both exFat and Fat32. I am very worried about data corruption.

I can run chkdsk /f against the drive and it reports no errors. Could this be a bug in windows 11?

At 1st, I thought it might be an issue with not unmounting the SD card, but I unmount before ejecting it. Same results.

carlk3 commented 3 weeks ago

Weird. Maybe there's something funny about the directory names. What happens if you list the directory with FatFs? E.g., void ls(const char *dir). If you have a Linux box (or WSL) it might be interesting to see what it reports.

How are you formatting the SD card?

tgiacchi commented 3 weeks ago

I've done fat32, 16k clusters. Exfat at different cluster sizes. File explorer seems to be ok with it.

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Carl J Kugler III @.> Sent: Wednesday, June 5, 2024 4:25:20 PM To: carlk3/no-OS-FatFS-SD-SDIO-SPI-RPi-Pico @.> Cc: Tom @.>; Author @.> Subject: Re: [carlk3/no-OS-FatFS-SD-SDIO-SPI-RPi-Pico] f_mkdir() causes file system errors when mounted back in windows (Issue #45)

Weird. Maybe there's something funny about the directory names. What happens if you list the directory with FatFs? E.g., void ls(const char *dir)https://github.com/carlk3/no-OS-FatFS-SD-SDIO-SPI-RPi-Pico/blob/cd0b9168272828a3341515028f3496229ed28877/src/src/f_util.c#L110. If you have a Linux box (or WSL) it might be interesting to see what it reports.

How are you formatting the SD card?

— Reply to this email directly, view it on GitHubhttps://github.com/carlk3/no-OS-FatFS-SD-SDIO-SPI-RPi-Pico/issues/45#issuecomment-2150904925, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADNHM6AYCKA6JQSLVG26VM3ZF5X3BAVCNFSM6AAAAABI3FNCJOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJQHEYDIOJSGU. You are receiving this because you authored the thread.Message ID: @.***>

carlk3 commented 3 weeks ago

I've done fat32, 16k clusters. Exfat at different cluster sizes.

On Windows? You could also try using FatFs, e.g. static void run_format(const size_t argc, const char *argv[]), or SD Memory Card Formatter.

File explorer seems to be ok with it.

So, File Explorer shows it OK but DIR in CMD does not? Are there Unicode characters in the directory names?

tgiacchi commented 3 weeks ago

Nope. Just ascii.

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Carl J Kugler III @.> Sent: Wednesday, June 5, 2024 4:36:23 PM To: carlk3/no-OS-FatFS-SD-SDIO-SPI-RPi-Pico @.> Cc: Tom @.>; Author @.> Subject: Re: [carlk3/no-OS-FatFS-SD-SDIO-SPI-RPi-Pico] f_mkdir() causes file system errors when mounted back in windows (Issue #45)

I've done fat32, 16k clusters. Exfat at different cluster sizes.

On Windows? You could also try using FatFs, e.g. static void run_format(const size_t argc, const char *argv[])https://github.com/carlk3/no-OS-FatFS-SD-SDIO-SPI-RPi-Pico/blob/cd0b9168272828a3341515028f3496229ed28877/examples/command_line/src/command.cpp#L199, or SD Memory Card Formatterhttps://www.sdcard.org/downloads/formatter/.

File explorer seems to be ok with it.

So, File Explorer shows it OK but DIR in CMD does not? Are there Unicode characters in the directory names?

— Reply to this email directly, view it on GitHubhttps://github.com/carlk3/no-OS-FatFS-SD-SDIO-SPI-RPi-Pico/issues/45#issuecomment-2150920944, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADNHM6AFMFUGUNUMDVWES6DZF5ZEPAVCNFSM6AAAAABI3FNCJOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJQHEZDAOJUGQ. You are receiving this because you authored the thread.Message ID: @.***>

tgiacchi commented 3 weeks ago

Qq. How do I set the datetime that the code uses

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Carl J Kugler III @.> Sent: Wednesday, June 5, 2024 4:36:23 PM To: carlk3/no-OS-FatFS-SD-SDIO-SPI-RPi-Pico @.> Cc: Tom @.>; Author @.> Subject: Re: [carlk3/no-OS-FatFS-SD-SDIO-SPI-RPi-Pico] f_mkdir() causes file system errors when mounted back in windows (Issue #45)

I've done fat32, 16k clusters. Exfat at different cluster sizes.

On Windows? You could also try using FatFs, e.g. static void run_format(const size_t argc, const char *argv[])https://github.com/carlk3/no-OS-FatFS-SD-SDIO-SPI-RPi-Pico/blob/cd0b9168272828a3341515028f3496229ed28877/examples/command_line/src/command.cpp#L199, or SD Memory Card Formatterhttps://www.sdcard.org/downloads/formatter/.

File explorer seems to be ok with it.

So, File Explorer shows it OK but DIR in CMD does not? Are there Unicode characters in the directory names?

— Reply to this email directly, view it on GitHubhttps://github.com/carlk3/no-OS-FatFS-SD-SDIO-SPI-RPi-Pico/issues/45#issuecomment-2150920944, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADNHM6AFMFUGUNUMDVWES6DZF5ZEPAVCNFSM6AAAAABI3FNCJOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJQHEZDAOJUGQ. You are receiving this because you authored the thread.Message ID: @.***>

tgiacchi commented 3 weeks ago

So the problem stems from not initializing the rtc with some valid value. Cmd doesn't understand all zeros

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Carl J Kugler III @.> Sent: Wednesday, June 5, 2024 4:36:23 PM To: carlk3/no-OS-FatFS-SD-SDIO-SPI-RPi-Pico @.> Cc: Tom @.>; Author @.> Subject: Re: [carlk3/no-OS-FatFS-SD-SDIO-SPI-RPi-Pico] f_mkdir() causes file system errors when mounted back in windows (Issue #45)

I've done fat32, 16k clusters. Exfat at different cluster sizes.

On Windows? You could also try using FatFs, e.g. static void run_format(const size_t argc, const char *argv[])https://github.com/carlk3/no-OS-FatFS-SD-SDIO-SPI-RPi-Pico/blob/cd0b9168272828a3341515028f3496229ed28877/examples/command_line/src/command.cpp#L199, or SD Memory Card Formatterhttps://www.sdcard.org/downloads/formatter/.

File explorer seems to be ok with it.

So, File Explorer shows it OK but DIR in CMD does not? Are there Unicode characters in the directory names?

— Reply to this email directly, view it on GitHubhttps://github.com/carlk3/no-OS-FatFS-SD-SDIO-SPI-RPi-Pico/issues/45#issuecomment-2150920944, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADNHM6AFMFUGUNUMDVWES6DZF5ZEPAVCNFSM6AAAAABI3FNCJOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJQHEZDAOJUGQ. You are receiving this because you authored the thread.Message ID: @.***>

carlk3 commented 3 weeks ago

Qq. How do I set the datetime that the code uses Get Outlook for Androidhttps://aka.ms/AAb9ysg

You need to define

DWORD get_fattime (void);   /* Get current time */

E.g., get_fattime.