This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMAG5170 : Utilisation du TMAG5170

Part Number: TMAG5170
Other Parts Discussed in Thread: MSP430FR2433

salut j’utilise le TMAG5170 et le MSP430FR2433 et je veux les connecter ensemble et envoyer une tram SPI du MSP au TMAG, qui lance la mesure et renvoie les données au MSP430
Je ne comprends pas où je dois implémenter mon code d’initialisation TMAG et ce que je dois lui envoyer pour commencer la mesure
J’ai créé un code qui me permet d’envoyer une trame à partir du MSP430 et maintenant je voudrais lier le TMAG5170 dans cette boucle pour lire les données du MSP430 et lui renvoyé sa mesure.

Pour votre information, j’ai vu l’exemple de code du TMAG5170 mais je ne sais pas vraiment comment l’utiliser

  • Maxime,

    To read from TMAG5170, you will need to first configure and enable the device.  By default at power up, all axes are disabled.  Additionally, another feature which is enabled by default is CRC error checking.  This is to help ensure that SPI transactions are valid for both the host and the sensor.

    The code examples and this E2E forum both describe how to properly calculate the CRC bits (4 LSBs) required for the transaction:

    https://e2e.ti.com/support/sensors-group/sensors/f/sensors-forum/1058986/tmag5170-tmag5170-crc-algorithm

    It is sometimes helpful to disable CRC at first while debugging the SPI protocol.  This may be done by writing 0x0F000407

    To enable the sensor, it is necessary to set the MAG_CH_EN setting within the SENSOR_CONFIG register:

    Once the sensor is enabled, then it should be possible to start reading the appropriate output channel.  If you want the device to convert magnetic fields continuously, you may want to set OPERATING_MODE to value 2h:

    Once the device is running conversions, you can read the output from these registers:

    Thanks,

    Scott

  • Bonjour,

    Suite à votre message qui m’a bien aidé je cherche quelle commande écrire pour envoyer le X_CH_RESULT, Y_CH_RESULT, Z_CH_RESULT sur la broche MISO pour lire les données sur un MSP430FR2433.
    Merci
  • Maxime,

    To read the X, Y, or Z channel resutls, you would initiate a read command on SPI to registers 0x09, 0x0A, and 0x0B.  The format of the read data will follow the diagram shown here

    Here the first bit in the SDI communication will be a 1 to indicate a read operation.  The next 7 bits will indicate the register address you are accessing.  During this time, the device will shift out on SDO various status bits.  After transmitting the register address is complete, then the device will shift out on SDO the register value for the next 16 bits.  This should be the contents of the X, Y, or Z channel result register.

    Thanks,

    Scott