cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f4 and usb flash

ASSAAD.ASSAAD
Associate II
Posted on July 22, 2016 at 10:39

Hello friends ;

We have a datalogger based on stm32f4 discovery ; we log the data in external flash disck 8GB ( scan disck ) ; we noticed that  about 20% of the usb discs we used don't work .

STM32f4 detect the usb ; but file system cant read data or open file or write data ., but the same usb work good when we put to PC .

Maybe some of you had this issue before so I would be thankful  if you could help;  I was debugging for few days but could not find the solution ; I am not sure  if it it a usb timing problem or the fat32 library problem .

Could you guide me to solve it please ?

Thank you in advanced .

Best Regards

8 REPLIES 8
Posted on July 22, 2016 at 13:31

ST in the past has decribed issues related to poor oscillators in USB Flash drives, perhaps in the readme file for the fw upgrade example.

Why dont you describe the error numbers you are seeing at the FATFS and DISKIO layers, and the nature of the data returned?

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Walid FTITI_O
Senior II
Posted on July 22, 2016 at 17:00

Hi ASSAAD,

I suggest to have a look to ''MSC_Standalone'' example in STM32CubeF4 at this path:

STM32Cube_FW_F4_V1.12.0\Projects\STM324xG_EVAL\Applications\USB_Host\MSC_Standalone

This application is based on read/write file and explore the USB flash disk content trough a MSC routine.

Compare the code there to your own code to identify what you have missed.

-Hannibal-
ASSAAD.ASSAAD
Associate II
Posted on July 22, 2016 at 17:35

Hello Clive ; 

First I would like to say thank you for your replies in the  forum . 

when I try to open a file after the usb flash is connected ; the fatfs return an FR_DISK_ERR; 

For the usb flash oscillators I could find the things you told , but you mean it could be an ascillator problem ?  the same usb flash works good with Windows PC ;  

I repeat again this problem is only with 20% of the USB flashed that I have with the same board . 

Thank you again 

ASSAAD.ASSAAD
Associate II
Posted on July 22, 2016 at 17:36

Thank you Hannibal ; 

I Will look to the example and return you an feedback soon . 

Regards 

Posted on July 22, 2016 at 17:53

Works on a PC != Specification Compliant, it suggests that the Flash Drives are built with components that don't guarantee functionality with all systems.

Known limitations

 

 

  - For some USB Disk flashs, in the Full speed mode, the USB clock accuracy is

 

    not in line with the clock variance recommended in the USB 2.0 specification.

 

    Thus, the USB OTG FS core may not work properly on these devices.

 

    It is recommended to use certified USB disks.

 

 

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
ASSAAD.ASSAAD
Associate II
Posted on July 25, 2016 at 17:28

Hello Clive ;

Sorry for the late reply ; I could not sign in the forum ;

I wanted to say it work with PC to confirm that the flah disk is operating and crashed. I know that all flash memories work with PC .

The USB driver detect the USB pen ; but the file system fatft crashed there with error ;

I contacted SCAN DISC they told that thier USB is certificied ; but I did not  know which kind of certification thay have . Here I really struggled ; because most of thier flashes work good with our boards ; about 20 % not ok . 

For  the clock problem ; is thier a software solution for it ? any idea ? 

Thank you for your effort 

Regards 

 

Posted on July 25, 2016 at 17:47

I contacted SCAN DISC they told that their USB is certified 

SanDisk perhaps?

Your options here would be to evaluate the accuracy of the HSE clock source on the STM32F4-DISCO, I haven't looked at the ppm rating, You could push a 48 MHz PLL signal out via the MCO (PA8) and qualify/validate the frequency against an accurate reference.

You could perhaps use a USB Protocol Analyzer to validate it from that perspective.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
ASSAAD.ASSAAD
Associate II
Posted on December 08, 2016 at 13:50

Hello Again ;

The problem is that the orginal software of the discovery board can not work with USB flashed version 2.1 only work with USB flashed 2.0 .

But when using the HAL example of the discovery it works ; we noticed that the usb core library is changed .

However ; our project depends on the standart old example of the discovery to move to the Hal libra we need time ; for urgent work is there a usb library that would operate with the old standart library ?

or any other suggestions ?

Thank you inadvanced