Interconnectivity Page 11 of 22
Firmware Programming Guide for PDIUSBD12
Philips Semiconductors - Asia Product Innovation Centre
Visit http://www.flexiusb.com
The flowchart below shows the Control Out handler. To illustrate, an example of the Host requesting a standard
device request say "Get Descriptor()".
When the setup packet is received by the USB device D12, this device will generate an interrupt to the MCU.
The microcontroller will need to service this interrupt by reading D12 interrupt register to determine whether the
packet is send to Control Endpoint or the Generic Endpoint. If the packet is for the Control Endpoint, MCU will
need to further determine whether the data is a setup packet through reading the D12 Read Last Transaction
Status Register. For the Get_Descriptor device request, the first packet will have to be the setup packet.
From the flowchart above, MCU will need to extract the content of the setup packet through Select Control Out
Endpoint to determine whether this endpoint is full or empty. If the control endpoint is full, MCU will then read
the content from the buffer and save the content to its memory. After that, it will validate the host device's
request from the memory. If it is a valid request, MCU must send the Acknowledge Setup command to the
Control Out endpoint to re-enable the next setup phase.
Control Out Handler
Setup Packet?
Select Control Out Endpoint
Read Buffer, save to DeviceRequest
Clear Buffer
Valid Device
Request?
Acknowledge Setup on
Control In and Control Out
Control Read?
Control Write with
Data?
Data length
Acceptable?
Control State <- USB_RECEIVE
End of Handler
Yes
Yes
No
Yes
Yes
Stall Control
Endpoints
No
No
State
USB_RECEIVE?
Control State <- USB_TRANSMIT
Set Event: Setup Packet
Control State <- USB_IDLE
Set Event: Setup Packet
No
Yes
Select Control Out Endpoint
Read Buffer, save to Control Data Buffer
Clear Buffer
All Data Received?
Control State <- USB_IDLE
Set Event: Setup Packet
Yes
Yes
No
No
Control State <- USB_IDLE
No