2024-06-11 11:54 PM - edited 2024-06-12 05:36 AM
Hi
I have a sensor board with USB MSC and an EMMC memory chip. Under windows every thing works fine but not under MAC or Android.
I am using FATFS and format the card with fomat option = #define FM_ANY 0x07.
Does any one have a clue what is going wrong?
I assume I have wrong settings:
I need to make the card read only for Windows/mac/android, but read/write from STM32 firmware.
So in ffconf.h I write:
#define _FS_READONLY 0 /* 0:Read/Write or 1:Read only */
And in usbd_storage_if.c I write.
int8_t STORAGE_IsWriteProtected_HS(uint8_t lun)
{
/* USER CODE BEGIN 12 */
return (USBD_FAIL);
/* USER CODE END 12 */
}
This fine with windows but not with mac/android.
My card is detected (and works fine) on all platform when it is not write protected. Probably I dont know how to implement write protection.
Actually this post suggests to set a write protect bit in uint8_t Mode_Sense10_data[]. But it doesnt work for me either.
Thx
2024-06-18 07:15 AM
Hello @MK..1
Please check if there are any hidden files or system files created by Windows that could be causing compatibility issues when the card is accessed on macOS or Android.
Returning USBD_FAIL is not appropriate in STORAGE_IsWriteProtected_HS; you should return a value that indicates the write protection status. Typically, returning 1 would indicate that the storage is write-protected, and 0 would indicate that it is not.