当前位置:网站首页>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)
边栏推荐
- After the access database introduces DataGridView data, an error is displayed
- [cryoEM] Introduction to FSC, Fourier shell correlation
- For the application challenge of smart city, shengteng AI gives a new solution
- My entrepreneurial neighbors
- [cryoelectron microscope | paper reading] a feature guided, focused 3D signal permutation method for subtogram averaging
- In an SQL file, a test table and data are defined above, and you can select* from the test table below
- Database persistence +jdbc database connection
- The database uses PSQL and JDBC to connect remotely and disconnect automatically from time to time
- Vmstat memory consumption query
- Operator overloading
猜你喜欢

Some tools, plug-ins and software links are shared with you~

Cs61abc sharing session (VI) detailed explanation of program input and output - standard input and output, file, device, EOF, command line parameters

Mysql rownum 实现

Mqtt server setup and mqtt.fx testing

Amaze UI 图标查询
![[beauty of software engineering - column notes] 25 | what methods can improve development efficiency?](/img/c8/c2d45abbf36b898040f9f1cf6274ff.png)
[beauty of software engineering - column notes] 25 | what methods can improve development efficiency?

Joseph Ring problem
![[cryptography experiment] 0x00 install NTL Library](/img/2a/03d95082a2a63238b475b3f7f3e13d.png)
[cryptography experiment] 0x00 install NTL Library

What is the use of chat robots? What type? After reading these, you will understand!

Dynamic thresholds buffer management in a shared buffer packet switch paper summary
随机推荐
Matrix decomposition and gradient descent
JVM garbage collection mechanism (GC)
在一个sql文件中,上面定义一个测试表及数据,下面可以select* from 测试表
Shell script - global variables, local variables, environment variables
@Use of jsonserialize annotation
Postman interface test | JS script blocking sleep and non blocking sleep
Mysql rownum 实现
String class
File system I
Space shooting Lesson 17: game over (end)
[beauty of software engineering - column notes] 28 | what is the core competitiveness of software engineers? (next)
Greenplus enterprise deployment
Some thoughts on growing into an architect
【学术相关】为什么很多国内学者的AI的论文复现不了?
In JS, 0 means false, and non-0 means true
How to draw an excellent architecture diagram
关于pip升级损坏导致的问题记录
Cyberpunk special effect shader
postman接口测试|js脚本之阻塞休眠和非阻塞休眠
Process and concept of process