cancel
Showing results for 
Search instead for 
Did you mean: 

How to implement USB to lots of interface (UART/I2C/PWM/SPI/GPIO...)

KTuz.1
Associate II

If we want to implement USB to multi-interface at the same times

USB to UART1~3

USB to I2C1~3

USB to SPI  

USB to PWM

USB to SD card

We use STM32F4 , USB 2.0 have 5 in / 5 out endpoints

i think we could use USB mass storage protocol to implement USB to SD

but the remain endpoints is not enough to implement standard USB protocol such as USB to UART1~4 (CDC),

What kind of method could i use to implement usb to other interface?

i do some research

USB HID

Self define descriptor use report ID to distinguish interface(UART/I2C/PWM...) 

USB CDC

Use virtual com to send self-defined command to communicate (UART/I2C/PWM)

 ....

Which is better use in Linux? or is there another method for USB to multi-interface ?

Is there any related sample code could reference?

Thanks alot 

1 REPLY 1

Options are:

- use the CDC class and select ab different mcu with more endpoints (but it sounds you want more channels than might be endpoints available in any STM32)

- use one CDC class and encapsulate data for several channels into your protocol, multiplexing/demultiplexing at the application level (this sounds to be the most plausible solution)

- do the same at system level, i.e. develop your own non-class USB Interface, and write corresponding driver at the host side i.e. linux, performing basically the same multiplexing/demultiplexing, presenting it to application(s) as separate streams

Definitive not something you can get ready made with examples.

JW