Texas Instruments TMS320DM357 Switch User Manual


 
USBControllerHostandPeripheralModesOperation
www.ti.com
3.1.1.5.4ErrorHandling
AcontroltransfermaybeabortedduetoaprotocolerrorontheUSB,thehostprematurelyendingthe
transfer,orifthesoftwarewishestoabortthetransfer(e.g.,becauseitcannotprocessthecommand).
ThecontrollerautomaticallydetectsprotocolerrorsandsendsaSTALLpackettothehostunderthe
followingconditions:
ThehostsendsmoredataduringtheOUTDataphaseofawriterequestthanwasspecifiedinthe
command.ThisconditionisdetectedwhenthehostsendsanOUTtokenaftertheDATAENDbit(bit3
ofPERI_CSR0)hasbeenset.
ThehostrequestsmoredataduringtheINDataphaseofareadrequestthanwasspecifiedinthe
command.ThisconditionisdetectedwhenthehostsendsanINtokenaftertheDATAENDbitinthe
PERI_CSR0registerhasbeenset.
ThehostsendsmorethanMaxPacketSizedatabytesinanOUTdatapacket.
Thehostsendsanon-zerolengthDATA1packetduringtheSTATUSphaseofareadrequest.
WhenthecontrollerhassenttheSTALLpacket,itsetstheSENTSTALLbit(bit2ofPERI_CSR0)and
generatesaninterrupt.Whenthesoftwarereceivesanendpoint0interruptwiththeSENTSTALLbitset,it
shouldabortthecurrenttransfer,cleartheSENTSTALLbit,andreturntotheIDLEstate.
IfthehostprematurelyendsatransferbyenteringtheSTATUSphasebeforeallthedatafortherequest
hasbeentransferred,orbysendinganewSETUPpacketbeforecompletingthecurrenttransfer,thenthe
SETUPENDbit(bit4ofPERI_CSR0)willbesetandanendpoint0interruptgenerated.Whenthe
softwarereceivesanendpoint0interruptwiththeSETUPENDbitset,itshouldabortthecurrenttransfer,
settheSERV_SETUPENDbit(bit7ofPERI_CSR0),andreturntotheIDLEstate.IftheRXPKTRDYbit
(bit0ofPERI_CSR0)issetthisindicatesthatthehosthassentanotherSETUPpacketandthesoftware
shouldthenprocessthiscommand.
Ifthesoftwarewantstoabortthecurrenttransfer,becauseitcannotprocessthecommandorhassome
otherinternalerror,thenitshouldsettheSENDSTALLbit(bit5ofPERI_CSR0).Thecontrollerwillthen
sendaSTALLpackettothehost,settheSENTSTALLbit(bit2ofPERI_CSR0)andgenerateanendpoint
0interrupt.
3.1.1.5.5AdditionalConditions
Whenworkingasaperipheraldevice,thecontrollerautomaticallyrespondstocertainconditionsonthe
USBbusoractionsbythehost.Thedetailsaregivenbelow:
StallIssuedtoControlTransfers
ThehostsendsmoredataduringanOUTDataphaseofaControltransferthanwasspecifiedin
thedevicerequestduringtheSETUPphase.Thisconditionisdetectedbythecontrollerwhenthe
hostsendsanOUTtoken(insteadofanINtoken)afterthesoftwarehasunloadedthelastOUT
packetandsetDataEnd.
ThehostrequestsmoredataduringanINdataphaseofaControltransferthanwasspecifiedin
thedevicerequestduringtheSETUPphase.Thisconditionisdetectedbythecontrollerwhenthe
hostsendsanINtoken(insteadofanOUTtoken)afterthesoftwarehasclearedTXPKTRDYand
setDataEndinresponsetotheACKissuedbythehosttowhatshouldhavebeenthelastpacket.
ThehostsendsmorethanMaxPktSizedatawithanOUTdatatoken.
ThehostsendsthewrongPIDfortheOUTStatusphaseofaControltransfer.
ThehostsendsmorethanazerolengthdatapacketfortheOUTStatusphase.
ZeroLengthOutDataPacketsInControlTransfer
AzerolengthOUTdatapacketisusedtoindicatetheendofaControltransfer.Innormal
operation,suchpacketsshouldonlybereceivedaftertheentirelengthofthedevicerequesthas
beentransferred(i.e.,afterthesoftwarehassetDataEnd).If,however,thehostsendsazero
lengthOUTdatapacketbeforetheentirelengthofdevicerequesthasbeentransferred,thissignals
theprematureendofthetransfer.Inthiscase,thecontrollerwillautomaticallyflushanyINtoken
loadedbysoftwarereadyfortheDataphasefromtheFIFOandsetSETUPENDbit(bit4of
PERI_CSR0).
UniversalSerialBus(USB)Controller 36SPRUGH3November2008
SubmitDocumentationFeedback