首页 AN4290 dSPIN, cSPIN and easySPIN family communi…

AN4290 dSPIN, cSPIN and easySPIN family communication protocol.pdf

AN4290 dSPIN, cSPIN and easySPI…

上传者: mzh6000 2014-03-28 评分1 评论0 下载0 收藏0 阅读量351 暂无简介 简介 举报

简介:本文档为《AN4290 dSPIN, cSPIN and easySPIN family communication protocolpdf》,可适用于电子通讯领域,主题内容包含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

职业精品

(汽车)产品营销策划书范文.doc

HH牙膏营销方案策划书.doc

加班管理人力资源考勤管理系统方案.doc

物品采购管理制度-正式.doc

用户评论

0/200
    暂无评论
上传我的资料

精彩专题

相关资料换一换

  • 160 SSC ™.…

  • namp_ustage2.pdf

  • NampCookBook.pdf

  • IFRS™ …

  • AN4241 dSPIN fam…

  • DSP for MATLAB a…

  • DSP for MATLAB a…

  • DSP for MATLAB a…

  • Cell Culture Ves…

  • Cell Culture Ves…

资料评价:

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

意见
反馈

返回
顶部