Announcements

Webinar: Integrated solutions for smaller, simpler low-voltage motor control design.
Join the webinar to experience!

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

cross mob
AmolKoli
Level 4
Level 4
First solution authored 10 questions asked 50 sign-ins

I am using TLE5012 on TLE9879 Motorcontrolkit to read the angle value via SSC2 communication.
The range of values read seem probably alright.

But I see a weird behavior that the Read value abruptly changes to 32767 or some other random value even when there is no motor motion. The images show values when the motor is stopped, showing totally far apart values.

why does this behavior occur, what is the countermeasure for it?

AmolKoli_0-1688096478888.pngAmolKoli_1-1688096491952.png

Code here:

void readSensorAngle(void)
{
//uint16 ret;
PORT_P00_Output_Low_Set();
SSC2_SendWord(0x8020);
//PORT_P02_OpenDrain_En();
gu16angVal = SSC2_SendWord(0xFFFF);
//Remove 15th bit, it is for new data received
gu16angVal = gu16angVal & (0x7FFF);
//PORT_P02_OpenDrain_Dis();
  PORT_P00_Output_High_Set();
 
//return angval;
}
 
uint16 count2Angle(uint16 angleCount)
{
uint16 angleValue;
//check if the value received is positive or negative
//if (angleCount & POS_BIT_14) // POS_BIT_14 is 0x4000
//{
//angleCount = angleCount - CHANGE_UINT_TO_INT_15; // CHANGE_UINT_TO_INT_15 is 0x8000
//}
angleValue = (((uint32)(ANGLE_360_VAL*100000)/POW_2_15) * ((uint32) angleCount))/1000; //Angle value scaled by 100
 
return angleValue;
}
0 Likes
1 Solution
Adithya_S
Moderator
Moderator
Moderator
100 sign-ins First question asked 50 replies posted

Hi @AmolKoli ,

TLE5012B is a 360 degree angle sensor based on Giant Magneto Resistance (GMR) technology that detects the orientation of the magnetic field.

The arrows showed on the resistors shows the magnetic direction which is fixed in the resistor. If the external magnetic field is parallel to the magnetic direction, then the resistance is minimum. If the external magnetic field is anti parallel to the magnetic direction, then the resistance is maximum.

Using ARCTAN2 function, the true angle value is calculated out of raw X and raw Y values from the sensor bridges.

AdithyaS_0-1688124975644.png

Therefore, coming to your question of some random values thrown by the sensor when the motor comes to a halt is that whenever the motor stops, the magnet attached to it will be generating magnetic field will be oriented to the sensor bridges in such a way that some raw X and raw Y values will be produced, which in turn calculate the angle. This calculated angle will be thrown out by the sensor on the data lines.

Hope this helps.

Thanks and regards,
Adithya

View solution in original post

0 Likes
5 Replies
lock attach
Attachments are accessible only for community members.
Adithya_S
Moderator
Moderator
Moderator
100 sign-ins First question asked 50 replies posted

Hi @AmolKoli ,

Thank you for reaching out to Infineon Technologies.

I am attaching a file which consists the working code for TLE5012B. This code is used to retrieve angle value from the sensor.

Please refer this code.

Hope this helps,

Thanks and regards,
Adithya

0 Likes

Hello Aditya, Thanks for sharing,

I am using the same code which gives above such behavior.
Only the change is I am using SSC2 instead of SSC1.

 

/********Sensor Configuration************/
 
void configSensor(void)                 
{
//Enable prediction, disable autocal
PORT_P00_Output_Low_Set();
SSC2_SendWord(0x5080);
SSC2_SendWord(0x0804);
PORT_P00_Output_High_Set();
for(int i=0;i<1000;i++);
 
//Read 0x0D (for IIF-Hysteresis option)
PORT_P00_Output_Low_Set();
SSC2_SendWord(0x80D0);
//PORT_P02_OpenDrain_En();
uint16_t reg = SSC2_SendWord(0xFFFF);
//PORT_P02_OpenDrain_Dis();
PORT_P00_Output_High_Set();
for(int i=0;i<1000;i++);
//Write Hysteresis option in 0x0D to 0x00 (0ー)
reg &= 0xFFFC;
PORT_P00_Output_Low_Set();
SSC2_SendWord(0x50D0);
SSC2_SendWord(reg);
PORT_P00_Output_High_Set();
for(int i=0;i<1000;i++);
 
//Enable prediction, enable autocal
PORT_P00_Output_Low_Set();
SSC2_SendWord(0x5080);
SSC2_SendWord(0x0805);
PORT_P00_Output_High_Set();
for(int i=0;i<1000;i++);
 
//read STAT to clear S_FUSE
PORT_P00_Output_Low_Set();
SSC2_SendWord(0x8000);
//PORT_P02_OpenDrain_En();
SSC2_SendWord(0xFFFF);
//PORT_P02_OpenDrain_Dis();
PORT_P00_Output_High_Set();
}
 
void readSensorAngle(void)
{
//uint16 ret;
PORT_P00_Output_Low_Set();
SSC2_SendWord(0x8020);
//PORT_P02_OpenDrain_En();
gu16angVal = SSC2_SendWord(0xFFFF);
//Remove 15th bit, it is for new data received
gu16angVal = gu16angVal & (0x7FFF);
//PORT_P02_OpenDrain_Dis();
  PORT_P00_Output_High_Set();
 
//return angval;
}
 
uint16 count2Angle(uint16 angleCount)
{
uint16 angleValue;
//check if the value received is positive or negative
//if (angleCount & POS_BIT_14) // POS_BIT_14 is 0x4000
//{
//angleCount = angleCount - CHANGE_UINT_TO_INT_15; // CHANGE_UINT_TO_INT_15 is 0x8000
//}
angleValue = (((uint32)(ANGLE_360_VAL*100000)/POW_2_15) * ((uint32) angleCount))/1000; //Angle value scaled by 100
 
return angleValue;
}
 
0 Likes
Adithya_S
Moderator
Moderator
Moderator
100 sign-ins First question asked 50 replies posted

Hi @AmolKoli ,

TLE5012B is a 360 degree angle sensor based on Giant Magneto Resistance (GMR) technology that detects the orientation of the magnetic field.

The arrows showed on the resistors shows the magnetic direction which is fixed in the resistor. If the external magnetic field is parallel to the magnetic direction, then the resistance is minimum. If the external magnetic field is anti parallel to the magnetic direction, then the resistance is maximum.

Using ARCTAN2 function, the true angle value is calculated out of raw X and raw Y values from the sensor bridges.

AdithyaS_0-1688124975644.png

Therefore, coming to your question of some random values thrown by the sensor when the motor comes to a halt is that whenever the motor stops, the magnet attached to it will be generating magnetic field will be oriented to the sensor bridges in such a way that some raw X and raw Y values will be produced, which in turn calculate the angle. This calculated angle will be thrown out by the sensor on the data lines.

Hope this helps.

Thanks and regards,
Adithya

0 Likes

Understood. Thanks for clarification.

So just to reconfirm, it is possible that it throws max value "32767", even though the actual value is like around "5000". (I mistakenly wondered that the "32767" has something to relate to the SSC2_SendWord(0xFFFF))

0 Likes
Adithya_S
Moderator
Moderator
Moderator
100 sign-ins First question asked 50 replies posted

Hi @AmolKoli ,

Yes, this may happen sometimes.  Please oversample the angle values and then use.

Thanks and regards,
Adithya