Signaling USB connection

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

Signaling USB connection

567 Views
biafra
Senior Contributor I

Hi everyone,

 

I'm working on a project using K65F180M device with KDS 3.2 and KSDK 2.0.

The device use USB stack and acts as a USB device.

My question is: when is the best moment to turn on a led to signal that the device is correctly recognized? The set configuration event, the set interface event, the attach event or some other event?

I suppose that the best moment to turn off the led could be the bus reset event: there is a better moment to do this?

 

Many thanks

Biafra

Labels (1)
3 Replies

429 Views
TICS_Fiona
NXP Employee
NXP Employee

Hello  Francesco,

A USB device has six types of states:

 

  • Attached — A device is attached to the USB. It is not powered by the USB

 

  • Powered — A device is attached to the USB and powered by the USB. This device has not been reset

 

  • Default — A device is attached to the USB and powered and has been reset. It has not been

assigned a unique address, the device responds at the default address and is in default state

 

  • HelloAddress — If a device is in default state and a unique device address has been assigned, and the device is not configured, then the device is transitioned to address state.

 

  • Configured — If a device is already in address state and configured, and is not suspended, then the device enters configured state in which the host can use the functions provided by the device.

 

  • Suspended — If a device is in powered, default, address, configured, and has no bus activity for

3 ms, it enters suspend state. The host may not use the function of a suspended device.

It is up to your application in which state to turn on the led.

Best Regards
Fiona Kuang
TIC - Technical Information Center
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Mark Correct button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

429 Views
biafra
Senior Contributor I

Hi Fiona,

Many thanks for your answer.

I know the state list: my doubt is which command is to change the device state.

Many thanks

Biafra

429 Views
bobpaddock
Senior Contributor III

The device enters the 'Ready' state on reception of the first 'In' token after the address has been set in the 'Setup' state.

Turning the LED off with 'Reset' would work.  There are always multiple bus resets.  On Windows there will be at least two, with four to six being typical.