Skip to main content
Junde
Senior III
October 14, 2025
Solved

How to drive a FT232 chip by STM32 USB HOST CDC example?

  • October 14, 2025
  • 3 replies
  • 477 views

Hi there,

I am working on a project that requires sending just two commands to an FT232 chip and waiting for the response data.

I can already successfully communicate the STM32 USB HOST CDC and the STM32 USB DEVICE CDC (refer to repo's first commit ).

However, while I was trying to modify the USB HOST CDC example to work with FT232(refer to the above repo's second commit), it didn't work.

Can anyone give me some advice or demo code?

Thank you.

Best answer by Junde

Hi there, 

After some tries, I can use the STM32F429 to communicate with the FT232. (Refer to the source code in the attachment)

However, there are some bugs in the code:

1. There are always 2 more bytes to be received at the beginning of the data frame. (I ignore the first 2 bytes now)

2. Some frames can be received more than once. (I compare the continuously received frames and ignore the same ones.)

3. After re-plugging the FT232 device, the device can't work. (How to support the hot plug)

(And I already tried the STM32F1 Device CDC example with the same HOST code; all the above problems do not exist.)

Below are the LOG for the STM32F1 Device(left) and the FT232 Device(right):

Junde_1-1760674334317.png  Junde_2-1760674355342.png

I don't know the reason why the FT232 can't support the hot plug function.

3 replies

TDK
Super User
October 14, 2025

If you want UART, why not cut the FT232 chip out and use UART directly from the STM32?

"If you feel a post has answered your question, please click ""Accept as Solution""."
Junde
JundeAuthor
Senior III
October 14, 2025

Hi @TDK ,

Thanks for your reply.

The FT232 is integraded in a module that we must use, and that module is not manufacture by ourself.

So that's why we need to build communication with it.

Andrew Neil
Super User
October 14, 2025

@Junde wrote:

The FT232 is integraded in a module that we must use,


"must"?

What compels you?

 


@Junde wrote:

that module is not manufacture by ourself.


So have you tried contacting the manufacturer for support?

Or maybe contact FTDI for support in hosting their chips on a microcontroller?

 

PS:

Perhaps this might help: https://github.com/hathach/tinyusb/discussions/725#discussioncomment-505374 ?

via Google search for "ft232 host stm32"; other internet search engines are available.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Andrew Neil
Super User
October 14, 2025

See this recent thread: STM32F407 USB Host config for FT232RL.

As noted there by @waclawek.jan, the FT232 is not a standard CDC class device - so you'll have to look at its descriptors and you would need a custom driver for it. 

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Junde
JundeAuthorBest answer
Senior III
October 17, 2025

Hi there, 

After some tries, I can use the STM32F429 to communicate with the FT232. (Refer to the source code in the attachment)

However, there are some bugs in the code:

1. There are always 2 more bytes to be received at the beginning of the data frame. (I ignore the first 2 bytes now)

2. Some frames can be received more than once. (I compare the continuously received frames and ignore the same ones.)

3. After re-plugging the FT232 device, the device can't work. (How to support the hot plug)

(And I already tried the STM32F1 Device CDC example with the same HOST code; all the above problems do not exist.)

Below are the LOG for the STM32F1 Device(left) and the FT232 Device(right):

Junde_1-1760674334317.png  Junde_2-1760674355342.png

I don't know the reason why the FT232 can't support the hot plug function.

Andrew Neil
Super User
October 17, 2025

@Junde wrote:

I already tried the STM32F1 Device CDC example with the same HOST code; all the above problems do not exist


As already noted, the FT232 is not a standard CDC device - so that's to be expected.

 


@Junde wrote:

I don't know the reason why the FT232 can't support the hot plug function.


It's not the FT232 - that certainly copes with hot-plugging on other systems - so it must be something missing/wrong in your code...

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Junde
JundeAuthor
Senior III
October 17, 2025

Hi @Andrew Neil 

Thanks for your reply.

It's not the FT232 - that certainly copes with hot-plugging on other systems - so it must be something missing/wrong in your code...

Yes, I know there must be something wrong with the code, but I don't know where and why it is.