MagAlpha Test Boards TBMA-UG User Guide 2015 REV. 1.0 KEY POINTS MagAlpha EVB Pinouts Round Sensor Board (TBMAxxx-Q-RD-00A) Long Probe Board (TBMAxxx-Q-LT-00A) Connections and Sample C-Code Magnetic Setup OVERVIEW This document provides an overview of the test boards available for MagAlpha sensors. These boards provide a connection from a MagAlpha chip to an easy-to-use connector and can be used in customer projects. Currently, there are three test boards (TBMA) available for the MagAlpha sensor family. These boards are suitable for use with all MagAlpha sensors as all sensors in the MagAlpha family are pin-compatible. However, not all pins and functions are available for some versions of MagAlpha, and these pins should be left unconnected. For the pinout of your MagAlpha sensor please refer to the appropriate datasheet. Monolithic Power Systems, Inc. | Gland, Switzerland | Tel: +41 22 364 63 50 | [email protected] | www.sensimatech.com MPS Proprietary Information. Unauthorized Photocopy and Duplication Prohibited. © 2014 Monolithic Power Systems. All Rights Reserved. MA700 Rev 1.0 September 2014 1 MagAlpha Test Boards TBMA-UG User Guide 2015 rev1.0 1. ROUND SENSOR BOARD TABLE 1. Round Sensor Board Pins Pin FIGURE 1. Round Sensor Board (dimensions in mm) * Denotes minimum connections necessary, some pins may not be available depending on part used Name CN1.1 VDD * CN1.2 GND * CN1.3 V_FLASH CN1.4 CS * CN1.5 SCLK * CN1.6 MISO * CN1.7 MOSI CN1.8 DR CN2.1 U CN2.2 V CN2.3 W CN2.4 A CN2.5 B CN2.6 Z CN2.7 Reserved CN2.8 PWM Part Numbers: TBMA300-Q-RD-00A TBMA700-Q-RD-00A Monolithic Power Systems, Inc. | Gland, Switzerland | Tel: +41 22 364 63 50 | [email protected] | www.sensimatech.com MPS Proprietary Information. Unauthorized Photocopy and Duplication Prohibited. © 2014 Monolithic Power Systems. All Rights Reserved. MA700 Rev 1.0 September 2014 2 MagAlpha Test Boards TBMA-UG User Guide 2015 rev1.0 2. LONG PROBE BOARD TABLE 2. Long Probe Board Pins Pin Name CN1.1 VDD * CN1.2 GND * CN1.3 V_FLASH CN1.4 CS * CN1.5 SCLK * CN1.6 MISO * CN1.7 MOSI CN1.8 DR CN2.1 U CN2.2 V CN2.3 W CN2.4 A CN2.5 B CN2.6 Z CN2.7 Reserved CN2.8 PWM Monolithic Power Systems, Inc. | Gland, Switzerland | Tel: +41 22 364 63 50 | [email protected] | www.sensimatech.com MPS Proprietary Information. Unauthorized Photocopy and Duplication Prohibited. © 2014 Monolithic Power Systems. All Rights Reserved. MA700 Rev 1.0 September 2014 3 MagAlpha Test Boards TBMA-UG User Guide 2015 rev1.0 Part Numbers: TBMA300-Q-LT-00A TBMA700-Q-LT-00A FIGURE 2. Long Probe Board (dimensions in mm) * Denotes minimum connections necessary, some pins may not be available depending on part used Monolithic Power Systems, Inc. | Gland, Switzerland | Tel: +41 22 364 63 50 | [email protected] | www.sensimatech.com MPS Proprietary Information. Unauthorized Photocopy and Duplication Prohibited. © 2014 Monolithic Power Systems. All Rights Reserved. MA700 Rev 1.0 September 2014 4 MagAlpha Test Boards TBMA-UG User Guide 2015 rev1.0 In order to use the MagAlpha with a microcontroller, a minimum of 5 connections are necessary (VCC, GND, CS, SCLK, and MISO). In addition, a 6th line (MOSI) is needed if you want to write to the MagAlpha sensor (see Fig. 3). 3.3 V 100 nF 10 uF VDD MISO SPI Interface master MOSI SCLK CS DR VFLASH 13 16 6 A 4 2 B 12 3 Z 15 U 1 V 9 W 7 MagAlpha 5 14 11 8 GND PWM FIGURE 3. MagAlpha SPI Connection Diagram To read out the angle, pull the CS line from high to low and send 16 pulses through the SCLK pin. Data presented on the MISO line represent the angle readout. Most microcontrollers provide an SPI hardware module as well as a library to handle the transmission automatically. Set the SPI interface to mode 3 (CPOL=1) and use the SPI libraries provided by the microcontroller manufacturer (see Fig. 4). FIGURE 4. MagAlpha SPI Transmission Timing Diagram Monolithic Power Systems, Inc. | Gland, Switzerland | Tel: +41 22 364 63 50 | [email protected] | www.sensimatech.com MPS Proprietary Information. Unauthorized Photocopy and Duplication Prohibited. © 2014 Monolithic Power Systems. All Rights Reserved. MA700 Rev 1.0 September 2014 5 MagAlpha Test Boards TBMA-UG User Guide 2015 rev1.0 To write into a register, send the following 16-bit data from the microcontroller via SPI: Write Reg. Address 0 0 0 1 x x x x MSB LSB Value 0 0 0 0 0 0 0 0 For example, to set the Zero Setting to 180 degrees do the following: Write Reg. Address 0 0 0 1 0 1 0 0 MSB LSB Value 0 1 1 1 1 1 1 1 To read back from a register, a 16-bit data should be sent from the microcontroller via SPI. For example, to read back the Zero setting, send the following: Read Reg. Address 0 0 1 0 0 1 0 0 MSB LSB Disregard 0 0 0 0 0 0 0 0 During the same transmission cycle, the SPI of the microcontroller should read: Angle Out A(15:12) A(11:8) MSB LSB Value Z(11:4) Monolithic Power Systems, Inc. | Gland, Switzerland | Tel: +41 22 364 63 50 | [email protected] | www.sensimatech.com MPS Proprietary Information. Unauthorized Photocopy and Duplication Prohibited. © 2014 Monolithic Power Systems. All Rights Reserved. MA700 Rev 1.0 September 2014 6 MagAlpha Test Boards TBMA-UG User Guide 2015 rev1.0 3. PSEUDO CODE FOR MICROCONTROLLER The code below is a C-style pseudo code for the microcontroller. For additional detailed implementation, please refer to your microcontroller documentation. int Main(void) { uint16 data; float angle; SPI_init(set SPI to mode 3); SPI_open(); // ---- The following codeblock could be put into a loop ---SPI_ChipSelect(); data = SPI_read(16 bits); SPI_ChipUnselect(); // ---- The above codeblock could be put into a loop ---angle = data*360/65536; //angle in degrees // ---- Write to register ---SPI_ChipSelect(); SPI_write(0x147f); //Zero setting to 180 degrees SPI_ChipUnselect(); // ---- End of Write to register ---// ---- Read from register ---SPI_ChipSelect(); data = SPI_write(0x2400); //Read Zero setting, from same cycle data &= 0x00ff; SPI_ChipUnselect(); // ---- End of Read from register ---SPI_close(); } Monolithic Power Systems, Inc. | Gland, Switzerland | Tel: +41 22 364 63 50 | [email protected] | www.sensimatech.com MPS Proprietary Information. Unauthorized Photocopy and Duplication Prohibited. © 2014 Monolithic Power Systems. All Rights Reserved. MA700 Rev 1.0 September 2014 7 MagAlpha Test Boards TBMA-UG User Guide 2015 rev1.0 4. MAGNETIC SETUP FIGURE 5. End-of-Shaft Configuration FIGURE 6. Side-Shaft Configuration See Fig. 5 and Fig. 6 for mounting a magnet in end-of-shaft and side-shaft configurations. In both cases, use a diametrically magnetized, cylindrical or ring magnet. Make sure that the magnetic fields are high enough. For instance a NdFeB magnet (with a diameter of 5mm and a height of 2.5mm) positioned at 1mm or 2mm away from the surface of the QFN package should provide a sufficient magnetic field. For example, this magnet (http://www.dextermag.com/products/magnets-for-sensors-encoders/diametric-discmagnets, part number 2910041-1) can be used. For the end-of-shaft configuration, place the sensor coaxially with the shaft. As a rule of thumb, the precision of the x-y placement should be with +/- 5% of the diameter of the magnet for best results. For the side-shaft configuration, place the sensor coplanarily with the magnet. The radial distance between the magnet and the sensor depends on the magnet size, usually the closer the better. The axial position is less critical: the sensor center should be somewhere between the lower and the upper surface of the magnet. Monolithic Power Systems, Inc. | Gland, Switzerland | Tel: +41 22 364 63 50 | [email protected] | www.sensimatech.com MPS Proprietary Information. Unauthorized Photocopy and Duplication Prohibited. © 2014 Monolithic Power Systems. All Rights Reserved. MA700 Rev 1.0 September 2014 8