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
AScha.3
Chief II

which STMxx ?

+

why do not use the STM USB or STM chip with USB host (MSC probably ) ?

If you feel a post has answered your question, please click "Accept as Solution".
Snehal
Associate II

Actually the hardware team already made a decision on using MAX3421. We are using STM32F103RB.

Snehal
Associate II

Can I get some help here??

Thanks & Regards,

Snehal.

Hardware teams making decisions without consulting a FW dude, thats your real problem

we dont need to firmware by ourselves, lets talk

I agree...but is there any solution for this?

Javier1
Principal

>>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.

Youre looking to use a USB external mass drive (stm32 acts as a host), connected t a PC (stm32 acts as a device) at the same time.

I am not sure this can be done out of the box, never heard anyone using it. I do have heard about people using composite USB (mass drive+Virtual com port)

we dont need to firmware by ourselves, lets talk
Snehal
Associate II

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

As @AScha.3​ said, use the native USB peripheral included in your stm32.

It would be easier and you use one chip less.

If they dont have a very good reason to use MAX3421, they just made your life 100x more difficult, and you look like you dont have a lot of experience already, chances are after a couple of months of pain they end up changing the HW design after you quit.

Trust me on thisone.

0693W00000Y9S4AQAV.png 

Help needed for CASE 1.(this is a STM32 forum, maybe you should ask this question in a mmicrochip forum)

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?

I have never used this MAX3421,beacuse stm32f103 already has USB.

I would bet the SAMD20 should use the (Mass storage device USB profile/stack)

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.

Why dont you ask to the creator of the library?

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

I never used a SAMD20 , but i do believe MAX3421 is transparent to USB, so no SPI anything in SAMD20.

we dont need to firmware by ourselves, lets talk
Snehal
Associate II

Alright. Thanks for your suggestions.