cancel
Showing results for 
Search instead for 
Did you mean: 

How to receive data from USB peripheral via MAX3421E.

Snehal
Associate II

Hi, 

    I am using STM32 in my project. The use case includes the following :-

1) ID accessory(pen drive) ----> STM32.

In this STM32 should act as a USB host and detect the ID accessory as well as do some data transfer. We are going to use MAX3421E which will turn STM32 into USB peripheral . I have library for MAX3421 which I will be including in the code.

github.com/jakakordez/max3421e-stm32/tree/master/Src

My doubt is will I need USB drivers here? If yes which class drivers should I add?

2) The ID accessory will be having a Flash chip with file system mounted on it. It will also have a unique Device ID. The STM32 will have to read that device ID whenever ID accessory is plugged in to the device. The RX and TX of this communication will happen via SPI protocol I assume. In the library I have seen the code for detecting USB and enumerating it. But how to send data to the ID accessory(flash chip) and how to receive data from ID accessory?? I am confused on that.

Your help will be appreciated.

Thanks & Regards,

Snehal Bundele.

11 REPLIES 11
RhSilicon
Lead

If anyone needs a good library for MAX3421e, this is the best I know of, supports multiple HID interfaces, joypad, unfortunately it has not been ported to STM32 yet (it would be very good if ST ported it, due to the errors that are occurring with the internal PHY):

https://github.com/felis/UHS30


@Snehal wrote:

Actually the block diagram will be of this kind:-

0693W00000Y9S1QQAV.png 

1) ID accessory(Kind of pen drive- not actually a pen drive) ----> NRF52840.

In case 1 STM32 should act as a USB host and detect the ID accessory as well as do some data transfer. So we are using MAX3421e which will support host operations.

 

Help needed for CASE 1.

STM32 will have to fetch data from the FLASH 2 and send this raw data to MCU 1 via MAX3421.

1)For this which USB stack will be needed is my question?

2)In the library which I shared above I have seen the code for detecting USB and enumerating it. But how to send data to the MCU 1(samd20) and how to receive data from MCU 1(samd20)?? I am confused on that.

3) How will USB drivers in case 1 be used with SPI drivers?

 

Thanks & Regards,

Snehal

 


About the project, if you are going to communicate 2 MCU that have SPI, wouldn't it be possible to use USB 3.0 port connectors, and transfer data via SPI?

"While the SPI communication method is generally suitable for distances up to approximately 10 m"

"with the LTC6820, distances of up to 100 m"

https://www.analog.com/en/technical-articles/isolated-spi-communication-made-easy.html