Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

Level 1
Level 1
I am trying to use TLE5012b rotation magnetometer to an Arduino MEGA board.

I cut the sensor from one of the TLE5012b Angle Sensor 2 Go kits, solder cables to the PCB holes
and then I connected it to the MEGA in the following order:

( I checked the TLE5012b Arduino libraries and I use the same PIN numbers used by the default options )
Arudino (SS - pin 53) ------ TLE5012 CSQ
Arudino (MOSI - pin 51) ------ TLE5012 CSQ
Arudino (CLK - pin 52) ------ TLE5012 SCK
Arudino (GND) ------ TLE5012 GND
Arudino (3.3 V) ------ TLE5012 VDD
I run this code (that is basically the libraries' angle reader sample) :


Tle5012Ino Tle5012MagneticAngleSensor = Tle5012Ino();
errorTypes checkError = NO_ERROR;

void setup() {
while (!Serial) {};

checkError = Tle5012MagneticAngleSensor.begin();
Serial.print("checkerror: ");
Serial.println(checkError, HEX);

Serial.println("init done");


errorTypes ch = NO_ERROR;
int16_t rawAnglevalue = 0;
void loop() {
double d = 0.0;

//ch = Tle5012MagneticAngleSensor.getAngleSpeed(d);
ch = Tle5012MagneticAngleSensor.getAngleValue(d, rawAnglevalue, UPD_low, SAFE_low);


// remark this for even more speed

The sensor initialization function "begin()" is always return 1 as error code.
When the program runs.
. Error code always return FF and the angle value is always 0.

I checked the problem and it seems to be related with the Checksum.
So, I used a different version of the same function to avoid the Checksum.

ch = Tle5012MagneticAngleSensor.getAngleValue(d, rawAnglevalue, UPD_low, SAFE_low);

This function always return 0 as error code but the angle value and the raw value never change (always 0 )

It seems that it could be something I am missing to initialize or connect.
1 Reply
Level 1
Level 1
Hello Java311,
I am also interested in getting these devices working with Arduino devices (promicro probably in my case) and have been reading the data sheets.
I do not yet actually have a tle5012b to experiment with.
From the data sheet - Infineon-Angle_Sensor_TLE5012B-UM-v01_02-en-UM-v01_02-EN.pdf it seems to me that you wiring is not correct.
(a) you have nothing wired to the data pin of the 5012. I don't know if perhaps this is a typing error but you say:-
Arudino (MOSI - pin 51) ------ TLE5012 CSQ
This should surely be TLE5012 DATA
(b) Also, in order to get two way data communication the MOSI and the MISO pins of the Arduino SPI master (your Mega) must be connected together. Page 36 of the data sheet.

I have not looked at the code yet but the 5012 needs to have its registers set correctly each time it starts up. I presume the Begin function does this.
Also, the SPI compatibility of the SSC interface is a little strange since the MOSI and MISO are connected and as the datasheet says:-
When the sensor transmits data the master’s output pin (SDO pin) has to be switched to high ohmic.
Again, at the moment I can only assume that the code is doing this correctly.

I would be very interested to hear how your experiments are progressing.
Do you have some sort of scope to monitor the data lines?
Glyn Hodges