cancel
Showing results for 
Search instead for 
Did you mean: 

[NOT Solved] F407 and SanDisk Cruzer Blade 16GB don't work (32GB work)

Not applicable

I tested 3 pendrives, 4GB (Samsung?), 16GB and 32GB (SanDisk Cruzer Blade).

Two worked on the STM32F407VG.

SD card adapter also doesn't work, 8GB (Kingston), 2GB (Generic), 16GB (Sandisk Ultra).

SanDisk Cruzer Blade 16GB don't work.

Using USB host with STM32CubeIDE 1.3 (Version 1.4 does not work with ST-Link V2 :expressionless_face:)

​In case anyone has problems with this, I leave it registered that it can be common.

All devices run on Windows 10 x64 and Android 10 (Smartphone).

19 REPLIES 19
Not applicable

Thanks,

I tried to make your example work with the F407, but it didn't work, the uC was unable to open the file "2019/jan/1/pendrive.txt".

So I adapted it with parts of another sample code, and it worked, the F407 was able to read and write all the devices, both pendrive and SD card with adapter.

Unfortunately my project that has several peripherals (RTC DS3231, ACC MPU6050, LCD ILI9341, USB HID, USB MSC) cannot work with the changes I found. I think I will have to create a new project with IDE 1.4.2 and build the project again.

At least now I know that the IDE works with USB Host MSC.

Thank you.

Not applicable

Note: ST-Link still does not work on Windows (STM32CubeIDE 1.4.2), I am using Linux Xubuntu now, I think it is much faster to compile.

dbgarasiya
Senior II

pendrive.txt file is written to your usb disk after flashing code to controller

you have to eject usb disk and plug it to your controller

you wil able to see pendrive.txt file in your usb disk

Not applicable

"The controller was unable to create the file" Thanks

dbgarasiya
Senior II

this is working example

try it with simple pendrive.txt in root folder like

"pendrive.txt"

Not applicable

I was able to configure the debug messages (level 3) and noticed that the SD card only works if the microcontroller boots with the SD card connected. If the microcontroller boots and then connects the SD card, then it doesn't work. But this does not happen with a USB stick. With pendrive, it works in both cases.

If the microcontroller boots with the Pendrive connected:

USB Device Connected
USB Device Reset Completed
PID: 4200h
VID: 13feh
Address (#1) assigned.
Manufacturer :
Product : USB DISK 2.0
Serial Number : 7F004191A203B205
Enumeration done.
This device has only 1 configuration.
Default configuration set.
Switching to Interface (#0)
Class    : 8h
SubClass : 6h
Protocol : 50h
MSC class started.
Number of supported LUN: 1
LUN #0:
Inquiry Vendor  :
Inquiry Product : USB DISK 2.0
Inquiry Version : PMAP
MSC Device ready
MSC Device capacity : 3449028096 Bytes
Block number : 15124991
Block Size   : 512
f_mount(&USBDISKFatFs, (TCHAR const*)USBDISKPath, 0) == FR_OK
(byteswritten != 0) && (res == FR_OK)
f_open(&MyFile, 'Even.TXT', FA_READ) == FR_OK
(bytesread != 0) && (res == FR_OK)
(bytesread == byteswritten

If the microcontroller boots and then connects the Pendrive:

USB Device Connected
USB Device Reset Completed
PID: 4200h
VID: 13feh
Address (#1) assigned.
Manufacturer :
Product : USB DISK 2.0
Serial Number : 7F004191A203B205
Enumeration done.
This device has only 1 configuration.
Default configuration set.
Switching to Interface (#0)
Class    : 8h
SubClass : 6h
Protocol : 50h
MSC class started.
Number of supported LUN: 1
LUN #0:
Inquiry Vendor  :
Inquiry Product : USB DISK 2.0
Inquiry Version : PMAP
MSC Device ready
MSC Device capacity : 3449028096 Bytes
Block number : 15124991
Block Size   : 512
f_mount(&USBDISKFatFs, (TCHAR const*)USBDISKPath, 0) == FR_OK
(byteswritten != 0) && (res == FR_OK)
f_open(&MyFile, 'Even.TXT', FA_READ) == FR_OK
(bytesread != 0) && (res == FR_OK)
(bytesread == byteswritten

If the microcontroller boots with the SD card connected:

USB Device Connected
USB Device Reset Completed
PID: 125ch
VID: 14cdh
Address (#1) assigned.
Manufacturer : Generic
Product : Mass Storage Device
Serial Number : 125C20100726
Enumeration done.
This device has only 1 configuration.
Default configuration set.
Switching to Interface (#0)
Class    : 8h
SubClass : 6h
Protocol : 50h
MSC class started.
Number of supported LUN: 1
LUN #0:
Inquiry Vendor  : Mass
Inquiry Product : Storage Device
Inquiry Version :
MSC Device ready
MSC Device capacity : 3527409152 Bytes
Block number : 15278079
Block Size   : 512
f_mount(&USBDISKFatFs, (TCHAR const*)USBDISKPath, 0) == FR_OK
(byteswritten != 0) && (res == FR_OK)
f_open(&MyFile, 'Even.TXT', FA_READ) == FR_OK
(bytesread != 0) && (res == FR_OK)
(bytesread == byteswritten

If the microcontroller boots and then connects the SD card:

USB Device Connected
USB Device Reset Completed

Not applicable

This problem of not recognizing the SD card after boot, occurs on both ports, HS and FS.

dbgarasiya
Senior II

Are you trying to work both usb mass storage device (sd card data shown as drive in computer ) and usb disk (pen drive ) at same time ?

Not applicable

No, I just assembled the code with the two ports to test, I am using only one port at a time to test. I'm testing with an adapter of this type:

https://www.dx.com/p/4-in-1-usb-20-rotatable-memory-card-reader-micro-sd-card-adapter-for-tf-sd-m2-ms-card-2041806.html

Not applicable

The same thing happens with this other adapter model: