TIDUF78 May 2024
The SPI on the TMS320F280049C MCU was setup as host with 10MHz SPI clock and two consecutive 16-bit SPI data transfers to support 32-bit frames. The serial clock was configured to low level before and after the SPI transfer. The SPI receive data (MISO) is latched on the rising SPI clock edge (SCLK) and the transmit data (MOSI) is transmitted on the falling clock edge.
After start-up the TMAG5170 registers were configured using the regular 32-Bit SDO read frame. Table 3-1 shows the default configuration with the N45 magnet used in this reference design.
REGISTER OFFSET [HEX] | VALUE [HEX] | COMMENT |
---|---|---|
0h | 0130h | No averaging, sense magnetic temp coefficient 0.12%/deg C (NdBFe), active trigger mode |
1h | 0345h | XZX channel enabled (pseudo-simultaneous sampling),Z range ±50mT, X range ±50mT |
2h | 0400h | Conversion start at nALERT pulse (falling edge) |
3h | 0000h | Default |
4h | 7D83h | Default |
5h | 7D83h | Default |
6h | 7D83h | Default |
7h | 6732h | Default |
8h | 0040h | Read only |
9h | 0058h | Read only |
Ah | 0000h | Read only |
Bh | 7FD0h | Read only |
Ch | 4500h | Read only |
Dh | 0000h | Read only |
Eh | 0300h | Read only |
Fh | 0040h | CRC enabled in SPI communication (default) |
10h | 0000h | Reset OSC counter (default) |
11h | 0000h | Default |
12h | 0000h | Default |
13h | 0000h | Read only |
14h | 0000h | Read only |
After the TMAG5170 register configuration was completed, a write command to each TMAG5170 to set the special 32-bit SDO frame. In this mode the field strength of the Z and X axis and CRC are transmitted a single 32-bit frame to reduce the overall latency.
REGISTER OFFEST [HEX] | VALUE [HEX] | COMMENT |
---|---|---|
2h | 0480h | Conversion start at nALERT pulse (falling edge). Enable special 32-bit SDO frame (set bit 8) |
For the absolute angle measurement using CORDIC, sensor data from the Z-axis and the X-axis are required to calculate an accurate angle. The magnetic field data collected at different times through the same signal chain with a single A/D converter introduces an error in the angle calculation. The TMAG5170 offers pseudo-simultaneous sampling data collection modes to eliminate this error. Figure 3-5 shows the example for the XZX channel mode (pseudo-simultaneous sampling mode) to collect XZX data and calculate the average X data from the dual X samples. Then the time stamps for the average X and Z sensor data are the same, assuming the X-axis signal frequency is significantly lower than the ADC sample rate.