K60 USB FS/LS OTG Controller: Few questions

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

K60 USB FS/LS OTG Controller: Few questions

3,904 Views
kaitav
Contributor III

Hi everyone,

I am trying to implement USB OTG interface using Kinetis K60 microcontroller and have a few questions after doing some study. I am using the USB interface which has on-chip transceiver for OTG (chapter 48 in User Manual) and following questions are related to the same:

Q1. Is it must to use external IC (MAX3353E) for implementing OTG?

If so, what makes it necessary to have? I mean the microcontroller has configurable pull-ups and pull-downs, I can detect ID pin by connecting it to a GPIO and I can use external charge pump IC to support more devices on my TPL than what I can using MAX3353E. I was thinking that since OTG controller is built in with transceiver, I won't be required to interface such external IC and increase my burden by having to add even additional software in the form of I2C interface.

Q2. What are the values of internal pull ups and pull downs used in USB OTG interface? I am unable to find them in technical datasheet and user manual.

Edit: Ok, pull downs are 15Kohm - mentioned in user manual.

Q3. Does this OTG module support ADP protocol, VBUS discharging, data line pulsing, etc. required by the OTG standard? I can see that MAX3353E supports this but I can also see that the same is supported b the HS OTG controller in K60 (chapter 51 in user manual) but no such information is present in chapter 48.

I would really appreciate your answers.

Thank you,

Kaitav

Message was edited by: Kaitav Sapre: Edited Q2.

Labels (2)
25 Replies

1,533 Views
maddyv
Contributor I

Hi Hui/Kaitav,

If possible share a pointer to dual role controller sample code.

Thanks,

Maddy

0 Kudos

1,533 Views
kaitav
Contributor III

Hi Madhavan,

You can check the examples in the CodeWarrior installation directory.

C:\Freescale\CW_MCU_v10.4\MCU\CodeWarrior_Examples\Kinetis_Examples\src\projects

0 Kudos

1,533 Views
maddyv
Contributor I

Thanks Kaitav

0 Kudos

1,533 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Sapre,

Q1. Is it must to use external IC (MAX3353E) for implementing OTG?

If so, what makes it necessary to have? I mean the microcontroller has configurable pull-ups and pull-downs, I can detect ID pin by connecting it to a GPIO and I can use external charge pump IC to support more devices on my TPL than what I can using MAX3353E. I was thinking that since OTG controller is built in with transceiver, I won't be required to interface such external IC and increase my burden by having to add even additional software in the form of I2C interface.

A1: It need to use external MAX3353E USB OTG PHY for implement USB OTG function. The OTG PHY supports USB OTG session request protocol

(SRP) and host negotiation protocol (HNP). If just use external charge pump IC and connect ID to a GPIO pin, which will be USB dual-role mode. The difference between OTG and dual-role controller.

OTG: on the go, it is the protocol used EXCLUSIVELY for two devices that are OTG capable to interchange host and device roles dynamically without loosing connection.

Dual role controller: a USB controller that can be either host or device in different connections. Some dual role controllers are OTG capable and some are not.

usb.jpg

Q2. What are the values of internal pull ups and pull downs used in USB OTG interface? I am unable to find them in technical datasheet and user manual.

Edit: Ok, pull downs are 15Kohm - mentioned in user manual.

A2: The internal pull up is 1.5Kohm, internal pull down is 15Kohm.

Q3. Does this OTG module support ADP protocol, VBUS discharging, data line pulsing, etc. required by the OTG standard? I can see that MAX3353E supports this but I can also see that the same is supported b the HS OTG controller in K60 (chapter 51 in user manual) but no such information is present in chapter 48.

A3: I think your means Session request protocol (SRP), which is required by the OTG standard.

Wish it helps.

B.R.

Ma Hui

1,533 Views
kaitav
Contributor III

Hi Hui,

First of all, thanks for your answers.

Q1/A1) Well, I am a little confused. Isn't the K60's USB OTG controller OTG capable? I mean the manual does say that it supports USB OTG supplement 2.0.

So if I want to implement actual OTG functionality with SRP and HNP, it is must to use MAX3353 or similar IC, right?!

I think user manual should mention this clearly to avoid confusion to the developers.

Does the USB dual role diagram shown by you use a USB OTG Micro-AB connector?

Q3/A3) Yes, I mean SRP and HNP (and also ADP, which seems to be optional). If I want to build a true OTG device, I have to implement these protocols and therefore have to use an external IC to have the hardware support for these protocols. Am I understanding it correctly?

Sorry, if I am sounding repetitive but I just want to clear my doubts.

Thanks again,

Kaitav

0 Kudos

1,533 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Kaitav,

About Q1&Q3, the answer is Yes, if customer need reality USB OTG function,  K60 USB module need connect with external OTG capacity PHY chip , such as MAX3353.

The USB dual role diagram is using USB mini-AB connector.

More detailed info, please check below picture:

USB Mini AB connector.jpg

Wish it helps.

1,533 Views
kaitav
Contributor III

Hi Hui,

Ok, thanks a lot for answer. Now I understand it properly. However, there is one final confusion on which I need your help.

If we are just offering dual role functionality (without external MAX3353 IC) can we use Micro-AB connector for dual-role?


I am asking because as per standard, Micro-AB should be used exclusively for OTG, in case of which I guess we will have to support HNP and SRP.(?) Or, is it not must to support these protocols if we want to have a dual-role device? If this is the case, we won't be able to call our product OTG compliant, right?

Please advice.

Thanks again,

Kaitav

0 Kudos

1,533 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Kaitav,

I think you can use Micro-AB connector for dual-role function, which is same with Mini-AB connector.

When it connect with Host converter, the ID pin is grounded and the software will recognize it as USB host mode, otherwise software will deal it as USB device.

With USB dual role function, there is no support HNP and SRP protocols, which means it could not support interchange host and device roles dynamically without losing connection.

The USB dual role function operation based on below picture shows.

dual role operation.jpg

Wish it helps.

0 Kudos

1,533 Views
kaitav
Contributor III

Hi Hui,

Okay. Yes, that's right because Micro-AB is the replacement of Mini-AB connector as per usb.org.

Thanks again for the explanation. Actually there was no confusion on how to make it work in "dual role" (it was only about OTG), and we were thinking exactly how you have shown. :smileyhappy:

Sorry, but I have a few more related questions:

1) In dual-role mode, we will have ID pin connected a GPIO. Also there are no dedicated USB ID and VBUS pins in K60 uC, then how are the interrupts related to ID, attach/detach and VBUS generated as mentioned in the USB registers section in user manual? (Registers: USBx_OTGISTAT, USBx_OTGICR, USBx_OTGSTAT, USBx_OTGCTL, USBx_ISTAT)

2) In section 48.4.8 OTG Control Register (USBx_OTGCTL), it is mentioned that we can enable and disable internal pull resistors on USB D- & D+ lines but I am not able to understand bit 2 (OTGEN):

-  If OTGEN = 1, we need to set the pull resistors in our code by using the other bits of this register.

-  If OTGEN = 0 (assuming other mentioned conditions are satisfied), the pull resistors are automatically connected.

Is it correct?

3) When operating in device mode, during full speed negotiation, the D+ pull up resistor is engaged. After the negotiation is completed, should we disable this register or is it ok if I keep it always enabled during communication? (The logic level for D+ even with PU enabled will be ~3V (coz of 1.5K PU and 15K host PD) which is above VHmin of 2.8V.) I know, this is more of a USB standard question, but I am not able find any concrete answer on it so thought to ask you.

Thanks a lot for your support.

Kaitav

0 Kudos

1,533 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Kaitav,

Thank you for the patience.

A1> For the dual role mode, the ID pin connect to a GPIO pin, it need to detect GPIO related register to get the ID state. USB attach/detach status could be get from Interrupt Status Register (USBx_ISTAT).

VBUS generated controlled via GPIO pin, about VBUS voltage detect based on external regulator chip and related circuit, could use ADC pin to detect VBUS voltage.

A2> You understanding is quite correct.  With OTGEN bit 0 value, the pull ressitor is auto connected if USB_EN is set and HOST_MODE is clear in the Control Register (CTL).

A3> When operating in USB device mode, it is ok to keep the D+ pull up resistor pull up during the USB communication.

Wish it helps.

0 Kudos

1,533 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

One more comments about VBUS voltage detection: For some Kinetis chip with 5V tolerance GPIO pin, you can use GPIO pin to detect VBUS 5V voltage with current limiting resistor.

Wish it helps.

0 Kudos

1,533 Views
kaitav
Contributor III

Hi Hui,

Thank you for the answers. It did help to resolve some doubts, however, the 1st point is still unclear - ID, attach/detach and VBUS related.

For detection of the VBUS voltage, I agree with your suggestions. But instead of using ADC (which may cause a bit overhead on the software), we will use a GPIO pin to detect it. K60 does have 5V tolerant GPIOs, but we will use a resistor divider (to convert it to ~3.3V), thereby also limiting the current.

Now about registers: Since the USB controller is dual-role only, how will it detect the VBUS session voltage and attach/detach and other things mentioned in USBx_OTGISTAT without the hardware related to it? As per the register definition, it seems to do this as if it had dedicated pins to detect them - but it does not have!

If we use GPIO to detect ID pin and VBUS, how will the bits in this register get updated?

Also there is this register:

48.4.7 OTG Status Register (USBx_OTGSTAT): The OTG Status Register displays the actual value from the external comparator outputs of the ID pin and VBUS.

From this I understand that it depends on some external IC to get the ID, VBUS and session voltage related information...?

Does this mean these registers will work only when using MAX3353?

Sorry but I am confused with how exactly the below registers are working:

USBx_OTGISTAT,

USBx_OTGICR,

USBx_OTGSTAT,

USBx_OTGCTL,

USBx_ISTAT


Your help will be highly appreciable.


Thanks,

Kaitav

0 Kudos

1,533 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

When the USB in dual-role mode, the VBUS voltage detect via a GPIO pin is better than using ADC pin.

About how the Kinetis MCU know USB attach/deattach, in fact, after the another USB device/host connects with the board, the board will according VBUS/ID state to detect which mode will be, host or device.

Then after the USB module initialization, the USB attach/deattach interrupt will generate.

In related USB interrupt service routine, the Kinetis MCU will know another USB device/host connected.

In fact, the OTG related register will not be used for USB operation.

Wish it helps. 

0 Kudos

1,533 Views
kaitav
Contributor III

Hi Hui,

Let me confirm my understanding.

Suppose I connect micro-A end of the cable to our dual role board and I have connected ID pin to a GPIO. My board now knows that since ID=0, I have to be host. Let's say I have not connected any device on other side of the cable. Will the attach/detach interrupt still be generated in this case? That is it only depends on ID pin only?

However, I am still confused with the point as to how the USB register bits will get updated if I am connecting something to GPIO pins which have a register of their own. :smileysad:

Isn't is that K60 should read the status of the pin and put the respective values in USBx_OTGISTAT from where my software can read it and take further actions?

The following description is the cause of confusion:

"42.5.5 OTG Interrupt Status register (USBx_OTGISTAT)

Records changes of the ID sense and VBUS signals. Software can read this register todetermine the event that triggers interrupt.

Field Description: 7 IDCHG: This bit is set when a change in the ID Signal from the USB connector is sensed...."

As you said, OTG related registers will not be used in such case - but since all the registers are named from OTG convention (i.e. OTGSTAT, OTGCTL, etc), could you please tell me that which registers will be used in dual role and which won't be used?

Edit: I want to know current consumption on 5V VREGIN for K60's internal USB transceiver. Where can I get this information?

Thanks,

Kaitav

0 Kudos

1,533 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Kaitav,

The board ID pin will determine which USB mode the dual role board will be. When the ID pin is 0, the software will run USB host mode. After that, the USB module will be initialized and when there with USB device attached/deatach, the related interrupt will be triggered. The USB mode determined by ID pin status, is not very accuracy. In my mind, the board will run USB mode checking routine always, until which status become true. Then, the board will run USB host related software or USB device related software. If there with no cretain confirmed status from default(VBUS = 0V and ID = Floating), the software will in USB mode checking routine always.

The OTG related register will not be used, which use USB related register instead, such as Interrupt Status Register (USBx_ISTAT).

About VREGIN power consumption, please check below picture for more detailed info, which shows in Kinetis related datasheet.

VREGIN.jpg

Wish it helps.

0 Kudos

1,533 Views
kaitav
Contributor III

Hi Hui,

Hmmm, but unfortunately it still not quite clear to me, especially regarding interrupt generation and the registers.

Regarding initialization, I think by default, the USB will be in device mode, i.e. ID pin is floating (actually high because of pull-up resistor) in absence of both - no cable connection or an actual device connection. When ID pin will go low, it will change itself to host mode. But indeed, we also have to run the routine where ID pin is continuously checked.

Thanks for current consumption, but the value mentioned is actual capacity of internal VREGIN regulator, not the USB transceiver consumption. Could you please tell what will the USB transceiver consume on 5V_VREGIN voltage?

Thanks,

Kaitav

0 Kudos

1,533 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Kaitav,

About how the USB interrupt generation, I suggest to refer USB stack for Kinetis with below link:

http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=MEDICALUSB&fsrch=1&sr=8

By default, the board does not know which USB mode it will be, it will be in USB mode checking routine always, until there connect with USB host or USB device. After connection, it know which USB routine to run(USB host or USB device).

The USB transceiver power consumption typical value is 120uA, Max. value is 186uA.

Wish it helps.

B.R.

Ma Hui

0 Kudos

1,533 Views
kaitav
Contributor III

Hi Hui,

Okay, I will check the USB stack documentation and come back to you.

Regarding current consumption, is 186uA the maximum current consumption when transceiver is in FS operation? Confirming again because I am surprised to see that is so less. I thought it would be 30-40mA!

Thanks,

Kaitav

0 Kudos

1,533 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Kaitav

The 186uA is not the transceiver in FS operation current, which is quiescent current.  So far, there is no USB transceiver operation current, sorry for that.

B.R.

Ma Hui

0 Kudos

1,533 Views
kaitav
Contributor III

Hi Hui,

I see... Okay fine, thanks for the reply.

Regards,

Kaitav

0 Kudos