Skip to main content
August 12, 2020
Question

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

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).

​

This topic has been closed for replies.

19 replies

dbgarasiya
Senior
August 20, 2020

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

August 20, 2020

"The controller was unable to create the file" Thanks

dbgarasiya
Senior
August 20, 2020

this is working example

try it with simple pendrive.txt in root folder like

"pendrive.txt"

August 21, 2020

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

August 21, 2020

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

dbgarasiya
Senior
August 21, 2020

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 ?

August 21, 2020

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

August 21, 2020

The same thing happens with this other adapter model: