当前位置:网站首页>Tle5012b+stm32f103c8t6 (bluepill) reading angle data
Tle5012b+stm32f103c8t6 (bluepill) reading angle data
2022-07-29 08:02:00 【BobBobBao】
Catalog
1. background
In the debug simpleFOC The program , Need to use magnetic encoder ,TLE5012B The price of magnetic encoder is low , Meet project requirements .TLE5012B There are two ways of communication :SPI and ABI Interface mode . Summarize the use TLE5012B Some problems in the process
2. Hardware connection
MCU use :STM32F103C8T6(bluepill) Minimum system board .
Sensors are purchased online TLE5012B modular + Radial magnet .
BLDC The motor :X2212-13 KV:980
USB To serial port :CH340 modular
2.1 SPI Wiring way
because TLE5012B It's using SSC Three wire communication , Compatible SPI Four wire communication , So you need to make a little adjustment when using , namely MISO、MOSI Received at the same time DATA(4) Pin . It needs to be controlled in the program MOSI Read write enable to control read write , instead of SPI Full duplex mode .

Specific connection way :
PIN1(VDD)—> 3.3V
PIN2(GND)—> GND
PIN3(IFA)—> ×
PIN4(IFB)—> ×
PIN5(IFC)—> ×
PIN6(R2-CSQ)—> PA4
PIN7(R1-SCK)—> PA5
PIN8(R3-DATA)—> PA6
chip pin4 Or resistance R3 Another section of outgoing line —> PA7
Another feasible wiring method
PIN1(VDD)—> 3.3V
PIN2(GND)—> GND
PIN3(IFA)—> ×
PIN4(IFB)—> ×
PIN5(IFC)—> ×
PIN6(R2-CSQ)—> PA4
PIN7(R1-SCK)—> PA5
chip pin4 Or resistance R3 Another section of outgoing line —> PA6/PA7 Short circuit
( tested PIN8(R3-DATA)—> PA6/PA7 Short circuit , The data is wrong )
2.1.2 Embedded programs
Direct use SimpleFOC transplant STM32( 3、 ... and )—— Angle reading The program provided inside :STM32ReadTLE5012B_spi1. You can also download directly from the online disk provided by this blogger :
link :https://pan.baidu.com/s/1ueR9a9_uL-Zce_CKTwhawQ
Extraction code :9qls
2.1.3 test result
Use the serial port debugging assistant to view the data , Turn the motor , You can see that the data is changing , Data change in one week 360°, Absolute position mode ,0° After that, it's directly 360°
The oscilloscope measures PA4,5,6,7, You can see that data is collected at intervals , Because the oscilloscope can only be adjusted to 2ns, Cannot directly capture SPI wave form .
2.2 ABI Wiring way
STM32F103 series MCU The timer of provides independent Encoder Pattern , Except for two basic timers (TIM6/7) No such function , Other advanced timers (TIM1/8), Basic timer (TIM2/3/4/5) All have this function , Here we use TIM4 Of Encoder function , Pin use :PB6(TIM4_1),PB7(TIM4_2)
Can be in STM32 See the timer block diagram in the data book of :1- Clock source ;2- controller ;3- Time base unit ;4- Input capture . among 2- The controller part includes trigger controller 、 From the mode controller and the encoder interface we use here . The encoder interface is the input channel TIMx-CH1/TIMx-CH2 Input signal , after “ Input filters and edge detectors ” after (TI1FP1/TI2FP2), Transmit the pulse signal to the controller “ Encoder interface ”. For details, please refer to :STM32 General timer encoder mode 
Specific connection way :
PIN1(VDD)—> 3.3V
PIN2(GND)—> GND
PIN3(IFA)—> PB6/TIM4_1
PIN4(IFB)—> PB7/TIM4_2
PIN5(IFC)—> PB5/ Interrupt mode
PIN6(R2-CSQ)—> ×
PIN7(R1-SCK)—> ×
PIN8(R3-DATA)—> ×
2.2.2 ABI Embedded programs
Direct use SimpleFOC transplant STM32( 3、 ... and )—— Angle reading The program provided inside :STM32ReadTLE5012B_ABZ. You can also download directly from the online disk provided by this blogger :
link :https://pan.baidu.com/s/1ueR9a9_uL-Zce_CKTwhawQ
Extraction code :9qls
2.2.3 ABI test result
The motor rotates once ,I Send out a pulse ,MCU Capture I Enter interrupt after signal , Send the current pulse count . This is just the simplest program . Read the pulse count value , You can know the value of the rotation angle . Cooperate with others TIM timing , Calculate the angle value in a fixed time , Or time in a fixed angle , You can calculate the speed .
Embedded programs
- SimpleFOC transplant STM32( 3、 ... and )—— Angle reading The program in is the simplest code program , For understanding hardware and programs , Testing hardware problems is very helpful
- STM32F103RCTx-TLE5012B-Magnetic-Angle-Sensor
, This github The warehouse is officially provided Arduino The library has been ported to STM32 Next , The writing is quite standard , There are also many functions , Can be called directly . - ODrive Step on the pit ( Two )3508 Motors and TLE5012B Magnetic encoder parameter configuration 、 calibration 、 Position closed-loop mode rotation motor (TLE5012B-E1000)
- ODrive example #1 Example of motor configuration (4250-520KV + TLE5012B-E1000)
边栏推荐
- Unity beginner 3 - enemy movement control and setting of blood loss area (2D)
- [cryoEM] Introduction to FSC, Fourier shell correlation
- Use the cloud code to crack the problem of authentication code encountered during login
- [beauty of software engineering - column notes] 24 | technical debt: continue to make do with it, or overthrow it and start over?
- C language problems
- [beauty of software engineering - column notes] "one question and one answer" issue 3 | 18 common software development problem-solving strategies
- [beauty of software engineering - column notes] 25 | what methods can improve development efficiency?
- Cyberpunk special effect shader
- Convert source package to RPM package
- 20 hacker artifacts
猜你喜欢
![[paper reading] tomoalign: a novel approach to correcting sample motion and 3D CTF in cryoet](/img/3a/75c211f21758ca2d9bb1a40d739d80.png)
[paper reading] tomoalign: a novel approach to correcting sample motion and 3D CTF in cryoet
![[beauty of software engineering - column notes] 26 | continuous delivery: how to release new versions to the production environment at any time?](/img/65/79f876b62fa3db421e5038a2445b83.png)
[beauty of software engineering - column notes] 26 | continuous delivery: how to release new versions to the production environment at any time?

An optimal buffer management scheme with dynamic thresholds paper summary

10 common software architecture modes
![[cryoelectron microscope | paper reading] a feature guided, focused 3D signal permutation method for subtogram averaging](/img/50/594dfc9affbcca97166d475fe09ad3.png)
[cryoelectron microscope | paper reading] a feature guided, focused 3D signal permutation method for subtogram averaging
![[cryoEM] Introduction to FSC, Fourier shell correlation](/img/01/6a4f6041444abfd1d3ca7e0c14b524.png)
[cryoEM] Introduction to FSC, Fourier shell correlation

(视频+图文)机器学习入门系列-第5章 机器学习实践

Monitor the bottom button of page scrolling position positioning (including the solution that page initialization positioning does not take effect on mouse sliding)

Cyberpunk special effect shader

佳木斯市场监管局开展防疫防虫害专题食品安全网络培训
随机推荐
MySQL uses date_ FORMAT(date,'%Y-%m')
Technology sharing | quick intercom integrated dispatching system
[introduction to cryoelectron microscopy] Caltech open class course notes part 3:image formation
[beauty of software engineering - column notes] "one question and one answer" issue 3 | 18 common software development problem-solving strategies
CDM - code division multiplexing (easy to understand)
For the application challenge of smart city, shengteng AI gives a new solution
Space shooting Lesson 17: game over (end)
Unity beginner 1 - character movement control (2D)
Vmstat memory consumption query
How to connect VMware virtual machine to external network under physical machine win10 system
Mysql rownum 实现
Unicode私人使用区域(Private Use Areas)
Why don't you like it? It's easy to send email in cicd
[cryoelectron microscope | paper reading] a feature guided, focused 3D signal permutation method for subtogram averaging
Cross domain problems when downloading webapi interface files
FLink CDC 的mysql connector中,mysql的字段是varbinary, 官方
【学术相关】为什么很多国内学者的AI的论文复现不了?
[paper reading | cryoelectron microscope] interpretation of the new subtomogram averaging method in relion 4.0
[cryoelectron microscope | paper reading] interpretation of sub fault average m software: multi particle cryo EM refining with M
MySQL 45 talk | 07 line lock merits and demerits: how to reduce the impact of line lock on performance?