Giter Site home page Giter Site logo

summerfalls / stm32f103rctx-tle5012b-magnetic-angle-sensor Goto Github PK

View Code? Open in Web Editor NEW
18.0 2.0 9.0 19.73 MB

:kiwi_fruit: TLE5012B-Magnetic-Angle-Sensor For STM32F103RCTx

C 98.02% Batchfile 0.01% C++ 0.15% Assembly 1.83%
stm32 infineon sensor magnetic-sensor angle-measurement sensor-2go tle5012b

stm32f103rctx-tle5012b-magnetic-angle-sensor's Introduction

🍻 F103RCTx_TLE5012B

/*
 *                  ___           ___                     ___           ___           ___           ___
 *    ___          /__/\         /  /\      ___          /__/\         /  /\         /  /\         /__/\
 *   /  /\         \  \:\       /  /:/_    /  /\         \  \:\       /  /:/_       /  /::\        \  \:\
 *  /  /:/          \  \:\     /  /:/ /\  /  /:/          \  \:\     /  /:/ /\     /  /:/\:\        \  \:\
 * /__/::\      _____\__\:\   /  /:/ /:/ /__/::\      _____\__\:\   /  /:/ /:/_   /  /:/  \:\   _____\__\:\
 * \__\/\:\__  /__/::::::::\ /__/:/ /:/  \__\/\:\__  /__/::::::::\ /__/:/ /:/ /\ /__/:/ \__\:\ /__/::::::::\
 *    \  \:\/\ \  \:\~~\~~\/ \  \:\/:/      \  \:\/\ \  \:\~~\~~\/ \  \:\/:/ /:/ \  \:\ /  /:/ \  \:\~~\~~\/
 *     \__\::/  \  \:\  ~~~   \  \::/        \__\::/  \  \:\  ~~~   \  \::/ /:/   \  \:\  /:/   \  \:\  ~~~
 *     /__/:/    \  \:\        \  \:\        /__/:/    \  \:\        \  \:\/:/     \  \:\/:/     \  \:\
 *     \__\/      \  \:\        \  \:\       \__\/      \  \:\        \  \::/       \  \::/       \  \:\
 *                 \__\/         \__\/                   \__\/         \__\/         \__\/         \__\/
 */

📖 简介

Infineon_Logo

这是英飞凌 360° 磁角度传感器 TLE5012B 的测试验证工程,移植了英飞凌 TLE5012B 📦 官方 Github 仓库 上的 C++ 代码到 STM32 平台,具体涉及到的文件为以下两个,其它文件为使用 3-Wire 方式进行通讯时才需要:

⚠️ 本仓库当前对应官方仓库的历史 Commit 为 5249d6293d2a88779bb38e815aec26316db00599

初次验证该传感器功能时,使用了官方的 Angle Sensor 2GO Kit 系列套件的 TLE5012B_E1000_MS2GO,配合附带的上位机程序进行了测试。

TLE5012B_BulkSensor TLE5012B_E1000_MS2GO_Pic
Bulk Sensor 散片 Sensor2Go kit

📌 Angle-Sensor-2GO-Kit Pin Out

TLE5012B_E1000_MS2GO_PIN_OUT

📌 MCU 引脚分配图

引脚分配

⚠️ 注意

接线方式选择了官方手册当中的 推挽输出 方式,达 8 MBits/s,而 开漏输出 方式的接线不一样,且速率也为 2 MBits/s。

按照官方仓库中 README.md 文档 以及该仓库下的 #1 Issue: Example connection scheme for tle5012be1000 chip and microcontorller,还有 STM32 论坛 的说法测试了在 MOSI 脚串接了一个 4.7K 电阻,如下图,发现数据通讯并不正常,待进一步验证测试。

硬件接线图

最后选择了 #1 Issue: Example connection scheme for tle5012be1000 chip and microcontorller 中的不串接电阻,通过代码控制 MOSI 脚对应的 GPIO 口的状态实现了数据的正常通讯(SPI 发送 Command 命令字之后,将 MOSI 脚的 GPIO 切换为高阻态(浮空输入),再进行接收数据字和安全字,接收完毕后再切换回复用推挽输出

💬 以下为以上 Issue 中英飞凌官方仓库维护人员 MorganSandercock 的原话

Yes... connect CSQ(3) to any convenient uC pin to use as chip-select connect DATA(4) to MISO connect SCK(2) to SCK connect DATA(4) to MOSI via a resistor. Use anything between 3.3K and 10K.

If you don't use a resistor between DATA and MOSI then it is possible to modify the library to put MOSI into a high-impedance state after writing the command word and before reading the response. Setting it back to SPI output mode depends on the specific microcontroller, so this is not a simple one-line change to the library.

⚙️ 硬件 & 软件 需求

硬件需求

  • STM32F103RCT6 PCB Board
  • J-Link V9

软件需求

  • Keil uVision5.27 及以上
  • STM32CubeMX 5.6.1 及以上

📚 参考资料

  1. TLE5012B 磁角度传感器官网介绍页面
  2. TLE5012B 用户手册
  3. Angle Sensor 2GO Kit 系列套件
  4. TLE5012B_E1000_MS2GO 评估板
  5. 官方 TLE5012B Github 代码仓库
  6. 官方 TLE5012B Github 代码仓库关于MOSI脚串接电阻的 Issue
  7. STM32 论坛中关于 Bulk Sensor 接线的原理图和源码

stm32f103rctx-tle5012b-magnetic-angle-sensor's People

Contributors

summerfalls avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

stm32f103rctx-tle5012b-magnetic-angle-sensor's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.