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_COMMCIAMCTAUIcfgAMCIBMCTBUIcfgBMCICMCTCUIcfgCMCINMCTNUIcfgNPrivatemember-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

1 / 28
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功