<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      基于MCSDK 6.x 的自定義控制板實(shí)現(xiàn)

      前言

      本文介紹了如何在ST的MCSDK 6.x中,通過撰寫配置文件,以實(shí)現(xiàn)自定義的控制套件。

      關(guān)鍵詞:FOC,MCSDK,STM32,STMC Board Manager

      準(zhǔn)備

      在啟動(dòng)MCSDK后,需要選擇電機(jī),控制器和驅(qū)動(dòng)器。對于Modular,需要分別配置Power BoardControl Board,Inverter只需要配置單個(gè)文件即可。

      在主頁面 點(diǎn)擊Tools -> Boards Manager,即可對配置文件進(jìn)行編輯。如圖1所示,可以查看、復(fù)制現(xiàn)有的配置文件,或者創(chuàng)建新配置文件。


      圖1:STMC Board Manager

      創(chuàng)建配置文件

      點(diǎn)擊Inverter,點(diǎn)擊右下角的+,創(chuàng)建新的文件。


      圖2:配置提示
      如圖2,編輯器會(huì)提示我們配置文件缺少那些關(guān)鍵項(xiàng),我們需要根據(jù)提示,添加相應(yīng)的配置,有些配置會(huì)提示參數(shù),有些不會(huì),我們需要通過官方手冊和其他配置文件去查找合適的參數(shù)。

      基礎(chǔ)配置

      按照提示,隨便填些參數(shù)

      {
        "type": "inverter",
        "descVersion": 4,
        "contentVersion": "1.0",
        "name": "my_self_control",
        "PN": "0",
        "mcu": "STM32",
        "clockFrequency": 170,
        "clockSource": "1",
        "motorDrives": []
      }
      

      其中mcuclockSourcemotorDrives的具體參數(shù)我們不知道并且沒提示。

      在軟件安裝目錄下\MC_SDK_6.2.1\Utilities\PC_Software\STMCWB\assets\hardware\mcu,有所有支持的mcu配置文件, 我們能配置的MCU型號只能從其中選擇。這里我們選擇STM32G431KBUx

      clockSource可以參考官方wiki 2.3.1 Specific properties 一節(jié),對應(yīng)的有四個(gè)參數(shù):

      Value Description supported MCUs
      internal_osc The source of the clock is the internal oscillator. All MCUs
      8_crystal The source of the clock is an 8 MHz crystal. All MCUs
      24_crystal The source of the clock is a 24 MHz crystal. STM32G4xx and STM32G0xx
      48_crystal The source of the clock is a 48 MHz crystal. STM32G4xx

      選擇自己驅(qū)動(dòng)板對應(yīng)的即可。

      motorDrives

      參考別的配置文件,motorDrives配置較為復(fù)雜,還好有部分提示,跟著提示先一步一步填。

      Missing property "name".
      Missing property "maxRatedVoltage".
      Missing property "minRatedVoltage".
      Missing property "maxRatedCurrent".
      Missing property "features".
      

      前4個(gè)參數(shù)填起來輕輕松松,按照實(shí)際電路填寫即可。

      "motorDrives": [
        {
          "name": "M1",
          "maxRatedVoltage": 24,
          "minRatedVoltage": 8,
          "maxRatedCurrent": 2
        }]
      

      features則描述了驅(qū)動(dòng)器支持的特性,也是配置文件的核心。相關(guān)介紹見 WIKI: 《3 Features Specification》

      電流采樣模式

      首先配置電流采樣模式。電流采樣支持以下幾種模式:

      mode Description
      ThreeShunt_AmplifiedCurrents Three-shunt, amplified current hardware variant
      ThreeShunt_RawCurrents_SingleEnded Three-Shunt, Raw Currents, Single Ended OpAmp hardware variant
      ThreeShunt_RawCurrents_Differential Three-Shunt, Raw Currents, Differential OpAmp hardware variant
      ThreeShunt_RawCurrents_SingleEnded_ExternalGain Three-Shunt, Raw Currents, Single Ended Internal OpAmp with External Gain hardware variant
      ThreeShunt_RawCurrents_SingleEnded_InternalGain Three-Shunt, Raw Currents, Single Ended internal OpAmp with Internal Gain hardware variant
      ...... ......
      參數(shù)

      我這里使用的是driver帶的電流放大器,因此選擇三電阻,外部放大,即最簡單的ThreeShunt_AmplifiedCurrents

      "features": [
        {
          "name": "CurrentSensing",
          "type": "CurrentSensing",
          "tRise": 1000,
          "hwVariants": [
            {
              "type": "ThreeShunt_AmplifiedCurrents"
            }]
        }]
      

      該模式對應(yīng)如下參數(shù):

      Parameters Type Description
      tNoise Number TNoise parameter of the phase switches. In ns
      shuntResistor Number Shunt Resistor value in Ohm
      offsetNetworkAttenuation Number Gain of the offset network
      opAmpGain Number Gain of the OpAmp amplification
      polarizationOffset Number Shift voltage added by the Offset network, in Volts, at OpAmp output.
      amplifyingNetworkImax Number Maximum current that is measurable by the current sensing network.
      amplifyingNetworkVm Number Voltage reference of the current sensing network
      amplifyingNetworkPrating Number Rated power (that can go through the shunt resistor)

      根據(jù)實(shí)際分壓電路,填寫參數(shù)如下:

        "type": "ThreeShunt_AmplifiedCurrents",
        
        "shuntResistor": 0.01,
        "amplifyingNetworkImax": 21.429,
        "amplifyingNetworkVm": 3.3,
        "amplifyingNetworkPrating": 2,
        "offsetNetworkAttenuation": 0.885,
        "opAmpGain": 8.697,
        "polarizationOffset": 1.65
      
      參數(shù)計(jì)算

      對于電壓采樣,無論外圍電路如何,最終轉(zhuǎn)換公式均為\(I_{in} = AD_{in} \times R_s \times Gain\)MCSDK,會(huì)根據(jù)參數(shù),自動(dòng)計(jì)算出Gain。


      圖3:AD采樣放大電路
      Gain計(jì)算遵從如下幾個(gè)公式:

      \[ Gain = offsetNetworkAttenuation \times opAmpGain \\ current = \frac{polarizationOffset}{shuntResistor \times Gain} \]

      對于我們自己的驅(qū)動(dòng)板,很多時(shí)候無法獲取詳細(xì)的參數(shù),此時(shí)我們就可以根據(jù)上述公式,反推出合適的值,代入到配置項(xiàng)中。

      引腳配置

      signals為引腳配置,編輯器會(huì)提示每個(gè)模式需要配置的引腳,在cubeMX中找到可以使用的ADC腳,填寫上即可。

        "signals": {
          "CURRENT_AMPL_U": [
            {
              "name": "PA4",
              "help": "",
              "cost": 0
            }
          ],
          "CURRENT_AMPL_V": [
            {
              "name": "PA5",
              "help": "",
              "cost": 0
            }
          ],
          "CURRENT_AMPL_W": [
            {
              "name": "PA6",
              "help": "",
              "cost": 0
            }
          ]
        },
      

      傳感器模式

      通過此特性,定義驅(qū)動(dòng)的傳感器模式。通常有反電動(dòng)勢,霍爾,編碼器幾種,這里使用霍爾傳感器配置。

      通過CUBEMX查找支持HALL的引腳,填上即可。

        {
          "name": "SpeedAndPositionSensing",
          "type": "SpeedAndPositionSensing",
          "hwVariants": [
            {
              "type": "HallEffectSensor",
              "help": "",
              "signals": {
                "HALLSENSOR_H1": [
                  {
                    "name": "PA0",
                    "help": "",
                    "cost": 0
                  }
                ],
                "HALLSENSOR_H2": [
                  {
                    "name": "PA1",
                    "help": "",
                    "cost": 0
                  }
                ],
                "HALLSENSOR_H3": [
                  {
                    "name": "PA2",
                    "help": "",
                    "cost": 0
                  }
                ]
              }
            }
          ]
        }
      

      相電壓生成

      此項(xiàng)用于設(shè)定電壓輸出方式,F(xiàn)OC模式下有2種模式,分別是
      DrivingHighAndLowSides:輸出6路PWM,分別控制高低半橋;

      DrivingHighSidesAndThreeEnables:輸出3路PWM,控制高側(cè)半橋,以及3個(gè)使能信號。

      這里使用3路PWM模式。同樣在CUBEMX中查找可用的引腳。

        {
          "name": "PhaseVoltageGeneration",
          "type": "PhaseVoltageGeneration",
          "driverName": "Driver or IGBT or MOSFET name",
          "driverPN": "Driver or IGBT or MOSFET Part Number",
          "minDeadTime": 500,
          "maxSwitchingFreq": 100,
          "tNoise": 500,
          "hwVariants": [
            {
              "type": "DrivingHighSidesAndThreeEnables",
              "help": "How to enable this variant",
              "signals": {
                "PWM_CHU_H": [
                  {
                    "name": "PA8",
                    "help": "",
                    "cost": 0
                  }
                ],
                "PWM_CHV_H": [
                  {
                    "name": "PA9",
                    "help": "",
                    "cost": 0
                  }
                ],
                "PWM_CHW_H": [
                  {
                    "name": "PA10",
                    "help": "",
                    "cost": 0
                  }
                ],
                "PWM_CHU_EN": [
                  {
                    "name": "PA7",
                    "help": "",
                    "cost": 0
                  }
                ],
                "PWM_CHV_EN": [
                  {
                    "name": "PA12",
                    "help": "",
                    "cost": 0
                  }
                ],
                "PWM_CHW_EN": [
                  {
                    "name": "PB5",
                    "help": "",
                    "cost": 0
                  }
                ]
              },
              "highSideSwitchesDrivingPolarity": "Active high",
              "enableDrivingPolarity": "Active high",
              "deadTime": 550
            }
          ]
        },
      
      
      其他配置

      有了以上核心配置,就可以在Motor Control WorkBench中導(dǎo)入自定義控制器了。除了以上功能,還有電路保護(hù)等其他功能可以配置,跟著官方配置照葫蘆畫瓢即可。

      導(dǎo)入效果

      Motor Control WorkBench中,新建項(xiàng)目,在inverter中可以看到我們新建的控制板


      圖3: inverter

      勾選上,一般情況下便可以生成代碼了。


      圖4: View

      完整配置文件

      {
        "type": "inverter",
        "descVersion": 4,
        "contentVersion": "1.0",
        "name": "my_self_control",
        "PN": "0",
        "mcu": "STM32G431KBUx",
        "clockFrequency": 170,
        "clockSource": "24_crystal",
        "motorDrives": [
          {
            "name": "M1",
            "maxRatedVoltage": 24,
            "minRatedVoltage": 8,
            "maxRatedCurrent": 2,
            "features": [
              {
                "name": "CurrentSensing",
                "type": "CurrentSensing",
                "tRise": 1000,
                "hwVariants": [
                  {
                    "type": "ThreeShunt_AmplifiedCurrents",
                    "shuntResistor": 0.01,
                    "amplifyingNetworkImax": 21.429,
                    "amplifyingNetworkVm": 3.3,
                    "amplifyingNetworkPrating": 2,
                    "offsetNetworkAttenuation": 0.885,
                    "opAmpGain": 8.697,
                    "polarizationOffset": 1.65,
                    "signals": {
                      "CURRENT_AMPL_U": [
                        {
                          "name": "PA4",
                          "help": "",
                          "cost": 0
                        }
                      ],
                      "CURRENT_AMPL_V": [
                        {
                          "name": "PA5",
                          "help": "",
                          "cost": 0
                        }
                      ],
                      "CURRENT_AMPL_W": [
                        {
                          "name": "PA6",
                          "help": "",
                          "cost": 0
                        }
                      ]
                    }
                  }
                ]
              },
              {
                "name": "SpeedAndPositionSensing",
                "type": "SpeedAndPositionSensing",
                "hwVariants": [
                  {
                    "type": "HallEffectSensor",
                    "help": "",
                    "signals": {
                      "HALLSENSOR_H1": [
                        {
                          "name": "PA0",
                          "help": "",
                          "cost": 0
                        }
                      ],
                      "HALLSENSOR_H2": [
                        {
                          "name": "PA1",
                          "help": "",
                          "cost": 0
                        }
                      ],
                      "HALLSENSOR_H3": [
                        {
                          "name": "PA2",
                          "help": "",
                          "cost": 0
                        }
                      ]
                    }
                  }
                ]
              },
              {
                "name": "PhaseVoltageGeneration",
                "type": "PhaseVoltageGeneration",
                "driverName": "MP6450",
                "driverPN": "MP6450",
                "minDeadTime": 500,
                "maxSwitchingFreq": 100,
                "tNoise": 500,
                "hwVariants": [
                  {
                    "type": "DrivingHighSidesAndThreeEnables",
                    "help": "How to enable this variant",
                    "signals": {
                      "PWM_CHU_H": [
                        {
                          "name": "PA8",
                          "help": "",
                          "cost": 0
                        }
                      ],
                      "PWM_CHV_H": [
                        {
                          "name": "PA9",
                          "help": "",
                          "cost": 0
                        }
                      ],
                      "PWM_CHW_H": [
                        {
                          "name": "PA10",
                          "help": "",
                          "cost": 0
                        }
                      ],
                      "PWM_CHU_EN": [
                        {
                          "name": "PA7",
                          "help": "",
                          "cost": 0
                        }
                      ],
                      "PWM_CHV_EN": [
                        {
                          "name": "PA12",
                          "help": "",
                          "cost": 0
                        }
                      ],
                      "PWM_CHW_EN": [
                        {
                          "name": "PB5",
                          "help": "",
                          "cost": 0
                        }
                      ]
                    },
                    "highSideSwitchesDrivingPolarity": "Active high",
                    "enableDrivingPolarity": "Active high",
                    "deadTime": 550
                  }
                ]
              }
            ]
          }
        ]
      }
      

      更多配置項(xiàng)

      待補(bǔ)充

      posted @ 2024-03-21 14:57  USTHzhanglu  閱讀(2114)  評論(0)    收藏  舉報(bào)
      主站蜘蛛池模板: 又大又紧又粉嫩18p少妇| 免费人成年激情视频在线观看| 中文字幕日韩国产精品| 欧美成人h精品网站| 国产午夜精品理论大片| 成人aⅴ综合视频国产| japanese丰满奶水| 巴林左旗| 国产精品福利自产拍久久| 亚洲精品国模一区二区| 蜜臀午夜一区二区在线播放| 午夜爽爽爽男女免费观看影院| 极品少妇的粉嫩小泬看片| 国产精品一在线观看| 国产不卡在线一区二区| 一区二区三区午夜福利院| 亚洲欧洲日产国无高清码图片| 国产色无码专区在线观看| 成人动漫综合网| 亚欧洲乱码视频在线专区| 亚洲欧美日韩高清一区二区三区| 中文字幕在线视频不卡一区二区| 久久精品国产精品亚洲艾| 人妻中文字幕精品系列| 激情综合色综合啪啪开心| 狠狠色狠狠色五月激情| 人妻丝袜无码专区视频网站| 99久久综合精品五月天| 久久久精品2019中文字幕之3| 午夜福利激情一区二区三区| 国产旡码高清一区二区三区| 精品免费看国产一区二区| 色欲av久久一区二区三区久| 国产偷窥厕所一区二区| 真人性囗交视频| 久久精品国产久精国产果冻传媒| 桃花岛亚洲成在人线AV| 综合久久国产九一剧情麻豆| 亚洲男人的天堂av手机在线观看| 久久精品国产亚洲av麻豆长发| 人妻久久久一区二区三区|