Other Parts Discussed in Thread: , MSP432E401Y, TI-SCB, TMAG5170
Hello
I am testing the TMAG5273 and configured it in W&S mode with interrupt when a threshold is crossed on the X/Y/Z axis.
It seems to be working fine: When I bring a magnet close to the sensor, I can see the interrupt firing. I wrote a test firmware that reads the X/Y/Z magnetic value when an interrupt occurs, print them, and then reconfigure the sensor to not stay in stand-by mode (i.e: set the W&S mode again). When I leave a magnet close to the sensor, I can see that the sensor is continuously generating interrupt
[2022-11-16 12:29:23.062] Magn[uT]: -1182 -37 2117 [2022-11-16 12:29:23.074] Magn[uT]: -1303 -162 2352 [2022-11-16 12:29:23.086] Magn[uT]: -1426 -275 2659 [2022-11-16 12:29:23.098] Magn[uT]: -1545 -441 2939 [2022-11-16 12:29:23.110] Magn[uT]: -1626 -610 3214 [2022-11-16 12:29:23.122] Magn[uT]: -1700 -695 3395 [2022-11-16 12:29:23.134] Magn[uT]: -1666 -801 3361 [2022-11-16 12:29:23.146] Magn[uT]: -1585 -794 3142 [2022-11-16 12:29:23.152] Magn[uT]: -1460 -809 2785 [2022-11-16 12:29:23.164] Magn[uT]: -1252 -867 2403 [2022-11-16 12:29:23.176] Magn[uT]: -1059 -920 2064 [2022-11-16 12:29:23.188] Magn[uT]: -914 -945 1768 [2022-11-16 12:29:23.200] Magn[uT]: -724 -994 1539 [2022-11-16 12:29:23.212] Magn[uT]: -560 -1064 1319 [2022-11-16 12:29:23.224] Magn[uT]: -362 -1136 1134 [2022-11-16 12:29:23.236] Magn[uT]: -219 -1086 909 [2022-11-16 12:29:23.248] Magn[uT]: -43 -1003 684 [2022-11-16 12:29:23.260] Magn[uT]: -8 -899 484
The problem I am facing is very similar to this thread where the sensor appears to become non-responsive after a while (no interrupts generated when a magnet is brought close to the sensor). The time it takes for the sensor to be apparently non-responsive seems to be typically a few minutes without magnet nearby.
The configuration I am using is:
- DEVICE_CONFIG_1: 0x14 (CONV_AVG set to 32x)
- DEVICE_CONFIG_2: 0x23 (W&S mode, THR_HYST set)
- SENSOR_CONFIG_1: 0x71 (X,Y,Z channel enabled, SLEEPTIME of 5ms)
- X_THR_CONFIG: 0x2 (625uT)
- Y_THR_CONFIG: 0x2 (625uT)
- Z_THR_CONFIG: 0x2 (625uT)
- INT_CONFIG_1: 0x44 (THRSLD_INT set, interrupt through INT)
All the other registers are set to their default values.
When the sensor appears to be non-responsive, I reconfigure the W&S mode, and after that, the interrupts are generated again as expected when a magnet is brought up close (which is not a viable option, I would like to avoid any communication with the sensor unless a threshold is crossed, in order to stay as long as possible in the W&S mode).
To be noted: when doing the reconfiguration, I start by reading the manufacturer ID to ensure the sensor is ready to accept command. The read fail a first time and succeeds the second time, which would indicate to me that
the sensor was still in W&S mode -> the first read wakes it up and the second one succeed while the sensor is awake.
It seems I can work-around this issue by enabling the temperature acquisition (setting T_CH_EN in T_CONFIG register). With the temperature acquisition enabled, I did not encounter any issue: After more than 12 hours without a magnet close to the sensor, interrupts were generated as expected when a magnet was brought close to the sensor.
Instead of enabling the temperature acquisition, if I lower the CONV_AVG to 1x, it also looks like I do not face the issue anymore (although I did not run test with this setting for hours).
The fact that those two settings (temperature acquisition enabled OR CONV_AVG set to 1x) appear to work-around the issue do not make sense to me, most likely they somehow just make the issue less likely. This leads me to wonder whereas I configured the sensor in a "illegal" mode initially? Do you have a recommended configuration to have the W&S mode with interrupt when a threshold is crossed? Do you see anything wrong with the configuration I used?
In case it is relevant, I was doing my testing with a nucleo l432kc board and a MIKROE-5188 dev kit, powered at 3.3V.
Thanks in advance,
Philémon