Code Monkey home page Code Monkey logo

tle5012-magnetic-angle-sensor's Introduction

TLE5012B-Angle-Sensor

PlatformIO CI Arduino CI Doxygen GH

bulk sensor breakout board Sensor2Go kit

Library of Infineon's highly sensitive TLE5012B 360° magnetic angle sensor.

Supported Frameworks

Arduino API WICED API TLE5012B API
TLE5012B Register API
Getting Started Getting Started Porting Guide

Summary

The TLE5012B is a 360° angle sensor that detects the orientation of a magnetic field. This is achieved by measuring sine and cosine angle components with monolithic integrated Giant Magneto Resistance (iGMR) elements. These raw signals (sine and cosine) are digitally processed internally to calculate the angle orientation of the magnetic field (magnet). The TLE5012B is a pre-calibrated sensor. The calibration parameters are stored in laser fuses. At start-up the values of the fuses are written into flip-flops, where these values can be changed by the application-specific parameters. Further precision of the angle measurement over a wide temperature range and a long lifetime can be improved by enabling an optional internal auto calibration algorithm. Data communications are accomplished with a bi-directional Synchronous Serial Communication (SSC) that is SPI-compatible. The sensor configuration is stored in registers, which are accessible by the SSC interface. Additionally four other interfaces are available with the TLE5012B: Pulse-Width-Modulation (PWM) Protocol, Short-PWM-Code (SPC) Protocol, Hall Switch Mode (HSM) and Incremental Interface (IIF). These interfaces can be used in parallel with SSC or alone. Pre-configured sensor derivate with different interface settings are available.

Key Features and Benefits

  • Giant Magneto Resistance (GMR)-based principle
  • Integrated magnetic field sensing for angle measurement
  • 360° angle measurement with revolution counter and angle speed measurement
  • Two separate highly accurate single bit SD-ADC
  • 15 bit representation of absolute angle value on the output (resolution of 0.01°)
  • 16 bit representation of sine / cosine values on the interface
  • Max. 1.0° angle error over lifetime and temperature-range with activated auto-calibration
  • Bi-directional SSC Interface up to 8 Mbit/s
  • Interfaces: SSC, PWM, Incremental Interface (IIF), Hall Switch Mode (HSM), Short PWM Code (SPC, based on SENT protocol defined in SAE J2716)
  • Output pins can be configured (programmed or pre-configured) as push-pull or open-drain
  • Bus mode operation of multiple sensors on one line is possible with SSC or SPC interface

Installation, Documentation, Variants etc.

Please have a look at the wiki for all questions about this library and the sensor.

More information and links

License

This project is licensed under the MIT License - see the LICENSE file for details.

tle5012-magnetic-angle-sensor's People

Contributors

arkajyotichatterjee avatar djaumann avatar jaenrig-ifx avatar mhollfelder avatar olaffilies avatar vroni99 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tle5012-magnetic-angle-sensor's Issues

SPC configured sensors require a trigger pulse - need hardware reset

If you accidentally purchased one of the E9xxx configured sensors and you're wondering why the angle always comes out as zero on the SSC (SPI) interface, then there's a note buried at the bottom of the Mode 4 register table on page 96 of the User's Manual which says...

"In SPC interface configuration, the sensor’s digital signal processing unit (DSPU) runs only when receiving a SPC trigger pulse on the IFA pin. This means that changes to register settings are applied and also the angle (AVAL) register is updated only after a trigger pulse"

So if you have one of those chips, you can't even change register settings to put it into a different mode that doesn't require a trigger unless you give it a trigger! The trigger pulse has some specific timing requirements, due to the clever way that the SPC mode can put 4 sensors on one data line.

There is a solution... Initiate a hardware reset with the Activation Status Register then write a new value to the Mode 4 register within 120 microseconds of the reset. Then you can put it into PWM mode or any other mode that doesn't require a trigger. Put this code in your setup()...

  uint16_t mod4, data;
  Tle5012b.readIntMode4(mod4);
  mod4 = mod4 & 0xFFFD;  //sets PWM mode, doesn't affect any other mode settings
  Tle5012b.readActivationStatus(data);
  data = data | 0x0001;  //hardware reset bit (without affecting any other settings)
  Tle5012b.writeActivationStatus(data);
  delayMicroseconds(10);  //datasheet doesn't specifiy a delay but it does say we must write the register within 120us of the reset
  Tle5012b.writeIntMode4(mod4);
  //Now you are in PWM mode and out of SPC mode

This is NOT a multi platform library

This library will not compile for most Arduino board distributions so it should NOT be labelled in the library properties file as:

architectures=*

The library only appears to work with the AVR board distribution.

PIN_SPI_SS is not defined for some board distributions

This won't compile for any Adafruit SAMD board because PIN_SPI_SS is not defined in this board distribution:

In file included from d:\dropbox\arduino\libraries\tle5012b\src\framework\arduino\pal\tle5012-pal-ino.hpp:28,
from D:\Dropbox\Arduino\libraries\TLE5012B\src/framework/arduino/wrapper/TLE5012-platf-ino.hpp:31,
from D:\Dropbox\Arduino\libraries\TLE5012B\src/TLE5012-ino.hpp:27,
from D:\Dropbox\Arduino\libraries\TLE5012B\examples\readAngleTest\readAngleTest.ino:18:
d:\dropbox\arduino\libraries\tle5012b\src\framework\arduino\pal\spic-arduino.hpp:44:28: error: 'PIN_SPI_SS' was not declared in this scope; did you mean 'PIN_SPI_SCK'?
44 | SPICIno(uint8_t csPin=PIN_SPI_SS);

Python wrapper

I'm looking for a simple solution for integrating TLE5012 into my python project. 
A simple and clean solution would be to use your code with a python wrapper.

Update readouts always trigger an update

The functions which read out the "update" registers always trigger an update. This is not the correct usage of that trigger. The trigger should only be pulled once and then a group of registers can be read out with a consistent set of values instead of getting just the current reading from the register.

An example use might be to trigger an update and then read out both speed and position at that instant. This sensor is so fast that reading a speed and then reading a position will get data from two different instants in time.

Reset sensor to 0 position

Hi! Is there a command to reset TLE5012 to zero position (0 angle value and 0 revolutions count) after arduino has started?
Otherwise, after restart , the sensor 0 position is always on where it's left. It's also hard to understand from the datasheet if it's even possible?

TLE5012B_E1000_MS2GO SPI Problem

Hello,
I use the product TLE5012B_E1000_MS2GO and have a problem with the SSC.
I start the GUI and set SPI, but nothing happens there. The Auto Detected Log says:

SSC IF Not Active,
Active Interface: not known,
Key parameters: -not available.

How can I activate the SSC or where exactly is the problem?
I measure MOSI,MISO,CLK but no SPI Signal is there.

Here is the Eval Manual:

http://www.farnell.com/datasheets/2700284.pdf

The arduino examples dont works too.

Many thanks for the help!

esp32 support

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Is your solution generic or only for a fixed setup
We prefer generic solutions which work on any kind of Hardware/Software combination in range of this software.
So please try to not generate a feature for only a very limited setup.

Additional context
Add any other context or screenshots about the feature request here.

TLE5012B_E1000_MS2GO Based Custom Design Schematic Help

Describe the bug
Sorry wasn't sure where else to post this.

The code works fine on TLE5012B_E1000_MS2GO using the XMC1100_VQFN24 but on custom design using XMC1100_T016 I am unable to get communication with the TLE5012B sensor, I always get a response of SYSTEM_ERROR when trying to initialize the sensor. I am hoping there is just something I am missing on the difference between the devices, but I not seeing what the issue is. I see there are some GPIO used in addition to the SPI, but it didnt seem to apply or would interfere with functionality. I believe the schematic is correct, but its difficult to compare as datasheet schematic image is of poor quality and source PCB files are not available for the dev kit. I have the PCB files and clear schematic for the XMC 2Go which is very similar just does have the connection to TLE5012.

To Reproduce
Run code on TLE5012B_E1000_MS2GO with XMC1100_VQFN24, TLE5012.begin returns NO_ERROR
Run code on TLE5012B_E1000_MS2GO based custom design with XMC1100_T016, TLE5012.begin returns: SYSTEM_ERROR

Expected behavior
Code runs as expected using TLE5012B_E1000_MS2GO but when

Screenshots
If applicable, add screenshots to help explain your problem.

Software:

  • OS: Windows
  • IDE: VSCode
  • Libraries with full name and version: infineon/TLE5012@^3.1.0
  • XMC-for-Arduino with version: Infineon/XMC-for-Arduino/releases/tag/V3.0.0

Hardware:

  • Sensor with full name: TLE5012BE3005
  • Shield with full name : TLE5012B_E1000_MS2GO & TLE5012B_E1000_MS2GO Based Custom Design
tle5012_xmc1100_PCBA - Circuit diagram: tle5012_xmc1100

check error

Steps to reproduce the behavior:

  1. download the readAngleTest
    2.the returned check error is 1 sometime is FF

Tle5012b::getAngleSpeed heap overflow?

Describe the bug
We are working on a rewrite of the firmware for a S42B closed loop stepper which uses the TLE5012 as feedback. Hardware details here.
Because of the hardware design we cannot use the official library, but we are using it as reference. Reading and writing registers works, we can get valid angle values from the sensor, but I can't figure out how the angle speed calculation is supposed to work.

In line 486 an array with 5 slots is defined. A bit further down, values from array location 6 are read. This could be anything that happens to be in memory at that location, or am I missing something?
Furthermore, the comments are not very helpful trying to figure out what the different factors are doing. What is firMDVal supposed to do? intMode2Prediction seems to determine if angle speed prediction is enabled or not, and rawAngleRange specifies the possible values of the raw angle?
I'm trying to find the correct register locations to get this function working, currently the output makes absolutely no sense.

Expected behavior
Function should return angle speed, but returns nan/inf.

Software (please complete the following information):

  • OS: Windows 10
  • IDE name and version: Visual Studio Code 1.55.0

Hardware (please complete the following information):

  • Sensor with full name: TLE5012B-E1000
  • Shield with full name : Custom hardware, sensor installed opposing a magnet on the end of a stepper motor shaft.

Additional context
Our repository: https://github.com/CAP1Sup/Intellistep

RP2040 Compatibility

Hello,
are there any plans to add compatibility with the family of boards based on the RP2040 (with the arduino-pico core)?
I am using a custom board with a RP2040 and have the Sensor (variant TLE5012BE1000XUMA1) connected to the SPI bus of the MCU. A 510 Ohm Resistor between MOSI and MISO is also in place.
Unfortunately the compilation using the Arduino Library is not functional for this chip atm. and I'm having some trouble to implement it for the this chip :/

SPI speed and delay

The datasheet advertises 8mbit SPI speed. With your library default settings getanglevalue takes almost 300us to read actual angle, which is quiet slow for any fast enough positioning device. I tried with speed= 8000000 and I get 0 value readings. Most I could get with my uC ( it supports 80mhz SPI easily) speed = 2500000. Together withcmodified DelayuS of 5uS I get about 50us getangle read time. Why so? And why is this delay function there? Can the reading be faster than that?

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.