Go Down

Topic: 3D magnetic sensor (Read 203 times) previous topic - next topic

dudewiththenose

Apr 19, 2019, 09:02 am Last Edit: Apr 19, 2019, 09:23 am by dudewiththenose
Hello everyone !

  I want to detect magnetic fields using a 3D magnetic sensor from Infineon. The goal is simple, getting a magnetic fields following x-axisn y-axis, z-axis.

To do that, I wrote this code (I found some part on the internet tho).

Code: [Select]
#include <Tle493d_w2b6.h>

Tle493d_w2b6 Tle493dMagnetic3DSensor = Tle493d_w2b6();
void setup() {
  Serial.begin(9600);
  while (!Serial);
  Tle493dMagnetic3DSensor.begin();
  Tle493dMagnetic3DSensor.enableTemp();
}

void loop() {
  Tle493dMagnetic3DSensor.updateData();

  Serial.print(Tle493dMagnetic3DSensor.getX());
  Serial.print(" ; ");
  Serial.print(Tle493dMagnetic3DSensor.getY());
  Serial.print(" ; ");
  Serial.println(Tle493dMagnetic3DSensor.getZ());
 
  delay(500);
}

But then, I only get a serie of the same value for each axis : -266,24...
Following that, there's the red LED that is lighted (mom told me whenever you see red things, start thinking about things not working *joking*), and my device is going really hot.
Could someone help me please ? :)

Best regards.

https://www.infineon.com/dgdl/Infineon-Infineon-Infineon-3DMS2GO_TLv493D-A1B6-UM-v01_01-EN-UM-v01-UM-v01_01-EN.pdf?fileId=5546d462525dbac40152ac4ca1d318c2
Here's the instruction manual (I didn't find the datasheet).
Here's the GitHub link :https://github.com/Infineon/TLV493D-A1B6-3DMagnetic-Sensor


dudewiththenose

Nevermind guys, I found what was wrong, just to discover that there's another error.

The library I was using was not for this version of sensor.
So I downloaded the right library and such, and I'm currently using this code :

Code: [Select]
#include <Tlv493d.h>

// Tlv493d Opject
Tlv493d Tlv493dMagnetic3DSensor = Tlv493d();

void setup() {
  Serial.begin(9600);
  while(!Serial);
  Tlv493dMagnetic3DSensor.begin();
  Tlv493dMagnetic3DSensor.setAccessMode(Tlv493dMagnetic3DSensor.MASTERCONTROLLEDMODE);
  Tlv493dMagnetic3DSensor.disableTemp();
}

void loop() {
  delay(Tlv493dMagnetic3DSensor.getMeasurementDelay());
  Tlv493dMagnetic3DSensor.updateData();

  Serial.print(Tlv493dMagnetic3DSensor.getX());
  Serial.print(" ; ");
  Serial.print(Tlv493dMagnetic3DSensor.getY());
  Serial.print(" ; ");
  Serial.println(Tlv493dMagnetic3DSensor.getZ());
}


But here I go on an error like :

Code: [Select]
Arduino : 1.8.9 (Windows Store 1.8.21.0) (Windows 10), Carte : "XMC1100 XMC2Go, PC"

libraries\true\Tlv493d.cpp.o: In function `Tlv493d::getRegBits(unsigned char)':

C:\Users\arnau\OneDrive\Documents\Arduino\libraries\true/Tlv493d.cpp:312: undefined reference to `tlv493d::getFromRegs(tlv493d::RegMask_t const*, unsigned char*)'

libraries\true\Tlv493d.cpp.o: In function `Tlv493d::setRegBits(unsigned char, unsigned char)':

C:\Users\arnau\OneDrive\Documents\Arduino\libraries\true/Tlv493d.cpp:297: undefined reference to `tlv493d::setToRegs(tlv493d::RegMask_t const*, unsigned char*, unsigned char)'

C:\Users\arnau\OneDrive\Documents\Arduino\libraries\true/Tlv493d.cpp:297: undefined reference to `tlv493d::setToRegs(tlv493d::RegMask_t const*, unsigned char*, unsigned char)'

C:\Users\arnau\OneDrive\Documents\Arduino\libraries\true/Tlv493d.cpp:297: undefined reference to `tlv493d::setToRegs(tlv493d::RegMask_t const*, unsigned char*, unsigned char)'

C:\Users\arnau\OneDrive\Documents\Arduino\libraries\true/Tlv493d.cpp:297: undefined reference to `tlv493d::setToRegs(tlv493d::RegMask_t const*, unsigned char*, unsigned char)'

C:\Users\arnau\OneDrive\Documents\Arduino\libraries\true/Tlv493d.cpp:297: undefined reference to `tlv493d::setToRegs(tlv493d::RegMask_t const*, unsigned char*, unsigned char)'

libraries\true\Tlv493d.cpp.o: In function `Tlv493d::setAccessMode(Tlv493d::AccessMode_e)':

C:\Users\arnau\OneDrive\Documents\Arduino\libraries\true/Tlv493d.cpp:106: undefined reference to `tlv493d::writeOut(tlv493d::BusInterface_t*)'

libraries\true\Tlv493d.cpp.o: In function `Tlv493d::begin(TwoWire&, Tlv493d_Address, bool)':

C:\Users\arnau\OneDrive\Documents\Arduino\libraries\true/Tlv493d.cpp:67: undefined reference to `tlv493d::initInterface(tlv493d::BusInterface_t*, TwoWire*, unsigned char)'

C:\Users\arnau\OneDrive\Documents\Arduino\libraries\true/Tlv493d.cpp:78: undefined reference to `tlv493d::readOut(tlv493d::BusInterface_t*)'

libraries\true\Tlv493d.cpp.o: In function `Tlv493d::setRegBits(unsigned char, unsigned char)':

C:\Users\arnau\OneDrive\Documents\Arduino\libraries\true/Tlv493d.cpp:297: undefined reference to `tlv493d::setToRegs(tlv493d::RegMask_t const*, unsigned char*, unsigned char)'

C:\Users\arnau\OneDrive\Documents\Arduino\libraries\true/Tlv493d.cpp:297: undefined reference to `tlv493d::setToRegs(tlv493d::RegMask_t const*, unsigned char*, unsigned char)'

C:\Users\arnau\OneDrive\Documents\Arduino\libraries\true/Tlv493d.cpp:297: undefined reference to `tlv493d::setToRegs(tlv493d::RegMask_t const*, unsigned char*, unsigned char)'

C:\Users\arnau\OneDrive\Documents\Arduino\libraries\true/Tlv493d.cpp:297: undefined reference to `tlv493d::setToRegs(tlv493d::RegMask_t const*, unsigned char*, unsigned char)'

libraries\true\Tlv493d.cpp.o: In function `Tlv493d::updateData()':

C:\Users\arnau\OneDrive\Documents\Arduino\libraries\true/Tlv493d.cpp:179: undefined reference to `tlv493d::readOut(tlv493d::BusInterface_t*, unsigned char)'

libraries\true\Tlv493d.cpp.o: In function `Tlv493d::setRegBits(unsigned char, unsigned char)':

C:\Users\arnau\OneDrive\Documents\Arduino\libraries\true/Tlv493d.cpp:297: undefined reference to `tlv493d::setToRegs(tlv493d::RegMask_t const*, unsigned char*, unsigned char)'

libraries\true\Tlv493d.cpp.o: In function `Tlv493d::disableInterrupt()':

C:\Users\arnau\OneDrive\Documents\Arduino\libraries\true/Tlv493d.cpp:127: undefined reference to `tlv493d::writeOut(tlv493d::BusInterface_t*)'

libraries\true\Tlv493d.cpp.o: In function `Tlv493d::setRegBits(unsigned char, unsigned char)':

C:\Users\arnau\OneDrive\Documents\Arduino\libraries\true/Tlv493d.cpp:297: undefined reference to `tlv493d::setToRegs(tlv493d::RegMask_t const*, unsigned char*, unsigned char)'

libraries\true\Tlv493d.cpp.o: In function `Tlv493d::disableTemp()':

C:\Users\arnau\OneDrive\Documents\Arduino\libraries\true/Tlv493d.cpp:142: undefined reference to `tlv493d::writeOut(tlv493d::BusInterface_t*)'

collect2.exe: error: ld returned 1 exit status

exit status 1
Erreur de compilation pour la carte XMC1100 XMC2Go //Compilation error for ... card

Ce rapport pourrait être plus détaillé avec
l'option "Afficher les résultats détaillés de la compilation"
activée dans Fichier -> Préférences.


First time I'm seeing this, anyone ?

jremington

#2
Apr 19, 2019, 05:59 pm Last Edit: Apr 19, 2019, 06:00 pm by jremington
You are missing some code.

Quote
So I downloaded the right library and such,
Probably not, or not all of it.

Go Up