Angle (Magnetic sensor) Forum Discussions
TLI5012B E1000には角度方向にオフセットを設定する機能はありますでしょうか?
回転検出用磁石、又は磁気センサーICの実装がズレていた場合に角度をオフセットする機能です。
また、回転検出用磁石と磁気センサICの実装のズレの許容などがございましたら教えていただきたいです。
TLI5012B E1000 | SPI/IIF, GMR, SMD - Infineon Technologies
Show LessHello. Infineon team.
i'm using TLE5012 MPS sensor, and try to communicate it.
(and i'm using aurix tc 364 DP)
i send D021 diag to get Angle value, but response start with "D021"and data follows..
is this a normal operation? communication works successfully?
is there any TLE5012 example in Aurix MCU, please let me know.
thank you.
Show LessI am trying to use TLE5012 SSC in the TLE9879 evalboard. I used the code from "https://community.infineon.com/t5/MOTIX-MCU/Tle5012b-ssc-via-tle987x-evalboard/td-p/298415" .
Here is the waveform.
yellow - SPI chip select
Light blue - SPI Data
Purple - SPI Clock
Sending a command(0x8020) in the 1st SPI clock looks good. but received data (2nd, 3rd SPI clock) have low voltage. Is it normal? angleValue is always same even though I turn the motor manually. The value is 0.351562. fixed. What is wrong? What should I do more to find a right angle value?
#include "tle_device.h"
#include "eval_board.h"
double calculateAngleSpeed(double angRange, int16_t rawAngleSpeed, uint16_t firMD, uint16_t predictionVal);
uint8_t crcCalc(uint8_t* crcData, uint8_t length);
double angleValue=0;
uint8_t crc8(uint8_t *data, uint8_t length);
uint8_t getSecondByte(uint16_t twoByteWord);
uint8_t getFirstByte(uint16_t twoByteWord);
void enableSensor();
void disableSensor();
enum errorTypes getAngleValue();
enum errorTypes readFromSensor(uint16_t command, uint16_t *data);
int16_t rawAnglevalue=0;
uint16_t rawData = 0, status_global=0, old_rawData=0;
uint16_t new_angle_value=0;
/************************************************** ***************************/
/** SSC1: sends one byte (0xAA) as SPI master @ 1 Mbaud **/
/************************************************** ***************************/
/** program SSC1 to operate at 1 Mbaud **/
/** SSC1 sends one byte at P0.3 (CLK), P0.2 (MTSR) **/
/************************************************** ***************************/
#define TLE5012B_H
// Sensor registers
#define READ_SENSOR 0x8000 //!< base command for read
#define WRITE_SENSOR 0x5000 //!< base command for write
#define READ_BLOCK_CRC 0x8088 //!< initialize block CRC check command
#define SYSTEM_ERROR_MASK 0x4000 //!< System error masks for safety words
#define INTERFACE_ERROR_MASK 0x2000 //!< Interface error masks for safety words
#define INV_ANGLE_ERROR_MASK 0x1000 //!< Angle error masks for safety words
#define CRC_POLYNOMIAL 0x1D //!< values used for calculating the CRC
#define CRC_SEED 0xFF
#define CRC_NUM_REGISTERS 0x0008 //!< number of CRC relevant registers
#define MAX_REGISTER_MEM 0x0030 //!< max readable register values buffer
#define DELETE_BIT_15 0x7FFF //!< Value used to delete everything except the first 15 bits
#define CHANGE_UINT_TO_INT_15 0x8000 //!< Value used to change unsigned 16bit integer into signed
#define CHECK_BIT_14 0x4000 //!<
#define GET_BIT_14_4 0x7FF0 //!<
#define DELETE_7BITS 0x01FF //!< values used to calculate 9 bit signed integer sent by the sensor
#define CHANGE_UNIT_TO_INT_9 0x0200 //!< Value used to change unsigned 9bit integer into signed
#define CHECK_BIT_9 0x0100
#define POW_2_15 32768.0 //!< values used to for final calculations of angle speed, revolutions, range and value
#define POW_2_7 128.0 //!<
#define ANGLE_360_VAL 360.0
#define TEMP_OFFSET 152.0 //!< values used to calculate the temperature
#define TEMP_DIV 2.776
//!< Prints a binary number with leading zeros (Automatic Handling)
#define PRINTBIN(Num) for (uint32_t t = (1UL<< (sizeof(Num)*8)-1); t; t >>= 1) Serial.write(Num & t ? '1' : '0');
//!< Prints a binary number with leading zeros (Automatic Handling) with space
#define PRINTBINS(Num) for (uint32_t t = (1UL<< (sizeof(Num)*8)-1); t; t >>= 1) Serial.write(Num & t ? " 1 " : " 0 ");
/*!
* Error types from safety word
*/
enum errorTypes
{
NO_ERROR = 0x00, //!< NO_ERROR = Safety word was OK
SYSTEM_ERROR = 0x01, //!< SYSTEM_ERROR = over/under voltage, VDD negative, GND off, ROM defect
INTERFACE_ACCESS_ERROR = 0x02, //!< INTERFACE_ACCESS_ERROR = wrong address or wrong lock
INVALID_ANGLE_ERROR = 0x03, //!< INVALID_ANGLE_ERROR = NO_GMR_A = 1 or NO_GMR_XY = 1
ANGLE_SPEED_ERROR = 0x04, //!< ANGLE_SPEED_ERROR = combined error, angular speed calculation wrong
CRC_ERROR = 0xFF //!< CRC_ERROR = Cyclic Redundancy Check (CRC), which includes the STAT and RESP bits wrong
};
/*!
* Set the UPDate bit high (read from update buffer) or low (read directly)
*/
enum updTypes
{
UPD_low = 0x0000, //!< read normal registers
UPD_high = 0x0400, //!< read update buffer registers
};
/*!
* Switch on/off safety word generation
*/
enum safetyTypes
{
SAFE_low = 0x0000, //!< switch of safety word generation
SAFE_high = 0x0001, //!< switch on safety word generation
};
uint8_t mMOSI; //!< Pin for SPI MOSI (pin 0.6 on test board);
uint8_t mMISO; //!< Pin for SPI MISO (pin 0.7 on test board)
uint8_t mSCK; //!< Pin for CLOCK (pin 0.8 on test board)
uint8_t mCS; //!< Pin for chip select (pin 0.9 on test board)
uint16_t data;
uint16_t _command1; //!< command write data [0] = command [1] = data to write
uint16_t _command2; //!< command write data [0] = command [1] = data to write
uint16_t _received[MAX_REGISTER_MEM] = {0}; //!< fetched data from sensor with last word = safety word
uint16_t _registers[CRC_NUM_REGISTERS]; //!< keeps track of the values stored in the 8 _registers, for which the CRC is calculated
int main(void)
{
/************************************************** ***************************
** initialization of the hardware modules based on the configuration done **
** by using the IFXConfigWizard **
************************************************** ***************************/
TLE_Init();
disableSensor();
Delay_us(5000);
for (;;)
{
WDT1_Service();
getAngleValue();
}
}
enum errorTypes getAngleValue()
{
enum errorTypes status = readFromSensor(0x0020, &rawData);
status_global = status;
if (status != NO_ERROR)
{
return (status);
}
// new_angle_value = (rawData & 0x8000) >> 15;
old_rawData = rawData;
rawData = (rawData & DELETE_BIT_15); // bit 15 represents a new value if it is 1
//check if the value received is positive or negative
if (rawData & CHECK_BIT_14) // CHECK_BIT_14 is 0x4000
{
rawData = rawData - CHANGE_UINT_TO_INT_15; // CHANGE_UINT_TO_INT_15 is 0x8000
}
rawAnglevalue = rawData;
angleValue = (ANGLE_360_VAL / POW_2_15) * ((double) rawAnglevalue);
return (status);
}
enum errorTypes readFromSensor(uint16_t command, uint16_t *data)
{
enum errorTypes checkError = NO_ERROR;
_command1 = READ_SENSOR | command | UPD_low | SAFE_low;
// 0x8000 | 0x0020 | 0x0000 | 0x0000
enableSensor();
PORT_ChangePinAlt(0x11,0x0); // SPI chip selected
Delay_us(1);
SSC1_SendWord(_command1);
Delay_us(20); // write read delay(twr_delay) is min 130ns
SSC1_SendWord(0x0000);
_received[0]=SSC1_ReadWord();
Delay_us(20);
SSC1_SendWord(0x0000);
_received[1]=SSC1_ReadWord();
Delay_us(20);
disableSensor();
PORT_ChangePinAlt(0x11,0x1); // SPI chip disabled
Delay_us(100);
*data = _received[0];
Delay_us(1000);
if (true)
{
// checkError = checkSafety(_received[1], _command1, &_received[0], 1);
if (checkError != NO_ERROR)
{
// data = 0;
}
}
checkError=NO_ERROR;
return (checkError);
}
void enableSensor()
{
PORT_P11_Output_Low_Set();
}
void disableSensor()
{
PORT_P11_Output_High_Set();
//digitalWrite(mCS, low);
}
Hello,
We are using TLE4999C8 Hall Sensor, for our application we wanted to implement the Short Serial Message (SSM) feature.
We are able to successfully communicate with TLE4999C8 using SENT interface, however we are not able to verify the 4 bit CRC. The CRC calculated by using the alogrithm mentioned in the TLE4999C8 user manual does not match with the CRC received in the frame for both Short serial message and SPC.
Could you please help us with some sample code to calculate the 4bit, 6bit and 8bit CRC for the short serial message format and SPC.
Thank you,
Aditya
Show LessI want to set TLE5012 degree value zero at any position with SSC mode. Please help to guide or share example code.
我想对设备的机械零点进行标定,在该机械零点处设置TLE5012的角度为零,请问如何进行设置。我根据《基于
iGMR 原理角度传感器 TLE5012B 应用 指南》文章中的4.2.1 SSC方式标定零点进行设置,但是并没有成功,请问有没有程序可以参考,谢谢!
Hello,
I would like to use TLE5012B E1000 on IIF mode with TC234 MCU. After reading the latest User's Manual and DS, I got some questions below.
1. For work requirement, it's necessary to configure electrical 0° as the new zero position. I would like to find out how the IIF singal works after the new ANG_BASE writen to the register by SPI interface. According to User's Manual, the IFC pin will generate the pulse when the internal Incremental Interface Counter steps over 0°. Dose the internal Incremental Interface Counter means the AVAL?
Could I describe this process like this: Set new ANG_BASE -> AVAL counter is 0 -> generate IFC pluse -> external IIF counter(like GPT12) reset 0
2. TLE5012B E1000 is preconfigured 12bit mode, one count per 0.088° angle step. This means that the start-up pluses is transmited in 4096 resolution. If I want to set it work with 11bit(2048) mode, what process should I take after the external IIF counter(like GPT12) get the start-up pluses?
3. Could the TLE5012B E1000 detect when tilt angle of magnet with respect to axis of rotation is really big?(report by S_MAGOL in STAT register?)
Best reagrds,
Bowen
Show LessPlease help to guide or share example code for using the Infineon angle sensor with the XMC1000 series(Not sensorless code)
Maybe share for just one of the define section for variables, is ok.
Show LessTLE5109のデータシートを見る限りだと「The Magneto Resistive (MR) sensors are implemented using vertical integration.」と記載されており、角度算出を行う垂直タイプであると認識しています。
一方、他社さんの文献を示すようで申し訳ないのですが、浜松電子様では、垂直タイプでの検出原理の場合、飽和感度領域に達する磁界強度においての使用が求められていると書かれていました。(https://www.hkd.co.jp/amr_tec_suichoku/)
そこで、infineon様のデータシートを見たところ、「Magnetic induction AMR」は「min 20mT」との記載がありました。
それはつまり、このAMR角度センサは飽和感度領域である20mT以上の磁界強度における使用が検討されているということでよろしいでしょうか?
Show Less