关闭

关闭

封号提示

内容

首页 AN4290 dSPIN™, cSPIN™ and e…

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

AN4290 dSPIN™, cSPIN&…

上传者: 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

类似资料

该用户的其他资料

教你七天变身肌肉男.pdf

晚会专用:游戏惩罚整蛊方法_晚会游戏惩罚项目_晚会游戏惩罚.doc

贴片铝电解电容封装尺寸定义.pdf

STM32F4DISCOVERY.pdf

AN4144 Voltage mode control operation and parameter optimization.pdf

职业精品

精彩专题

中国制造,引领“世界第一”

近十年来,我国制造业持续快速发展,总体规模大幅提升,综合实力不断增强,不仅对国内经济和社会发展做出了重要贡献,而且成为支撑世界经济的重要力量。你绝对想不到,中国制造有这么多“世界第一”

用户评论

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

精选资料

热门资料排行换一换

  • 郭德维:楚系墓葬研究.pdf

  • 朱子语类⑥[宋]黎靖德.pdf

  • 朱子语类⑦[宋]黎靖德.pdf

  • 朱子语类⑧[宋]黎靖德.pdf

  • 财富杂志推荐75本书之引爆流行.…

  • 财富杂志推荐75本书之与天为敌.…

  • 自考笔记 自考小抄 自考串讲 ㊣…

  • 双向式英语第一册语法注解.pdf

  • 地质学概论-夏邦栋.pdf

  • 资料评价:

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

    意见
    反馈

    返回
    顶部