关闭

关闭

封号提示

内容

首页 AN4290 dSPIN™, cSPIN™ and e…

AN4290 dSPIN™, cSPIN™ and easySPIN™ family communication protocol.pdf

AN4290 dSPIN™, cSPIN&…

上传者: mzh6000 2014-03-28 评分 4.5 0 77 11 351 暂无简介 简介 举报

简介:本文档为《AN4290 dSPIN™, cSPIN™ and easySPIN™ family communication protocolpdf》,可适用于IT/计算机领域,主题内容包含AprilDocIDRevANApplicationnotedSPIN,cSPINandeasySPINfamilycommunicationpro符等。

AprilDocIDRevANApplicationnotedSPIN,cSPINandeasySPINfamilycommunicationprotocolByEnricoPoliIntroductionThedevicesofthedSPIN,cSPINandeasySPINfamiliesprovideadvancedfeaturesandhighprogrammabilityThedevicesarecontrolledbyahostmicrocontrollerthroughafastSPIinterfacecompliantwiththedaisychainconfigurationThisdocumentdescribeshowtheSPIcommunicationprotocolisimplementedanditgivessomesuggestionsabouttheapplicationdesignThefeaturesofthedifferentpartsandthecurrentcontrolalgorithms(voltagemodedriving,predictivecurrentcontrolandautoadjusteddecay)arenotinvestigatedinthisdocumentPleaserefertotherespectiveapplicationnoteswwwstcomContentsANDocIDRevContentsSPIcommunicationinterfaceCommunicationprotocolReadingandwritingregisters(GetParamandSetParamcommands)Releasingthefailureflags(GetStatuscommand)Nooperationcommand(NOP)Motioncommands(dSPINandcSPINfamiliesonly)DaisychainRevisionhistoryDocIDRevANSPIcommunicationinterfaceSPIcommunicationinterfaceThedevice(alwaysslave)canbedrivenbyanMCU(alwaysmaster)sendingcommandsthroughanbitSPIinterfaceThebitshiftregisterofthedeviceiskeptenabledwhileCSinputisforcedlowDuringthistime,ateveryraisingedgeoftheserialclock(CK)theSDIinputisstoredintotheshiftregisterAtCKfallingedgestheSDOoutputisupdatedaccordingtothelastbitoftheshiftregister(seeFigure)WhentheCSinputisraised,thedevicecatchestheshiftregistercontentandinterpretsitsvalueasacommandoranargumentofthecommandreceivedpreviouslyAllthebytesaretransmittedstartingfromthemostsignificantbitAteverytransmissioncycle,thatisthetimebetweenthefallingandraisingedgeoftheCSline,thenumberofbytestransmittedbythemasterisequaltothosereceivedFigureSPIinterfacestructureCommunicationprotocolThecommunicationprotocolisbasedonsinglebytecommandsthatcanbefollowedbyacommandargumentuptobyteslongPartoftheinformationneededtoexecutethetargetoperationcouldbeembeddedintothecommandbyte,thatisthetargetdirectionfortheRuncommand,andtheargumentprovidestheextradataaswellasthetargetpositionoftheGoTocommandWhenacommandrequiresanargument,ithastobetransmittedstartingfromthemostsignificantbyteThecommandisnotcompletedanditisnotexecuteduntilalltheargumentbytesarereceivedbythedeviceItisnotpossibleforthetransmissionofacommandtobeabortedonceitisstartedthecommandhastobecompletedandanewcommandcanbeusedTheflowchartofthecommunicationprotocolisshowninFigureSDICKCSSDOLOADShiftregisterTxBufferRxBufferAMvSPIcommunicationinterfaceANDocIDRevFigureCommunicationprotocolflowchartBydefaulttheresponsebyteofthedeviceish(hexadecimalformat)Somecommands,forexamplethoseusedtoreadthevalueofaregister,generatearesponsefromthedeviceuptobyteslongwhichistransmittedduringthefollowingtransmissioncyclesWhenacommandreturnsaresponse,itistransmittedduringthefollowingtransmissioncyclesstartingfromthemostsignificantbyteTheMCUtransmitsabyte(commandorargument)foreachresponsebytethatistransmittedThenumberofrequiredargumentbytesandthenumberofreturnedresponsebytesforeachcommandarelistedinTable(thezerovalueimpliesthatnoargumentisrequestedorthatnoresponseisgenerated)IDLE(waitingforacommandbyte)EXECUTE(commandisexecuted)WaitingforanargumentbyteNewbyteisreceivedNewbyteisreceivedDecodeNOYESYESIsthecommandvalidArgumentbytesareneededMoreargumentbytesareneededNOYESYESNONOAMvDocIDRevANSPIcommunicationinterfaceTableCommandlistCommandArgumentlengthbyteResponselengthbyteNotesNOPSetParamAccordingtothetargetregisterSomeregistersarereadonlySomeregisterscanbesetinspecificconditionsonlyGetParamAccordingtothetargetregisterRun()AvailableindSPINandcSPINfamilydevicesonlyMove()AvailableonlyifthemotorisstoppedGoTo()Availableonlyifapreviouscommandisnotunderexecution(notBUSY)GoToDIR()Availableonlyifapreviouscommandisnotunderexecution(notBUSY)GoHome()Availableonlyifapreviouscommandisnotunderexecution(notBUSY)GoMark()Availableonlyifapreviouscommandisnotunderexecution(notBUSY)GoUntil()ReleaseSW()StepClock()AvailableonlyifthemotorisstoppedSoftStop()HardStop(enableineasySPINfamily)SoftHiZ()HardHiz(disableineasySPINfamily)ResetPos()ResetDevice()GetStatusSPIcommunicationinterfaceANDocIDRevReadingandwritingregisters(GetParamandSetParamcommands)AllthedeviceregisterscanbereadusingtheGetParamandwrittenusingtheSetParamcommandWhilethereadingisalwaysavailable,thewritingoftheregistersisboundtothestateofdrivingofthemotorInparticular:–Someregistersarereadonly–Criticalconfigurationregisterscanbemodifiedonlywhenthepowerstageisdisabled–Someparametersrelatedtothespeedprofileandthepositioningcanbemodifiedwhenthemotorisstopped(dSPINandcSPINfamiliesonly)TheSetParamcommandbyteisdescribedinTableItincludestheaddressofthetargetregistersinfivelowsignificantbits(ADDRtoADDR)Thecommandbytehastobefollowedbyanargumentprovidingthenewregistervalue(mostsignificantbytefirst)anddoesnotgenerateanyresponsebyte(standardresponsebytesarereturnedifnopreviousresponseispending)ThebytelengthoftheargumentdependsonthedimensionofthetargetregisterForexampleabitregisterrequiresabyteargumentandabitregisterrequiresasinglebyteargumentSomebitsoftheargumentcouldbeignoredaccordingtothestructureofthetargetregisterAsaconsequence,theSetParamistheonlycommandcomposedofavariablenumberofbytes(commandbyte,orargumentbytesaccordingtothetargetregister)TheTableliststhenumberofargumentbytesforeachdeviceregisterSomeregistersofthedevicearereadonlyorcanbeonlywritteninparticularconditions(seeTable)IfthehostmicrocontrollersendsaSetParamcommandtargetingareadonlyoranotexistingregister(theaddressvaluedoesnotmatchanyregister)thecommandbyteisignoredandthewrongcommandfailureflagintheSTATUSregisterislatched(inthecSPINfamilydevicesthewrongcommandandthenotperformablecommandfailureflagscorrespondtothesamebit)Inthiscasethefailureoccursassoonasthecommandbyteisreceived,sonoargumentbytemustbesentasshowninFigureTableSetParambytecommandBit#ADDRADDRADDRADDRADDRDocIDRevANSPIcommunicationinterfaceFigureAttempttowriteareadonlynotexistingregisterIfthehostmicrocontrollerattemptstowriteawritableregisterinaforbiddencondition(CONFIGregisterwhenthepowerstageisenabled)thecommandisignoredandthenotperformablecommandfailureflagintheSTATUSregisterislatched(inthecSPINfamilydevices,thewrongcommandandthenotperformablecommandfailureflagscorrespondtothesamebit)InthiscasethefailureoccursassoonasthelastargumentbyteisreceivedasshowninFigureFigureAttempttowritearegisterinaforbiddenconditionTheGetParamcommandbyteisdescribedinTableItincludestheaddressofthetargetregistersinfivelowsignificantbits(ADDRtoADDR)ThecommanddoesnotneedanyargumentandgeneratesaresponsebytesequencecontainingthetargetregistervaluewhichistransmittedstartingfromthemostsignificantbyteThelengthinbytesoftheresponsedependsonthedimensionofthetargetregisterForexampleabitregistergeneratesabyteresponseandabitregistergeneratesasinglebyteresponseAlltheresponsebits,whichdonotmatchthetargetregister,areforcedtozeroTheTableliststhenumberofresponsebytesforeachdeviceregisterTableGetParambytecommandBit#ADDRADDRADDRADDRADDRFromMCU(MOSI)!!SetParam(SPEED)SPEED(byte)SPEED(byte)SPEED(byte)ThetargetregisterisreadonlyThecommandisimmediatelyrefusedandthe“wrongcommand”errorissetThefollowingbytesareacquiredbythedeviceascommandsandnotasthetargetregistervalue(argument)AMvFromMCU(MOSI)!SetParam(CONFIG)CONFIG(byte)CONFIG(byte)ThetargetregistercannotbewrittenincurrentconditionsThecommandisrefusedandthe“notperformablecommand”errorissetPowerstageisenabledAMvSPIcommunicationinterfaceANDocIDRevTableNumberofargumentsorresponsebytesoftheSetParamGetParamcommandsaccordingtothetargetregisterRegisterNumberofbytesNotesABSPOSMARKSPEEDReadonlyELPOSWritablewheninHiZonlyACCWritablewhenstoppedonlyDECWritablewhenstoppedonlyMAXSPEEDMINSPEEDWritablewhenstoppedonlyFSSPDKVALHOLD()KVALRUN()KVALACC()KVALDEC()INTSPEED()WritablewheninHiZonlySTSLP()WritablewheninHiZonlyFNSLPACC()WritablewheninHiZonlyFNSLPDEC()WritablewheninHiZonlyKTHERM()TVALHOLD()TVALRUN()TVALACC()TVALDEC()TFAST()WritablewheninHiZonlyTONMIN()WritablewheninHiZonlyTOFFMIN()WritablewheninHiZonlyADCOUTReadonlyOCDTHSTALLTH()STEPMODEWritablewheninHiZonlyALARMENWritablewhenstoppedonlyGATECFG()WritablewheninHiZonlyGATECFG()WritablewheninHiZonlyDocIDRevANSPIcommunicationinterfaceDuringtheresponsetransmissionthedeviceisstilloperativeandcanreceiveandexecutenewcommands(seeFigure)Ifacommand,requiringanewresponse,isreceivedbeforetheendofthetransmissionofthecurrentresponse,thenewresponsereplacesthepreviousone(seeFigure)FigureResponsetransmissionmanagementFigureResponseabortingIncaseofregisters,whichcanautonomouslychangetheirvaluesuchastheABSPOSregister,theresponsecorrespondstothevalueoftheregisteraftertheGetParamcommandhasbeenreceivedanddecodedIftheregistervaluechangeslater,theresponseisnotupdatedaccordinglyReleasingthefailureflags(GetStatuscommand)AllthefailureflagsintheSTATUSregisterofthedevicearelatchedwhentherespectivealarmconditionistriggeredInthisway,theoccurrenceofatemporaryfailureisstoredintothestatusregisterandtheuseriswarnedaboutitTheflagscanbereleasedthroughtheGetStatuscommandThecommandbyteisdescribedinTableCONFIGWritablewheninHiZonlySTATUSReadonlyLandLonlyL,LandLonlyLandLonlyTableNumberofargumentsorresponsebytesoftheSetParamGetParamcommandsaccordingtothetargetregister(continued)RegisterNumberofbytesNotesABSPOS(byte)ABSPOS(byte)ABSPOS(byte)GetParam(ABSPOS)UnknownNOPNOPFromMCU(MOSI)ToMCU(MISO)SoftStopThecommandisexecutedAMvGetParam(OCDTH)GetParam(STEPMODE)OCDTH(byte)ACC(byte)STEPMODE(byte)GetParam(ACC)UnknownDon’tcareFromMCU(MOSI)ToMCU(MISO)ThenewresponseinterrupsandrepleacesthepreviousoneAMvSPIcommunicationinterfaceANDocIDRevThecommanddoesnotneedanyargumentandgeneratesaresponsebytesequencecontainingtheSTATUSregistervalue(mostsignificantbytefirst)andreleasesallthelatchedfailureflagsTheresponseisgeneratedbeforereleasingtheflags,sothereturnedSTATUSvaluestillcontainsallthefailureinformationThefailureflagsareclearedassoonastheGetStatuscommandbyteisreceivedasshowninFigureFigureGetStatuscommandandfailureflagclearingTheresponsecorrespondstothevalueoftheSTATUSregisteraftertheGetStatuscommandhasbeenreceivedanddecodedIftheregistervaluechangeslater,theresponseisnotupdatedaccordinglyTheSTATUSregistercanalsobereadusingtheGetParamcommandinthiscasethefailureflagsarenotreleasedNooperationcommand(NOP)TheNOPcommandisallzerobyte(asshowninTable),whichdoesnotperformanyactionThisdummycommandbyteallowsthemastertogenerateatransmissioncyclewithouttheslave(orsomeoftheslavesincaseofdaisychainconfiguration)toperformanyoperationTableGetStatusbytecommandBit#FromMCU(MOSI)!GetStatusNOPNOPToMCU(MISO)FLAGoutputUnknownSTATUS(byte)STATUS(byte)FailureflagsareclearedAMvTableNOPbytecommandBit#DocIDRevANSPIcommunicationinterfaceMotioncommands(dSPINandcSPINfamiliesonly)ThemotioncommandsareusedtosendarequesttothemotionenginewhichisintegratedintothedeviceEachcommandrequiresafixednumberofargumentbytesSomemotioncommandscanbeexecutedonlyifparticularconditionsaresatisfied(seeTablefordetails),otherwisethecommandisrefusedandthenotperformablecommandfailureflagintheSTATUSregisterislatched(inthecSPINfamilydevices,thewrongcommandandthenotperformablecommandfailureflagscorrespondtothesamebit)DaisychainANDocIDRevDaisychainThedeviceiscompatiblewiththedaisychainarchitectureallowingtheMCUtodrivemultipledeviceswithasingleSPIinterfaceThedaisychainarchitectureisobtainedasfollows:–MasterserialclocklineisconnectedtotheCKinputofalltheslaves–MasterslaveselectlineisconnectedtotheCSinputofalltheslaves–Masterserialdataoutput(MOSI)isconnectedtotheSDIinputofthefirstslaveofthechain–TheSDOoutputofeachslaveisconnectedtotheSDIinputofthenextslave,lastslaveofthechainexcluded–Masterserialdatainput(MISO)isconnectedtotheSDOoutputofthelastslaveofthechainTheconnectiondiagramoftheconfigurationisshowninFigureFigureDaisychainconnectiondiagramInthisconfigurationthechainofslavesactsasasingleslavewithanSPIdeviceofanumberofbytesAteachcommunicationcycle,whenthemasterneedstotransmitreceiveabytefromtoaslave,themastermustfillalltheshiftregistersoftheslavesbeforeraisingtheCSlineThedevicesareaddressedaccordingtothepositionofthebyteinthecommunicationcycle:thefirstbytetransmittedbythemasterisreceivedbythelastdeviceofthechainthesecondoneisreceivedbythelastbutoneslaveandsoondowntothelasttransmittedbytewhichisreceivedbythefirstslaveofthechainTheresponsebytesfromthedevicechainareaddressedtothesameway:firstbytereceivedbythemasterhasbeentransmittedbythelastdeviceofthechainthesecondonehasbeentransmittedbythelastbutoneslaveandsoondowntothelastreceivedbytewhichhasbeentransmittedbythefirstslaveofthechainSeeFigureasexampleofadaisychainconfigurationwithslavesMCUSerialclockSlaveselectSerialdataoutSerialdatainDevice(stofthechain)toSDIofdevicetoSDIofdeviceXfromSDOofdeviceXfromSDOofdeviceNDeviceXDeviceXDeviceN(lastofthechain)CSCKSDISDOCSCKSDISDOCSCKSDISDOCSCKSDISDOAMvDocIDRevANDaisychainFigureTimediagramofaslavedaisychainThedaisychainconfigurationalsoallowsaperfectsynchronizationintheexecutionofthecommandsbytheslavedevicesConsideringthatallthedevicesacquiretherespectivetransmittedbyteatthesametime(raisingedgeoftheCSline),thedifferentdevicescanstarttheexecutionofacommandatthesametimeasshowninFigureFigureCommandsynchronizationexampleMOSISDOSDOSDOSDISDISDIMISOMOSISDOSDOSDOSDISDISDIMISOMOSISDOSDOSDOSDISDISDIMISOMOSISDOSDOSDOSDISDISDIMISOCSCKCMDCMDCMDCMDANSANSCMDCMDANSANSUnknownDon’tcareANSANSCMDCMDCMDANSANSANSMasterreceivesanswerbytefromdeviceMasterreceivesanswerbytefromdeviceSlavesdecodestherespectiveSPIshiftregistercontentMasterreceivesanswerbytefromdeviceDeviceSPIshiftregisterDeviceSPIshiftregisterDeviceSPIshiftregisterMasterTXbufferMasterRXbufferAMvDaisychainANDocIDRevIntheory,thenumberofslavesthattheMCUcandriveusingthedaisychainconfigurationisunlimitedinpracticethemaximumnumberofdevicesconnectedtothesameSPIdependsontheclockskewThenumberofslavesalsolimitsthecommunicationspeedbecauseeverytimeabytehastobetransmittedtoadevice,thewholeNslavechainhastobefilledtransmittingNextrabytesDocIDRevANRevisionhistoryRevisionhistoryTableDocumentrevisionhistoryDateRevisionChangesAprInitialreleaseANDocIDRevPleaseReadCarefully:InformationinthisdocumentisprovidedsolelyinconnectionwithSTproductsSTMicroelectronicsNVanditssubsidiaries(“ST”)reservetherighttomakechanges,corrections,modificationsorimprovements,tothisdocument,andtheproductsandservicesdescribedhereinatanytime,withoutnoticeAllSTproductsaresoldpursuanttoST’stermsandconditionsofsalePurchasersaresolelyresponsibleforthechoice,selectionanduseoftheSTproductsandservicesdescribedherein,andSTassumesnoliabilitywhatsoeverrelatingtothechoice,selectionoruseoftheSTproductsandservicesdescribedhereinNolicense,expressorimplied,byestoppelorotherwise,toanyintellectualpropertyrightsisgrantedunderthisdocumentIfanypartofthisdocumentreferstoanythirdpartyproductsorservicesitshallnotbedeemedalicensegrantbySTfortheuseofsuchthirdpartyproductsorservices,oranyintellectualpropertycontainedthereinorconsideredasawarrantycoveringtheuseinanymannerwhatsoeverofsuchthirdpartyproductsorservicesoranyintellectualpropertycontainedthereinUNLESSOTHERWISESETFORTHINST’STERMSANDCONDITIONSOFSALE

精彩专题

职业精品

上传我的资料

热门资料

资料评价:

/ 16
所需积分:0 立即下载

意见
反馈

返回
顶部

Q