您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 资本运营 > STM32系列永磁同步电机库SDK培训材料9
Agenda•2ndday–Morning•Userinterface•SerialProtocal•DAC•LCD•DACcustomization•STM32MCWorkbenchpresentationindetail•2ndday–Afternoon•QuickStart•ConfigthefirmwarelibwithWorkbench•LCDUserInterface•IARIDE–MCWorkspace•Practicalhintsinmotortuning:•Drawanarbitrarysensorlessstart-upwaveform•Openloopfeature•Faultsgeneration•Motorstart-up•Demo,Q&A129/03/2013STM32PMSMFOCSDKv3.2Userinterfacearchitecture•Theuserinterfaceclass(CUI)managestheinteractionbetweentheuserandthemotorcontrollibrary(MCLibrary)throughtheuseofthemotorcontrolapplication(MCApplication).229/03/2013STM32PMSMFOCSDKv3.2UserInterfaceCUILCDManagerSerialcommunicationDACUserMCApplicationUserinterfacearchitecture•LCDManagerClass(CLCD_UI)isusedtointeractwiththeLCDcolordisplay.IthasbeenimplementedoverthegraphicallibrarySTMFCwritteninC++language.329/03/2013STM32PMSMFOCSDKv3.2UserInterfaceCUILCDManagerSerialcommunicationDACUserMCApplicationUserinterfacearchitecture•Motorcontrolprotocol(CMCP_UI)isusedtomanageserialcommunications.429/03/2013STM32PMSMFOCSDKv3.2UserInterfaceCUILCDManagerSerialcommunicationDACUserMCApplicationUserinterfacearchitecture•DACmanager(CDAC_UI)isusedtomanagetheDACoutputs.529/03/2013STM32PMSMFOCSDKv3.2UserInterfaceCUILCDManagerSerialcommunicationDACUserMCApplicationFrameCommunicationProtocolPhysicalLayerCommunicationUserinterfaceblockdiagram629/03/2013STM32PMSMFOCSDKv3.2UserInterfaceCUICMCP_UICLCD_UICDAC_UICDACT_UICDACS_UICFCPSTMFCCCOMCUSART_COMCI2C_COMCSPI_COMMCIAMCTAUIcfgAMCIBMCTBUIcfgBMCICMCTCUIcfgCMCINMCTNUIcfgNPrivatemember-ListofDrives-DriveNum-SelecteddriveMCP_InitLCD_InitMCObjectUI_IinitMotorControlProtocolLCDManagerDACManagerDACManagerDACManagerUserinterfacearchitecture•Motorcontrolprotocol(CMCP_UI)isusedtomanageserialcommunications.729/03/2013STM32PMSMFOCSDKv3.2UserInterfaceCUILCDManagerSerialcommunicationDACUserMCApplicationSerialcommunication•Usuallyinthemarket,theapplicationsthatrequireanelectricalmotortobedrivenshouldhavetheelectronicssplitintwoparts:“Applicationboard”and“MotorDriveboard”.•Toproperdrivethesystemthe“Applicationboard”requireamethodtosendcommandtothe“MotorDriveboard”andgetfeedbackfromit.Usuallythisisperformedusingaserialcommunication.•Serialcommunicationcanbeusefulalsoduringtheevaluation,debuggingandtuningofmotorcontrolHW/SW.829/03/2013STM32PMSMFOCSDKv3.2Masterslavearchitecture•Theimplementedcommunicationprotocolisbasedona“master-slave”architectureinwhichthemotorcontrolfirmwarerunningonSTM32microcontrolleristhe“slave”.•Atanytimethe“master”,usuallyaPCoranothermicrocontrollerpresentona“master”board,canstartthecommunicationsendingtothe“slave”thefirstcommunicationframe.The“slave”answertothisframewiththeacknowledgeframe.929/03/2013STM32PMSMFOCSDKv3.2MasterMasterSlaveSlaveAcknowledgmentframeStartingframeStartingframe•Agenericstartingframeiscomposedby:•Frame_ID,itisabytethatdefinewhichisthe“type”ofthestartingframe•Payload_Length,itisthetotalnumberofbytethatactuallycomposetheframepayload,•Payload_ID,itisthefirstbyteofpayloadandcontainstheidentifierofpayload,itcanbemissedifnotrequiredbythis“type”offrame,•Payload[x],itistheremainingpayloadcontent,itcanbemissedifnotrequiredbythis“type”offrame,•CRC,itisabyteusedforcyclicredundancycheck.1029/03/2013STM32PMSMFOCSDKv3.2GenericstartingframeFRAME_IDPAYLOAD_LENGTHPAYLOAD_IDPAYLOAD[0]…PAYLOAD[n]CRCFrameIDs1129/03/2013STM32PMSMFOCSDKv3.2Frame_IDDescriptionMSB3bitMotorselectionID0x01(LSB5bit)Setregisterframe.Itisusedtowriteavalueintoarelevantmotorcontrolvariable.SeeSetregisterframe.0x02Getregisterframe.Itisusedtoreadavaluefromarelevantmotorcontrolvariable.SeeGetregisterframe.0x03Executecommandframe.Itisusedtosendacommandtothemotorcontrolobject.SeeExecutecommandframe.0x06Getboardinfo.Itisusedtoretrievetheinformationaboutthefirmwarecurrentlyrunningonthemicrocontroller.0x07Execramp.Itisusedtoexecuteaspeedramp.SeeExecuterampframe.0x08Getrevupdata.Itisusedtoretrievetherevupparameters.SeeGetrevupdataframe.0x09Setrevupdata.Itisusedtosettherevupparameters.SeeSetrevupdataframe.0x0ASetcurrentreferences.Itisusedtosetcurrentreference.SeeSetcurrentreferencesframe.Setregisterframe•Thesetregisterframeissentbythemastertowriteavalueintoarelevantmotorcontrolvariable.•Payloadlengthdependsonreg_id.•Regidindicatestheregistertobeupdated.•Remainingpayloadcontainsthevaluetobeupdatedstartingfromleastsignificantbytetomostsignificantbyte.1229/03/2013STM32PMSMFOCSDKv3.2SetregisterPC0x01PAYLOAD_LENGTHREG_IDREG_LB…REG_HBCRCSetregisterframeBoard0xF00x00CRCDataAcknowledgmentframe,NoerrorsPC0x01PAYLOAD_LENGTHREG_IDREG_LB…REG_HBCRCSetregisterframeBoard0xFF0x01ERROR_CODECRCErrorAcknowledgmentframeORMotorcontrolregisters1329/03/2013STM32PMSMFOCSDKv3.2Getregisterframe•Thegetregisterframeissentbythemastertoreadavaluefromarelevantmotorcontrolvariable.•Payloadlengthisalways1.•RegIdindicatestheregistertobequeried.•TheAcknowledgmentframecanbeoftwotypes:•DataAcknowledgmentframe,iftheoperationhasbeensuccessfullycompleted.InthiscasethereturnedvalueisembeddedintheDataAcknowledgmentframe.•ErrorAcknowledgmentframe,iftheope
本文标题:STM32系列永磁同步电机库SDK培训材料9
链接地址:https://www.777doc.com/doc-5427782 .html