Skip to content

Commit

Permalink
Merge pull request #10 from Infineon/version2
Browse files Browse the repository at this point in the history
Version2
- including Sensor2Kits with 3-Wire SPI
- many addtitional functions and features included
- new examples
  • Loading branch information
OlafFilies authored Aug 20, 2019
2 parents cbfa388 + e9773a5 commit f07f481
Show file tree
Hide file tree
Showing 46 changed files with 12,059 additions and 1,516 deletions.
33 changes: 13 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,31 @@
language: python
python:
- "2.7"

sudo: required

branches:
only:
- master
- version2

env:
global:
- USR_NAME="mhoechner"
- USR_EMAIL="Moritz.Hoechner@infineon.com"
# new token needs to be generated & encrypted
- secure: OLSYr2ioMsqS+l43+s+yzfaVeCTK0Z1ky+Tm31bHdU66Ahq8+ZiDNX4fVDuziJtuHJWR3pEmqnYdSqSqcuByObM+I7uW3RaV2fOAtvCnWQcar5jt0+TYHuuLbfLu7vsL6ntBkQJXWibLO3JlVFp8ZVNd33WUE0mrnNdR7xormwy6EV7Ry9X/j43G+zHGjAKXxcfWIKs279pHvhtye4Vhlg3U8MkEwlkgpGiMbpWmk5CaePTi82KuoIOAceVZ8ixssuqpt4DgCnl7m6t1D+8MnjXxPLISvOr0pHNHTJ+3/gv1dGUrxENyPiW9d1q8OnrKyD9CniqC6Rklj+g5mhR+v+FJvjfa2k85SXVvFYikkqUyXkIVZkJu+PxZX0mfY18SbI7GB8mOkjgcusI9KhzNhZJQxUzza/DBe2MOR72mHVdpHlsOtx/1PjaUjJtS6lFBBZw1gCKYsFkGU3UfY+Jr3yajU1veCICgde0gm3SfhCDsQVymi7hsfnbBj8YhrY1K5+YJ6JHk5Wu6x2SsT8Al2/YSZoDdUDCZZ8Y4WNO+ZY2vF0ZU3jOcK/JSuLV6W7VzXAhSaYHVAHq2fXNgW7EWkRaLeFGtjgwvZIkhQ1Mrsl6oObMJhFhaD6vP4MlwvTWKp0MB8NdFWsgR2ITU80sREp4RBzJVSQIvLiBCIwi0upY=
matrix:
- PLATFORMIO_CI_SRC=examples/Read_Angle_Speed_Revolutions
- PLATFORMIO_CI_SRC=examples/Read_Angle_Value_Processing
- PLATFORMIO_CI_SRC=examples/Read_Multiple_Registers
- PLATFORMIO_CI_SRC=examples/Read_Sensor_Type
- PLATFORMIO_CI_SRC=examples/Read_Speed_Processing
- PLATFORMIO_CI_SRC=examples/Read_Test
- PLATFORMIO_CI_SRC=examples/Read_Test_With_SlaveNumber
- PLATFORMIO_CI_SRC=examples/Read_Write_Registers

- PLATFORMIO_CI_SRC=examples/ReadAngleTest

install:
# build with stable core
- pip install -U platformio
- platformio platform install https://github.com/Infineon/platformio-infineonxmc.git
script:
- platformio ci --lib="." --board=xmc1100_xmc2go --board=xmc1100_boot_kit --board=xmc1100_h_bridge2go --board=xmc1300_boot_kit --board=xmc4700_relax_kit --project-option="lib_deps=Wire"
- platformio platform install -f infineonxmc
- platformio platform install -f atmelavr

after_success:
# only build once (after one job by checking id, however this does not work reliably)
# - |
# if [ $(($TRAVIS_JOB_ID - $TRAVIS_BUILD_ID)) -eq 2 ]; then
# export REPO_NAME=${TRAVIS_REPO_SLUG#*/}
# git clone https://github.com/Infineon/InfineonDoxyGenerator.git
# cd well-automated-documentation/docs
# # cd $TRAVIS_BUILD_DIR/docs
# chmod +x publish_pdf.sh
# ./publish_pdf.sh
# fi
script:
- platformio ci --lib="." --board=xmc1100_xmc2go --board=xmc1100_boot_kit --board=xmc4700_relax_kit --board=uno
67 changes: 56 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

[![Build Status](https://travis-ci.org/Infineon/TLE5012-Magnetic-Angle-Sensor.svg?branch=master)](https://travis-ci.org/Infineon/TLE5012-Magnetic-Angle-Sensor)

<img src="https://www.infineon.com/export/sites/default/media/products/Sensors/TLE_5012B_DSO-8-16_plain_lowres.jpg_945841647.jpg" width=200>
| <img src="https://www.infineon.com/export/sites/default/media/products/Sensors/TLE_5012B_DSO-8-16_plain_lowres.jpg_945841647.jpg" width=200 style="background:white"> | <img src="https://raw.githubusercontent.com/infineon/assets/master/Pictures/TLE5012B_horizontal.png" width=400 style="background:white"> |
|:--:|:--:|
| *bulk sensor* | *Sensor2Go kit*

Library of Infineon's highly sensitive [TLE5012B] 360° magnetic angle sensor(https://www.infineon.com/cms/en/product/sensor/magnetic-position-sensor/angle-sensor/tle5012b-e1000/) for Arduino.
Library of Infineon's highly sensitive [TLE5012B](https://www.infineon.com/cms/en/product/sensor/magnetic-position-sensor/angle-sensor/tle5012b-e1000/) 360° magnetic angle sensor for Arduino.

## Summary
The [TLE5012B](https://www.infineon.com/cms/en/product/sensor/magnetic-position-sensor/angle-sensor/tle5012b-e1000/) 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 autocalibration 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 derivates with different interface settings are available.
The [TLE5012B](https://www.infineon.com/cms/en/product/evaluation-boards/tle5012b_e1000_ms2go/) 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 autocalibration 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 derivates with different interface settings are available.

## Key Features and Benefits
* Giant Magneto Resistance (GMR)-based principle
Expand All @@ -22,19 +24,62 @@ The [TLE5012B](https://www.infineon.com/cms/en/product/sensor/magnetic-position-
* 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
For the description of library [installation](docs/Installation.md)

## Examples
For the description of the [examples](docs/Examples.md)

## Hardware
Please find the datasheet of the TLE5012B [here](https://www.infineon.com/dgdl/Infineon-TLE5012B_Exxxx-DS-v02_01-EN.pdf?fileId=db3a304334fac4c601350f31c43c433f). It depends on the evaluation board which you are using or the respective configuration of the sensor on your PCB which communication protocol as well as addresses you need to use for communicating with the sensor. This library only works with the SPI compatible Synchronous Serial Communication (SSC) interface of the TLE5012B.

## Installation
### Sens2Go
The Infineon TLE5012B Sens2Go evaluation kit use 3-wire SPI on board, so MISO/MOSI pin 0 and 1 are short. Here the Sensor PCB is
breakable from the XMC2Go part. If you do so, than you can attache the Sensor PCB to any SPI interface but still only as a 3-wire SPI.
The left over XMC2Go can also used for any other project but also has only a 3-wire SPI on board, otherwise it is identical to the XMC2Go.

### XMC1100 Boot Kit
Use the 5V instead of the 3.3V connector for proper SPI connection due to the attached LED to the SCK pin.

### XMC4700 Relax Kit
The Infineon XMC4700 Relax Kit has up to five different SPI channels, whereas the default SPI is in the arduino header at its
default position, SPI3 and SPI4 are already in use, so that at the end three SPIs can be used. On the XMC4700 Relax Kit the sensor
can run with 3.3V or 5V (depending on the board version)

### Arduino/Genuino UNO
Due to very limited memory this both microcontroller can not run all exampes. In that case an error message apears.

### Bulk Sensor
To connect the 3-wire SSC interface to an Arduino with a 4-wire SPI interface you will need a resistor with a value between 3.3k Ohm and 10k Ohm.
Connect the resistor between DATA and MOSI (pin 11 on an UNO). If you are connecting multiple sensors they can all share one DATA line and one resistor.
The Sensor2Go evaluation board uses 3-wire SSC, so no resistor is needed between MISO and MOSI.

### Integration of Library
Please download this repository from GitHub by clicking on the following field in the latest [release](https://github.com/Infineon/TLE5012-Magnetic-Angle-Sensor/releases) of this repository:
| TLE5012B Pin | Sensor2Go Pin | Pin Function | Arduino Pin | Function |
|:------------:|---------------|--------------|:-----------:|----------|
| 2 | 3 / P0.8 | SCK | 13 | SCK |
| 3 | 4 / P0.9 | CSQ | 10 | SS |
| 4 | 2 / P0.7 | DATA | 12 | MISO |
| | no resistor | resistor | 11 | MOSI |
| 6 | 14 /3.3V | Vdd | 3.3V or 5V | Power |
| 7 | 15 | GND | GND | Ground |

![Download Library](https://raw.githubusercontent.com/infineon/assets/master/Pictures/Releases_Generic.jpg)
### Variants
The TLE5012 sensor comes in various Interface variants but the SSC interface is always possible.
See the documentation which options and settings are available for each interface and for the
Sensor2Go kit see the checkmark at the back of the package. If you don't know which sensor setup
you have use the examples/Read_Sensor_Type/Read_Sensor_Type.ino or the examples/Read_Sensor_Registers/Read_Sensor_Registers.ino
scetch to check.
* TLE5012B E1000 automotive predefined variant with SSC & IIF communication protocols
* TLE5012B E5000 automotive predefined variant with SSC & PWM communication protocols
* TLE5012B E9000 automotive predefined variant with SSC & SPC communication protocols
* TLI5012B E1000 industrial predefined variant with SSC & IIF communication protocols

To install the TLE5012B angle sensor library in the Arduino IDE, please go now to **Sketch** > **Include Library** > **Add .ZIP Library...** in the Arduino IDE and navigate to the downloaded .ZIP file of this repository. The library will be installed in your Arduino sketch folder in libraries and you can select as well as include this one to your project under **Sketch** > **Include Library** > **TLE5012B**.

![Install Library](https://raw.githubusercontent.com/infineon/assets/master/Pictures/Library_Install_ZIP.png)
## More information and links
* [Infineon Maker page](https://www.infineon.com/cms/en/tools/landing/infineon-for-makers/#overview)
* [Infineon Microcontroller](https://www.infineon.com/cms/en/tools/landing/infineon-for-makers/microcontroller-boards/)
* [Infineon Magnetic Sensor Kits](https://www.infineon.com/cms/en/product/promopages/sensors-2go)
* [TLE5012B variants](https://www.infineon.com/cms/en/product/promopages/sensors-2go/#angle-sensor-2go)
* [TLE5012B manual](https://www.infineon.com/dgdl/Infineon-Angle_Sensor_TLE5012B-UM-v01_02-en-UM-v01_02-EN.pdf?fileId=5546d46146d18cb40146ec2eeae4633b)
* [TLE5012B example GUI](https://www.infineon.com/dgdl/Infineon-Software-Magnetic-Angle-Sensor-2Go-SW-v01_01-SW-v01_01-EN.zip?fileId=5546d462675a69720167799771c5519e)

## Usage
Please follow the example sketches in the /examples directory in this library to learn more about the usage of the library. Especially, take care of the SPI and I²C configuration of the sensor. For more information, please consult the datasheet [here](https://www.infineon.com/dgdl/Infineon-TLE5012B_Exxxx-DS-v02_01-EN.pdf?fileId=db3a304334fac4c601350f31c43c433f).
28 changes: 28 additions & 0 deletions docs/Examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Examples2Go

## List of examples
To run this exampls use either the Arduino IDE or somthing simillar like the [PlatformIO](https://platformio.org/platformio-ide?utm_source=github&utm_medium=xmc-for-arduino) module for [code](https://code.visualstudio.com/) or [atom](https://atom.io/)
* examples/Read_Angle_Speed_Revolutions/Read_Angle_Speed_Revolutions.ino
* examples/Read_Angle_Value_Processing/Read_Angle_Value_Processing.ino
* examples/Read_Multiple_Registers/Read_Multiple_Registers.ino
* examples/Read_Sensor_Registers/Read_Sensor_Registers.ino
* examples/Read_Sensor_Type/Read_Sensor_Type.ino
* examples/Read_Speed_Processing/Read_Speed_Processing.ino
* examples/Read_Test/Read_Test.ino
* examples/Read_Test_With_SlaveNumber/Read_Test_With_SlaveNumber.ino
* examples/Read_Write_Registers/Read_Write_Registers.ino
* examples/ReadAngleTest/ReadAngleTest.ino

## Processing files
Use this link for using [Processing](https://processing.org/). All of this exampls need either
the Read_Angle_Value_Processing.ino or the Read_Angle_Value_Processing.ino scetches
to be running. See the explanations inside the soruce code.
* processing/Ball_Bat/Ball_Bat.pde
* processing/Bouncing_Ball_Game/Bouncing_Ball_Game.pde
* processing/Circle/Circle.pde
* processing/Make_Spiral/Make_Spiral.pde
* processing/pong/pong.pde
* processing/Snake/SnakeGame/SnakeGame.pde
* processing/Snake_Like_Game/Snake_Like_Game.pde
* processing/speed/speed.pde

23 changes: 23 additions & 0 deletions docs/Installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Installation

## Integration of Library
Please download this repository from GitHub by clicking on the following field in the latest [release](https://github.com/Infineon/TLE5012-Magnetic-Angle-Sensor/releases) of this repository:

![Download Library](https://raw.githubusercontent.com/infineon/assets/master/Pictures/Releases_Generic.jpg)

To install the TLE5012B angle sensor library in the Arduino IDE, please go now to **Sketch** > **Include Library** > **Add .ZIP Library...** in the Arduino IDE and navigate to the downloaded .ZIP file of this repository. The library will be installed in your Arduino sketch folder in libraries and you can select as well as include this one to your project under **Sketch** > **Include Library** > **TLE5012B**.

![Install Library](https://raw.githubusercontent.com/infineon/assets/master/Pictures/Library_Install_ZIP.png)

## Usage
Please follow the example sketches in the /examples directory in this library to learn more about the usage of the library. Especially, take care of the SPI and I²C configuration of the sensor. For more information, please consult the datasheet [here](https://www.infineon.com/dgdl/Infineon-Angle_Sensor_TLE5012B-UM-v01_02-en-UM-v01_02-EN.pdf?fileId=5546d46146d18cb40146ec2eeae4633b).
For more information:
* see here for the sensors user manual [TLE5012B](https://www.infineon.com/cms/en/product/sensor/magnetic-position-sensor/angle-sensor/tle5012b-e1000/)
* you can find several application notes concerning the sensor position and disc magnet design on the same page
* there is a handy [pin out picture](https://raw.githubusercontent.com/infineon/assets/master/Pictures/TLE5012B_Sensor_2Go_Pin_out.png)
<img src="https://raw.githubusercontent.com/infineon/assets/master/Pictures/TLE5012B_Sensor_2Go_Pin_out.png" width=100%>

## Installation of XMC
If you use a Sensor2Go evolution kit or any Infineon XMC microcontroller like the XMC1100 Boot Kit or the XMC4700 Relax Kit, than you must also
install the [XMC-for-Arduino library from here](https://github.com/Infineon/XMC-for-Arduino).
The Sensor2Go will be recognized as MC1100 XMC 2Go.
49 changes: 49 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
##################################################################################
# documentation build files
# - generates the html doxygen documentation
# needed software:
# - graphviz dot
# - doxygen 1.8.15 or higher

# Directories
SRC_DIR ?= ../
DOC_DIR ?= ./
DOC_IMG_DIR ?= ./img
DOC_BUILD_DIR ?= ./
DOT_PATH ?= /usr/bin/dot
# General settings
DOXYFILE ?= doxyfile_html
WORKING_DOXYFILE ?= temp_doxyfile
PROJECT_LOGO ?= ./img/ifx_logo.png
DOXYGEN_WARNING ?= warn.log

# Tools
CD ?= cd
ECHO ?= echo
DOXYGEN_ECHO ?= echo
RM ?= rm
RM_DIR ?= rm -rf
COPY ?= cp
DOXYGEN ?= ${DOXY_BIN_PATH}/doxygen

html:
@$(ECHO) Generating $@
@$(COPY) $(DOXYFILE) $(WORKING_DOXYFILE)
@$(DOXYGEN_ECHO) >> $(WORKING_DOXYFILE)
@$(DOXYGEN_ECHO) INPUT=$(SRC_DIR) >> $(WORKING_DOXYFILE)
@$(DOXYGEN_ECHO) PROJECT_NAME="Tle5012b" >> $(WORKING_DOXYFILE)
@$(DOXYGEN_ECHO) OUTPUT_DIRECTORY = $(DOC_BUILD_DIR) >> $(WORKING_DOXYFILE)
@$(DOXYGEN_ECHO) PROJECT_LOGO = $(PROJECT_LOGO) >> $(WORKING_DOXYFILE)
@$(DOXYGEN_ECHO) IMAGE_PATH = $(DOC_IMG_DIR) >> $(WORKING_DOXYFILE)
@$(DOXYGEN_ECHO) DOT_PATH = "$(DOT_PATH)" >> $(WORKING_DOXYFILE)
@$(DOXYGEN) $(WORKING_DOXYFILE)

clean:
@$(ECHO) Removing build directory
@$(RM_DIR) $(DOC_BUILD_DIR)
@$(ECHO) Removing temporary files
@$(RM) $(DOXYGEN_WARNING)
@$(RM) $(WORKING_DOXYFILE)
@$(RM) $(LIBRARY_NAME).pdf

.PHONY: lib_doc clean
Binary file added docs/Tle5012b.pdf
Binary file not shown.
Loading

0 comments on commit f07f481

Please sign in to comment.