USB OTG with two USB connectors on-board

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USB OTG with two USB connectors on-board

3,793 Views
pozz
Contributor III

I'm designing a new board based on Kinetis K20 microcontroller. I'd like to have a board with two USB connector: a micro USB type-B receptacle for a PC connection and a USB type-A receptacle for pendrive.

I'm thinking about the following schematic:

Clipboard01.png

The MCU is self-powered so the power supply from PC is used only for sensing its presence for two purposes: switch the USB stack in host-mode and disable the power supply to the pendrive (if any is connected).

The pendrive can be inserted directly in the USB type-A receptacle on the board, the PC can be connected with a normal micro USB cable.

What do you think? Will it work?

Labels (2)
Tags (1)
7 Replies

1,053 Views
Kan_Li
NXP TechSupport
NXP TechSupport

I think your application needs two USB ports, one for PC connection, and the other for pendrive, so I think Kinetis 120MHz/150MHz part which has both USBOTG and USBHS could be used for your case.


Have a great day,
Kan

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,053 Views
giuseppemodugno
Contributor I

I think I have exposed my problem in a wrong way. I don't need two USB ports (host and device) at the same time. When I use pendrive (host), I don't need PC (device) and viceversa. So one OTG USB port, as in K20, is sufficient.

The question is how the microcontroller understands if it is a host or device? It's the ID pin of the USB OTG connector that is grounded in the USB OTG cable on the host side. Which pin of microcontroller the ID pin should connected to? Whatever GPIO pin?

0 Kudos

1,053 Views
Kan_Li
NXP TechSupport
NXP TechSupport

The Kinetis USB controller IP has USB OTG capability and it could support USB_ID pin signal status detection. While during USB related circuit design, our product design team think the USB_ID pin could be removed and customer can use another GPIO or another way replace this pin (such as using I2C communication with MAX3353 chip). The K60 document USB related info should be updated to mask/notice that USB ID signal status bit in USB status register couldn't be used although it does exists in related registers. Sorry for our document issue may bring any inconvenience to you.

For Kinetis USB module does not provide external USB_ID pin, this USB module doesn't provide related ID interrupt function. If customer want to use Kinetis USB OTG function, it need to add external USB OTG charge pump MAX3353. The ID status can get from MAX3353 register by I2C communication. During the USB application, customer need to read MAX3353 status register to get ID signal. Then based on ID signal to determine start USB controller as USB host or USB device. Wish it helps.

If use USB OTG function, it must to use external USB OTG PHY(such as MAX3353E). For MAX3353E provide dual direction of VBUS and can support USB OTG session request protocol (SRP) and host negotiation protocol (HNP).


Have a great day,
Kan

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,053 Views
giuseppemodugno
Contributor I

Hello Kan,

thank you again for your answer.

Just to summarize. USB OTG controller implemented in Kinetis microcontroller can work in host or device mode, but the selection is fixed by circuit/firmware: I can develop a board and firmware that work in host mode only or I can develop a board and firmware that work in device mode only.

If I need host and device type functionalities at run-time (of course, not at the same time, but depending on the cable or device connected) I need an external USB OTG controller/PHY such as MAX3353E.Is there a Freescale development board that implements this (host and device mode switch at run-time) with working code?

I don't think I have the knowledge to design this kind of board/firmware starting from the scratch. I need an example board/firmware that really works.

0 Kudos

1,053 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi,

Yes, TWR-SER board should be a good solution for your case, and you may refer to TWR-SER: Serial (USB, Ethernet, CAN, RS232/485) Tower System Module for more details.

Hope that helps,


Have a great day,
Kan

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,053 Views
giuseppemodugno
Contributor I

I downloaded the schematics of TWR-SER and they're a good starting point to develop a custom board with USB OTG support.

The problem now is to have a starting point for the firmware of the microcontroller. I have searched for something useful in the demo applications for Kinetis tower microcontroller boards (compatible with TWR-SER), but I only found examples that use the USB as host or device type (the mouse application), never in the same firmware both modes.

0 Kudos

1,053 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Actually Freescale USB Stack 4.1.1 supports OTG now, and you may download it from USB Stack, after installation, you may find the demos as shown the following snapshot;

result.png

Hope that helps,


Have a great day,
Kan

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------