austriamicrosystems AG is now ams AG The technical content of this austriamicrosystems application note is still valid. Contact information: Headquarters: ams AG Tobelbaderstrasse 30 8141 Unterpremstaetten, Austria Tel: +43 (0) 3136 500 0 e-Mail: [email protected] Please visit our website at www.ams.com AS5040 8-bit Programmable Magnetic Rotary Encoder AS5245 AS5245-AB-v1.0 Adapterboard Programmable Magnetic Rotary Encoder OPERATION MANUAL 1 General Description lv al id PWM signal. An internal voltage regulator allows operation of the AS5245 from 3.3V or 5.0V supplies. am lc s on A te G nt st il The AS5245 is a contactless magnetic angle encoder for accurate measurement up to 360º and includes two AS5145 devices in a punched stacked leadframe. It is a system-onchip, combining integrated Hall elements, analog front end and digital signal processing in a single device. To measure the angle, only a simple two-pole magnet, rotating over the center of the chip is required. The magnet may be placed above or below the IC. The absolute angle measurement provides instant indication of the magnet’s angular position with a resolution of 0.0879º = 4096 positions per revolution. This digital data is available as a serial bit stream and as a 2 The AS5245 Adapter board 2.1 Board description The AS5245 adapter board is a simple circuit allowing test and evaluation without building a test fixture or PCB. The PCB can be used as standalone unit or attached to a microcontroller. The standalone operation requires a 5V or 3.3V power supply only; the magnet’s angle can be read on the PWM or analog output. J1 connector - TOP die (Prg, power supply, serial interface) AS5245 encoder J3 connector - BOT die (Prg, power supply, serial interface) J4 connector - BOT die (PWM, incremental and status outputs) Figure 1: AS5245 Adapterboard Te ch ni 4 x 2.6mm mounting holes ca J2 connector - TOP die (PWM, incremental and status outputs) Revision 1.0, October 2009 Page 1 of 10 www.austriamicrosystems.com AS5245 Programmable Magnetic Rotary Encoder Adapterboard Operation Manual 2.2 Mounting the AS5245 adapter board Bearing M2~M2.5 Screw + nut Casing Rotating shaft and magnet holder Spacer Not ferromagnetic (plastic, brass, copper, stainless steel, aluminum…) Te ch ni ca am lc s on A te G nt st il lv al id AS5245-AB PCB Figure 2: AS5245 adapter board mounting and dimension A diametric magnet must be placed over on under the AS5245 encoder, and should be centered on the middle of the package with a tolerance of 0.5mm. The airgap between the magnet and the encoder casing should be maintained in the range 0.5mm~2mm. The magnet holder must not be ferromagnetic. Materials as brass, copper, aluminum, stainless steel are the best choices to make this part. Revision 1.0, October 2009 Page 2 of 10 www.austriamicrosystems.com AS5245 Programmable Magnetic Rotary Encoder Adapterboard Operation Manual Tst2_B GND J3 J1 J2 J4 PWM Tst1_A DO MagIn CSn CLK Mode_I MagDn Prg 5V Tst2_B GND GND 3V3 PWM Tst1_A DO MagIn CSn CLK Mode_I MagDn 3V3 GND 5V Prg 3 AS5245 and adapter board pinout BOT al id TOP am lc s on A te G nt st il Figure 3: AS5245 adapter board connectors and encoder pinout lv N AS5245 S Pin# Pin# Symbol Board AS5245 Board JP1/3 - 1 8, 9 GND S JP1/3 - 2 14, 15 DO DO_T Data Output of Synchronous Serial Interface JP1/3 - 3 12, 13 CLK DI_ST Clock Input of Synchronous Serial Interface; Schmitt-Trigger input JP1/3 - 4 16, 17 CSn JP1/3 - 5 24, 25 3V3 JP1/3 - 6 26, 27 5V JP1/3 - 7 10, 11 Prg JP2/4 - 1 2, 3 Tst2_B DO Test output in default mode JP2/4 - 2 1, 32 Tst1_A DO Test output in default mode JP2/4 - 3 18, 19 PWM DO Pulse Width Modulation of approx. 244Hz; 1µs/step (opt. 122Hz; 2µs/step) JP2/4 - 4 28, 29 MagIn DO_OD Magnet Field Magnitude INCrease; active low, indicates a distance reduction between the magnet and the device surface. JP2/4 - 5 30, 31 MagDn DO_OD Magnet Field Magnitude DECrease; active low, indicates a distance increase between the device and the magnet. Select between slow (open, low: VSS) and fast (high) mode. Internal pull-down resistor. Type DI_PU_ST Chip Select, active low; Schmitt-Trigger input, internal pull-up resistor (~50kΩ) connect to VSS in incremental mode 3V-Regulator Output S 5V Supply OTP Programming Input and Data Input for Daisy Chain mode. Internal pull-down resistor (~74kΩ). May be connected to VSS if programming is not used ch ni ca DI_PD 6, 7 Mode_I DIO_PD JP2/4 - 7 8, 9 GND S Te Supply ground S JP2/4 - 6 Pin types: DO_OD DI_PD DI_PU DI Description digital output open drain digital input pull-down digital input pull-up digital input Supply ground Table 1: Pin description S DO_T ST Revision 1.0, October 2009 supply pin digital output /tri-state schmitt-trigger input Page 3 of 10 www.austriamicrosystems.com AS5245 Programmable Magnetic Rotary Encoder Adapterboard Operation Manual 4 Operation use cases Standalone SSI output mode 4.2 Standalone PWM output mode am lc s on A te G nt st il lv al id 4.1 Figure 4: Using the SSI output with the adapter board The most complete and accurate solution for a MCU to read the angle of a magnet is the serial interface. The serial word contains 18 bits and consists of 12 bit angle value and some other indicator bits like MagINC, MagDEC, which can be read at the same time. Figure 5: Using the PWM output with the adapter board The AS5245 provides a pulse width modulated output (PWM), whose duty cycle is proportional to the measured angle. The PWM signal (J2/4 pin #3) with a period of 1025us (1us step) and 5V pulse voltage (in case of 5V power supply) can be connected to the capture/timer input of a microcontroller in order to decode the angle value. PW MIN 0 deg (Pos 0) 1µs 102 5µs PW M AX 359.65 deg (Pos 1023) 102 4µ s Te ch ni ca Angle Figure 6: PWM duty cycle depending on magnet position Revision 1.0, October 2009 Page 4 of 10 www.austriamicrosystems.com AS5245 Programmable Magnetic Rotary Encoder Adapterboard Operation Manual Standalone incremental output am lc s on A te G nt st il lv al id 4.3 Figure 7: Using the Incremental output with the adapter board The quadrature mode is enabled by programming the related OTP bits (Md0, Md1). Te ch ni ca For further information, please refer to datasheet. Revision 1.0, October 2009 Page 5 of 10 www.austriamicrosystems.com AS5245 Programmable Magnetic Rotary Encoder Adapterboard Operation Manual Daisy chain mode ni ca am lc s on A te G nt st il lv al id 4.4 ch Figure 8: Using Daisy-Chain mode with the adapter board Te By using more than one adapter board, a setup in daisy chain mode is possible. In this mode capacitor C2 (refer to Fig.10) must be disconnected when using the 1nF capacitor shown in Fig.8. or directly replaced by this capacitor. The serial data of all connected devices is read from the DO pin of the first device in the chain. The Prog pin of the last device in the chain should be connected to VSS. The length of the serial bit stream increases with every connected device (board) by n * (18+1) bits. Due to R = 100R and C = 1nF, the CLK is limited the maximum 1MHz. Revision 1.0, October 2009 Page 6 of 10 www.austriamicrosystems.com AS5245 Programmable Magnetic Rotary Encoder Adapterboard Operation Manual Programming the AS5245 Te ch ni ca am lc s on A te G nt st il lv al id 5 Revision 1.0, October 2009 Page 7 of 10 www.austriamicrosystems.com AS5245 Programmable Magnetic Rotary Encoder am lc s on A te G nt st il lv al id Adapterboard Operation Manual Figure 9: Programming the AS5245 After power-on, programming of the AS5245 is enabled with the rising edge of CSn with Prog = high and CLK = low. The OTP consists of 54 bits, of which 21 bits are available for user programming. The remaining 31 bits contain factory settings and a unique chip identifier (Chip-ID). 54 bit must be serially shifted into the OTP register via the Prog-pin, where “mbit1” is the first bit to be entered (please refer to datasheet). Data must be valid at the rising edge of CLK. Te ch ni ca After writing data into the OTP register, it can be permanently programmed by rising the Prog pin to the programming voltage VPROG of 3.3V-3.6V. 54 CLK pulses must be applied to program the fuses. For exiting the programming mode, the chip must be reset by a power-on-reset. The programmed data is available after the next power-up. Revision 1.0, October 2009 Page 8 of 10 www.austriamicrosystems.com AS5245 Programmable Magnetic Rotary Encoder Adapterboard Operation Manual 6 AS5245 adapter board hardware AS5245-AB-1.0 schematics am lc s on A te G nt st il lv al id 6.1 Figure 10: AS5245-AB-1.0 adapterboard schematics AS5245-AB-1.0 PCB layout Te ch ni ca 6.2 Figure 11: AS5245-AB-1.0 adapter board layout Revision 1.0, October 2009 Page 9 of 10 www.austriamicrosystems.com AS5245 Programmable Magnetic Rotary Encoder Adapterboard Operation Manual Revision History Revision Date Description 1.0 October , 2009 initial revision Copyrights al id Copyright © 1997-2009, austriamicrosystems AG, Schloss Premstaetten, 8141 Unterpremstaetten, Austria-Europe. Trademarks Registered ®. All rights reserved. The material herein may not be reproduced, adapted, merged, translated, stored, or used without the prior written consent of the copyright owner. All products and companies mentioned are trademarks or registered trademarks of their respective companies. lv Disclaimer am lc s on A te G nt st il Devices sold by austriamicrosystems AG are covered by the warranty and patent indemnification provisions appearing in its Term of Sale. austriamicrosystems AG makes no warranty, express, statutory, implied, or by description regarding the information set forth herein or regarding the freedom of the described devices from patent infringement. austriamicrosystems AG reserves the right to change specifications and prices at any time and without notice. Therefore, prior to designing this product into a system, it is necessary to check with austriamicrosystems AG for current information. This product is intended for use in normal commercial applications. Applications requiring extended temperature range, unusual environmental requirements, or high reliability applications, such as military, medical life-support or lifesustaining equipment are specifically not recommended without additional processing by austriamicrosystems AG for each application. The information furnished here by austriamicrosystems AG is believed to be correct and accurate. However, austriamicrosystems AG shall not be liable to recipient or any third party for any damages, including but not limited to personal injury, property damage, loss of profits, loss of use, interruption of business or indirect, special, incidental or consequential damages, of any kind, in connection with or arising out of the furnishing, performance or use of the technical data herein. No obligation or liability to recipient or any third party shall arise or flow out of austriamicrosystems AG rendering of technical or other services. Contact Information ca Headquarters austriamicrosystems AG A-8141 Schloss Premstaetten, Austria Tel: +43 (0) 3136 500 0 Fax: +43 (0) 3136 525 01 Te ch ni For Sales Offices, Distributors and Representatives, please visit: http://www.austriamicrosystems.com Revision 1.0, October 2009 Page 10 of 10 www.austriamicrosystems.com