<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          stm32 霍爾傳感器接口

          作者: 時(shí)間:2016-11-18 來(lái)源:網(wǎng)絡(luò) 收藏
          13.3.18 與霍爾傳感器的接口

          使用高級(jí)控制定時(shí)器(TIM1或TIM8)產(chǎn)生PWM信號(hào)驅(qū)動(dòng)馬達(dá)時(shí),可以用另一個(gè)通用TIMx(TIM2、TIM3、TIM4或TIM5)定時(shí)器作為“接口定時(shí)器”來(lái)連接霍爾傳感器,見(jiàn)圖93,3個(gè)定時(shí)器輸入腳(CC1、CC2、CC3)通過(guò)一個(gè)異或門(mén)連接到TI1輸入通道(通過(guò)設(shè)置TIMx_CR2寄存器中的TI1S位來(lái)選擇),“接口定時(shí)器”捕獲這個(gè)信號(hào)。

          本文引用地址:http://www.ex-cimer.com/article/201611/315856.htm

          從模式控制器被配置于復(fù)位模式,從輸入是TI1F_ED。每當(dāng)3個(gè)輸入之一變化時(shí),計(jì)數(shù)器從新從0開(kāi)始計(jì)數(shù)。這樣產(chǎn)生一個(gè)由霍爾輸入端的任何變化而觸發(fā)的時(shí)間基準(zhǔn)。 “接口定時(shí)器”上的捕獲/比較通道1配置為捕獲模式,捕獲信號(hào)為T(mén)RC(見(jiàn)圖76)。捕獲值反映了兩個(gè)輸入變化間的時(shí)間延遲,給出了馬達(dá)速度的信息。 “接口定時(shí)器”可以用來(lái)在輸出模式產(chǎn)生一個(gè)脈沖,這個(gè)脈沖可以(通過(guò)觸發(fā)一個(gè)COM事件)用于改變高級(jí)定時(shí)器TIM1或TIM8各個(gè)通道的屬性,而高級(jí)控制定時(shí)器產(chǎn)生PWM信號(hào)驅(qū)動(dòng)馬達(dá)。因此“接口定時(shí)器”通道必須編程為在一個(gè)指定的延時(shí)(輸出比較或PWM模式)之后產(chǎn)生一個(gè)正脈沖,這個(gè)脈沖通過(guò)TRGO輸出被送到高級(jí)控制定時(shí)器TIM1或TIM8。 舉例:霍爾輸入連接到TIMx定時(shí)器,要求每次任一霍爾輸入上發(fā)生變化之后的一個(gè)指定的時(shí)刻,改變高級(jí)控制定時(shí)器TIMx的PWM配置。

          ● 置TIMx_CR2寄存器的TI1S位為’1’,配置三個(gè)定時(shí)器輸入邏輯或到TI1輸入,

          ● 時(shí)基編程:置TIMx_ARR為其最大值(計(jì)數(shù)器必須通過(guò)TI1的變化清零)。設(shè)置預(yù)分頻器得到一個(gè)最大的計(jì)數(shù)器周期,它長(zhǎng)于傳感器上的兩次變化的時(shí)間間隔。

          ● 設(shè)置通道1為捕獲模式(選中TRC):置TIMx_CCMR1寄存器中CC1S=01,如果需要,還可以設(shè)置數(shù)字濾波器。

          ● 設(shè)置通道2為PWM2模式,并具有要求的延時(shí):置TIMx_CCMR1寄存器中的OC2M=111和CC2S=00。

          ● 選擇OC2REF作為T(mén)RGO上的觸發(fā)輸出:置TIMx_CR2寄存器中的MMS=101。 在高級(jí)控制寄存器TIM1中,正確的ITR輸入必須是觸發(fā)器輸入,定時(shí)器被編程為產(chǎn)生PWM信號(hào),捕獲/比較控制信號(hào)為預(yù)裝載的(TIMx_CR2寄存器中CCPC=1),同時(shí)觸發(fā)輸入控制COM事件(TIMx_CR2寄存器中CCUS=1)。在一次COM事件后,寫(xiě)入下一步的PWM控制位(CCxE、OCxM),這可以在處理OC2REF上升沿的中斷子程序里實(shí)現(xiàn)。 下圖顯示了這個(gè)實(shí)例


          無(wú)刷電機(jī)每運(yùn)行一圈,霍爾有六個(gè)狀態(tài),在每個(gè)狀態(tài)均會(huì)進(jìn)入一次中斷,
          正常運(yùn)轉(zhuǎn)的時(shí)候電機(jī)是按照1,3,2,6,4,5

          http://www.ourdev.cn/bbs/bbs_content.jsp?bbs_sn=3764371&bbs_page_no=1&search_mode=1&search_text=hall&bbs_id=3020

          Setting up the system when using Hall-effect sensors
          Hall-effect sensors are devices capable of sensing the polarity of the rotor’s magnetic field;
          they provide a logic output, which is 0 or 1 depending on the magnetic pole they face and
          thus, on the rotor position.
          Typically, in a three-phase PM motor three Hall-effect sensors are used to feed back the
          rotor position information. They are usually mechanically displaced by either 120° or 60° and
          the presented firmware library was designed to support both possibilities. To set up the
          PMSM FOC software library for use with three Hall sensors, simply modify the
          stm32f10x_MCconf.h and MC_hall_param.h header files according to the indications given
          in Section 4.1 and Section 4.4, respectively.
          As shown in Figure 30, the typical waveforms can be visualized at the sensor outputs in
          case of 60° and 120° displaced Hall sensors. More particularly, Figure 30 refers to an
          electrical period (i.e. one mechanical revolution in case of one pole pair motor).
          Figure 30. 60° and 120° displaced Hall sensor output waveforms

          Since the rotor position information they provide is absolute, there is no need for any initial
          rotor prepositioning. Particular attention must be paid, however, when connecting the
          sensors to the proper microcontroller inputs.
          In fact, as stated in Section 3.11, this software library assumes that the positive rolling
          direction is the rolling direction of a machine that is fed with a three-phase system of positive
          sequence. In that case to properly work, the software library expects the Hall sensor signal
          transitions to be in the sequence shown in Figure 30 for both 60° and 120° displaced Hall
          sensors.
          For these reasons, it is suggested to follow the instructions given below when connecting a
          Hall-sensor equipped PM motor to your board:

          1. Turn the rotor by hand in the direction assumed to be positive and look at the B-emf
          induced on the three motor phases. For this purpose if the real neutral point is not
          available, it can be reconstructed by means of three resistors for instance.
          2. Connect the motor phases to the hardware respecting the positive sequence. Let
          “Phase A”, “Phase B” and “Phase C” be the motor phases driven by TIM1_CH1,
          TIM1_CH2 and TIM1_CH3, respectively (e.g. when using the MB459 board, a positive
          sequence of the motor phases could be connected to J5 2,1 and 3).
          3. Turn the rotor by hand in the direction assumed to be positive, look at the three Hall
          sensor outputs (H1, H2 and H3) and connect them to the selected timer on channels 1,
          2 and 3, respectively, making sure that the sequence shown in Figure 30 is respected.
          4. Measure the delay in electrical degrees betweenthe maximum of the B-emf induced on
          Phase Aandthe first rising edge of signal H1. Enter it in the MC_hall_param.h header
          file (HALL_PHASE_SHIFT). For your convenience, an example with
          HALL_PHASE_SHIFT equal to –90 °C is illustrated in Figure 31.



          關(guān)鍵詞: stm32霍爾傳感器接

          評(píng)論


          技術(shù)專(zhuān)區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();