When using an advanced control timer (TIM1 or TIM8) to generate a PWM signal to drive a motor, another general TIMx (TIM2, TIM3, TIM4 or TIM5) timer can be used as an "interface timer" to connect the Hall sensor, as shown in Figure 93. The three timer input pins (CC1, CC2, CC3) are connected to the TI1 input channel through an XOR gate (selected by setting the TI1S bit in the TIMx_CR2 register), and the "interface timer" captures this signal.
The slave mode controller is configured in reset mode, the slave input is TI1F_ED. Every time one of the three inputs changes, the counter restarts from 0. This creates a time base that is triggered by any change on the Hall inputs. The capture/compare channel 1 on the "Interface Timer" is configured in capture mode, the capture signal is TRC (see Figure 76). The captured value reflects the time delay between two input changes, giving information about the motor speed. The "Interface Timer" can be used to generate a pulse in output mode, which can be used (by triggering a COM event) to change the properties of the various channels of the Advanced Timer TIM1 or TIM8, while the Advanced Control Timer generates a PWM signal to drive the motor. Therefore the "Interface Timer" channel must be programmed to generate a positive pulse after a specified delay (output compare or PWM mode), which is sent to the Advanced Control Timer TIM1 or TIM8 through the TRGO output. Example: The Hall inputs are connected to the TIMx timers, and it is required to change the PWM configuration of the Advanced Control Timer TIMx at a specified time after each change on any of the Hall inputs.
● Set the TI1S bit in the TIMx_CR2 register to '1' to configure the three timer inputs to be logically ORed to the TI1 input.
● Time base programming: Set TIMx_ARR to its maximum value (the counter must be cleared by a change in TI1). Set the prescaler to obtain a maximum counter period that is longer than the time interval between two changes on the sensor.
● Set channel 1 to capture mode (select TRC): Set CC1S=01 in the TIMx_CCMR1 register. If necessary, you can also set the digital filter.
● Set channel 2 to PWM2 mode with the required delay: Set OC2M=111 and CC2S=00 in the TIMx_CCMR1 register.
● Select OC2REF as the trigger output on TRGO: Set MMS=101 in the TIMx_CR2 register. In the advanced control register TIM1, the correct ITR input must be the trigger input, the timer is programmed to generate PWM signals, the capture/compare control signal is preloaded (CCPC=1 in the TIMx_CR2 register), and the trigger input controls the COM event (CCUS=1 in the TIMx_CR2 register). After a COM event, write the next PWM control bits (CCxE, OCxM), which can be implemented in the interrupt subroutine that handles the rising edge of OC2REF. The figure below shows this example
Each time the brushless motor runs a circle, the Hall has six states, and an interrupt will be entered in each state.
When the motor is running normally, it will follow 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.
Previous article:Understanding of STM32 serial port
Next article:Detailed introduction and technical knowledge of STM32 microcontroller
Recommended ReadingLatest update time:2024-11-17 00:50
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Please tell me the quiescent current of chips such as TM1638 and TM1629
- Magnetic field data collected by the LIS2DML array board
- Looking for senior engineers in electronics related industries, part-time, no need to work in the office
- Satellite Antenna Star Finder
- Why does the Q value of silver-plated wires have a higher value than that of enameled wires? --- How does the change of frequency affect the change of L and Q? Actual measurement comparison
- Global IoT chip market expected to reach $80 billion by 2025
- Things to note when selecting and using a POE switch
- MSP430 library hardware multiplier usage
- Last day! Apply for free evaluation - Essence WiFi + Bluetooth audio development board ESP32-Audio-Kit!
- How to convert CVBS analog video signal into digital signal? Please recommend a solution.