Skip to main content
Ajithkumar
Associate
March 27, 2023
Question

I am working with STM32F407 to write a text file to Pendrive (USB Host). But i am getting FD_DISC_ERR. When I debugged more i understood that this is due to HOST_DEV_WAIT_FOR_ATTACHMENT issue. Can anyone help why this is happening?

..

This topic has been closed for replies.

3 replies

Ajithkumar
Associate
March 27, 2023

These are the pinout and clock config diagram

I am working with STM32F407 to write a text file to Pen drive (USB Host).

f_open(&MyFile, "testfile.txt", FA_CREATE_ALWAYS | FA_WRITE);

getting FD_DISC_ERR. When I debugged more i understood that this is due to HOST_DEV_WAIT_FOR_ATTACHMENT issue. Can anyone help why this is happening?

0693W00000aJjocQAC.png 

0693W00000aJjomQAC.png

ST Technical Moderator
March 28, 2023

Hello @Ajithkumar​ and welcome to the Community :)

Try ClockDiv with 2 or 4.

I advise you to get inspired from the available examples available with STM32CubeF4 MCU package, and you will find more details on this article: Introduction to USB with STM32.

Make sure to use latest versions of STM32CubeMX and STM32CubeF4 MCU package.

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
Ajithkumar
Associate
March 31, 2023

Not worked. I tried with multiple clock vales.

I tried with example project in CudeIDE as well as i created new project from scratch but not worked me both.

Is any Size limitation for Flash Drive size ?

I mean I tried with 16GB and 32GB Flash Drive