2021-06-29 08:05 PM
I am working USB classes with my STM32F469I discovery and for HOST MSC class have problems to have my program recognize any USB flash drive with GPT format. I have been able to exchange data only with MBR format USB devices.
Can anybody give me some light on what might be the problem as the examples provided by STMicroelectronics have the same issues? Thank you for your kind help
2021-06-29 08:15 PM
Does the ST code read the blocks/sectors properly?
How those are utilized will depend on the level of file system, and partition, support afforded by the FatFS middleware..
2021-06-29 08:38 PM
Thank you for your answer.
I omitted to say that I am newbie, so I followed some examples and used the basic fatFS functions to access the drive.
I cannot manage yet to read blocks/sectors or how to do it differently depending on the drive format
Here is a copy of the main app thread:
__NO_RETURN void app_main (void *arg) {
usbStatus usb_status; // USB status
int32_t msc_status; // MSC status
FILE *f; // Pointer to stream object
uint8_t con = 0U; // Connection status of MSC(s)
fsStatus result;
LED_Initialize (); // Initialize LEDs
(void)arg;
usb_status = USBH_Initialize (0U); // Initialize USB Host 0
if (usb_status != usbOK) {
for (;;) {} // Handle USB Host 0 init failure
}
for (;;) {
msc_status = USBH_MSC_DriveGetMediaStatus ("U0:"); // Get MSC device status
if (msc_status == USBH_MSC_OK) {
LED_On (3U); // Switch LED4 on
if (con == 0U) { // If stick was not connected previously
con = 1U; // Stick got connected
msc_status = USBH_MSC_DriveMount ("U0:");
if (msc_status != USBH_MSC_OK) {
continue; // Handle U0: mount failure
}
f = fopen ("Practice-02.txt", "w"); // Open/create file for writing
if (f == NULL) {
continue; // Handle file opening/creation failure
}
fprintf (f, "This is the content of Practice-02.txt");
fclose (f); // Close file
result = fmkdir("DIR1");
if(result!=fsOK) {
continue;
}
f = fopen ("/DIR1/Dir1File.txt", "w"); // Open/create file for writing
if (f == NULL) {
continue; // Handle file opening/creation failure
}
fprintf (f, "This file is supposed to be located at DIR1");
fclose (f);
f = fopen ("/DIR1/SUBDIR1/Dir1Subdir1File.txt", "w"); // Open/create file for writing
if (f == NULL) {
continue; // Handle file opening/creation failure
}
fprintf (f, "This file is supposed to be located inside SUBDIR1");
fclose (f);
result = fmkdir("DIR2");
if(result!=fsOK) {
continue;
}
msc_status = USBH_MSC_DriveUnmount ("U0:");
if (msc_status != USBH_MSC_OK) {
continue; // Handle U0: dismount failure
}
}
} else {
LED_Off (3U); // Switch LED4 on
if (con == 1U) { // If stick was connected previously
con = 0U; // Stick got disconnected
}
}
osDelay(100U);
}
}
2021-06-30 12:56 AM
GUID partition support is a relatively recent addition to fatfs, check your version:
R0.14 (October 14, 2019)
Added support for 64-bit LBA and GUID partition table (FF_LBA64)
It also needs to be enabled by an appropriate configuration option http://elm-chan.org/fsw/ff/doc/appnote.html#lba64
JW
2021-06-30 06:04 PM
Thank you for the information. I will investigate more on this and try to see how it goes.