Oct 30, 2019
07:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oct 30, 2019
07:35 AM
I am using (or attempting to use) a teensy 3.2 using the Arduino IDE to interact with a 3-axis hall effects sensor (the Infineon TLE493D-A2B6). The sensor can only be interacted with via I2C, and it has 2 addresses. The first address (6A Hex) is the write address. 6B Hex is the read address. As an initial test, I am trying to write some configuration data, and then read back some sensor data (initially just 1 register worth of data, essentially the MSB for the x-axis). Here is my Arduino code:
// Define includes
#include // Wire header file for I2C and 2 wire
//
int HallAddressWrite = 0x6A; // Device write address
int HallAddressRead = 0x6B; // Device write address
byte X_Axis_MSB = 0x00; // Bx MSB register
byte Y_Axis_MSB = 0x01; // By MSB register
byte Z_Axis_MSB = 0x02; // Bz MSB register
byte xy_Axis_LSB = 0x04; // Bx, By LSB register
byte z_Axis_LSB = 0x05; // Bz, By LSB register
byte config_Address = 0x10; //config register
byte value=0; //init value
int baudRate = 9600;
The above section is initialisation stuff. Hardcoding register addresses etc.
void setup() {
Serial.begin(baudRate); // Set Serial Port speed
delay(1000);
Wire.begin(); // Join the I2C bus as a master
Wire.beginTransmission(HallAddressWrite); // Address the sensor for writing
Wire.write(config_Address); // Address the Configuration register
Wire.write(0); // write the value to register
Wire.endTransmission(); // Stop transmitting
delay(100);
}
The above section is writing 00000000b register 10H
void loop() {
Wire.beginTransmission(HallAddressRead); // Address the sensor for Reading
Wire.write(X_Axis_MSB); // Write pointer register
Wire.requestFrom(HallAddressRead, 1); // 1 byte from sensor.
value = Wire.read(); // Read byte from register 12
Wire.endTransmission(); // Stop transmitting
Serial.println(value);
delay (500);
}
I find that value always equals 255 (11111111b).
Has anyone got any idea how I should be interacting with this device, or can provide some advice?
// Define includes
#include
//
int HallAddressWrite = 0x6A; // Device write address
int HallAddressRead = 0x6B; // Device write address
byte X_Axis_MSB = 0x00; // Bx MSB register
byte Y_Axis_MSB = 0x01; // By MSB register
byte Z_Axis_MSB = 0x02; // Bz MSB register
byte xy_Axis_LSB = 0x04; // Bx, By LSB register
byte z_Axis_LSB = 0x05; // Bz, By LSB register
byte config_Address = 0x10; //config register
byte value=0; //init value
int baudRate = 9600;
The above section is initialisation stuff. Hardcoding register addresses etc.
void setup() {
Serial.begin(baudRate); // Set Serial Port speed
delay(1000);
Wire.begin(); // Join the I2C bus as a master
Wire.beginTransmission(HallAddressWrite); // Address the sensor for writing
Wire.write(config_Address); // Address the Configuration register
Wire.write(0); // write the value to register
Wire.endTransmission(); // Stop transmitting
delay(100);
}
The above section is writing 00000000b register 10H
void loop() {
Wire.beginTransmission(HallAddressRead); // Address the sensor for Reading
Wire.write(X_Axis_MSB); // Write pointer register
Wire.requestFrom(HallAddressRead, 1); // 1 byte from sensor.
value = Wire.read(); // Read byte from register 12
Wire.endTransmission(); // Stop transmitting
Serial.println(value);
delay (500);
}
I find that value always equals 255 (11111111b).
Has anyone got any idea how I should be interacting with this device, or can provide some advice?
Solved! Go to Solution.
Labels
1 Solution
Oct 31, 2019
12:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oct 31, 2019
12:41 AM
You may try this: Library for Infineons's 3D magnetic sensor TLE493D for Arduino.
https://github.com/Infineon/TLE493D-3DMagnetic-Sensor
https://github.com/Infineon/TLE493D-3DMagnetic-Sensor
1 Reply
Oct 31, 2019
12:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oct 31, 2019
12:41 AM
You may try this: Library for Infineons's 3D magnetic sensor TLE493D for Arduino.
https://github.com/Infineon/TLE493D-3DMagnetic-Sensor
https://github.com/Infineon/TLE493D-3DMagnetic-Sensor