Eval Kit Manual DN[Document ID] AS5048 Adapter Board AS5048-EK-AB ams Eval Kit Manual, Confidential [v1-3] 2014-Aug-01 Page 1 Document Feedback AS5048 Adapter Board Table of Contents 1 Introduction .......................................................................................................................... 3 1.1 Kit Content ........................................................................................................................... 3 2 Board Description................................................................................................................. 4 2.1 Mounting the AS5048 adapter board ................................................................................... 5 3 AS5048 adapter board and pinout ....................................................................................... 6 4 Operation cases ................................................................................................................... 7 4.1 One Device SPI mode, unidirectional – 3 wire .................................................................... 7 4.2 One device SPI mode, bidirectional – 4 wire ....................................................................... 8 4.3 Multi devices SPI Daisy chain mode .................................................................................... 9 5 Software example source code .......................................................................................... 10 6 AS5048-EK-AB Hardware .................................................................................................. 12 6.1 AS5048-EK-AB schematics ............................................................................................... 12 6.2 AS5048-EK-AB PCB layout ............................................................................................... 13 7 Ordering & Contact Information ......................................................................................... 14 8 Copyrights & Disclaimer ..................................................................................................... 15 Revision History Revision Date Owner Description 1.0 01.10.2009 1.1 18.10.2013 azen Updated to new template 1.2 14.01.2013 rph Minor corrections in section 4.1 1.3 01.07.2014 mzie Updated ordering code, added section 1.1, updated figure 2-9, updated source code Initial version ams Eval Kit Manual, Confidential [v1-3] 2014-Aug-01 Page 2 Document Feedback AS5048 Adapter Board 1 Introduction The AS5048 adapter board is a small PCB allowing simple and quick testing or evaluation of the AS5048 magnetic position sensor without the need to build a test fixture or design an own PCB. 1.1 Kit Content Figure 1: Kit Content 1 2 Pos. Item Comment 1 AS5048 adapter board P1 unpopulated 2 Magnet AS5000-MD6H-2 Diametric Magnet, D6x2.5mm, NdFeB, Bomatec AG ams Eval Kit Manual, Confidential [v1-3] 2014-Aug-01 Page 3 Document Feedback AS5048 Adapter Board 2 Board Description The PCB can either be connected to an external microcontroller or to the Universal Connector Board (AS5xxx-UCB) in combination with a NI USB-8451 box and a provided LabVIEW software. P1 has to be populated with a 1x8 pin header and is required for power supply as well as SPI/I2C and PWM interfaces. The PCB is available in two versions. Either populated with an AS5048A with SPI or AS5048B with I2C interface. Figure 2: AS5048 adapter board P1 connector (Not populated) 4x2.6mm Mounting holes AS5048 ams Eval Kit Manual, Confidential [v1-3] 2014-Aug-01 Page 4 Document Feedback AS5048 Adapter Board 2.1 Mounting the AS5048 adapter board Figure 3: Mounting and dimensions 0.5-3mm AS5048 GND A2/MISO A1/MOSI SCL/SCK PWM 3.3V SDA/CSn 4x2.6mm AS5048 11mm 28mm 5V 22mm A 6x2.5mm diametric magnet must be placed over or under the AS5048 sensor, and should be centered on the middle of the package with a tolerance of 0.5mm. The airgap between the magnet surface and the package should be maintained in the range 0.5mm to 3mm. The magnet holder must not be ferromagnetic. Materials as brass, copper, aluminum, stainless steel are the best choices to make this part. ams Eval Kit Manual, Confidential [v1-3] 2014-Aug-01 Page 5 Document Feedback AS5048 Adapter Board 3 AS5048 adapter board and pinout AS5048 SDA/CSn 1 14 PWM SCL/CLK 2 13 GND A2/MISO 3 12 VDD3V A1/MOSI 4 11 VDD5V TEST 5 10 TEST TEST 6 9 TEST TEST 7 8 TEST AS5048 GND A1/MOSI A2/MISO SCL/SCK SDA/CSn PWM 3.3V 5V Figure 4: AS5048 adapter board connectors and encoder pinout Pin# Board Pin# AS5048 Symbol Board P1 – 1 11 5V P1 – 2 12 3.3V 3V-Regulator output; internally regulated from VDD. Connect to VDD for 3V supply voltage P1 – 3 14 PWM Pulse width modulation output P1 – 4 1 SDA/CSn SPI chip select-active low; shared with I2C data pin P1 – 5 2 SCL/SCK SPI clock input; shared with I2C clock input P1 – 6 4 A1/MOSI SPI master out/slave in; shared with I2C address selection pin 1 3 A2/MISO SPI master in/slave out; shared with I2C address selection pin 2 13 GND P1 – 7 P1 – 8 ams Eval Kit Manual, Confidential [v1-3] 2014-Aug-01 Description Supply voltage Supply ground Page 6 Document Feedback AS5048 Adapter Board 4 Operation cases The most complete and accurate solution for a MCU to read the angle of a magnet is the SPI interface. 4.1 One Device SPI mode, unidirectional – 3 wire The AS5048-EK-AB can be directly connected to an industry standard SPI port of a microcontroller. The minimum connection requirement for unidirectional communication (angle + alarm values reading) between the microcontroller and the AS5048 are MISO, SCK, SS/. The angle will be read at each 16-bit SPI transfer. See AS5048 datasheet register table, register 3FFFh. Figure 5: Using the SPI Interface unidirectional with a microcontroller SS/ SCK MOSI MISO SCL/SCK A1/MOSI A2/MISO GND 3.3V SDA/CSn VDD 3-3.6V GND GND PWM Regulated Power Supply 5V MCU AS5048 ams Eval Kit Manual, Confidential [v1-3] 2014-Aug-01 Page 7 Document Feedback AS5048 Adapter Board 4.2 One device SPI mode, bidirectional – 4 wire If other registers than only angle values have to be read, or in order to write registers into the AS5048, the signal MOSI is necessary. Figure 6: Using the SPI Interface biidirectional with a microcontroller SS/ SCK MOSI MISO SCL/SCK A1/MOSI A2/MISO GND 3.3V SDA/CSn VDD 3-3.6V GND GND PWM Regulated Power Supply 5V MCU AS5048 ams Eval Kit Manual, Confidential [v1-3] 2014-Aug-01 Page 8 Document Feedback AS5048 Adapter Board 4.3 Multi devices SPI Daisy chain mode The AS5048 can be daisy chained, using 4 wires only for SPI communication. In this configuration with n x encoders, the sequence will be processed as follow: - MCU sets SS/ = 0 - MCU shifts n x 16-bit (e.g. READ command FFFFh) through the chain - MCU sets SS/=1 At that point all the n x encoders have received the READ command FFFFh. - MCU sets SS/=0 - MCU shifts n x 16-bit (e.g. NOP command 0000h) - MCU sets SS/=1 At that point the n x 16-bit received on MISO are the n x angle values. Figure 7: Multi Devices in Daisy chain mode SCK MOSI MISO SCL/SCK A1/MOSI A2/MISO SS/ GND SDA/CSn VDD 5V 3-3.6V AS5048 ams Eval Kit Manual, Confidential [v1-3] 2014-Aug-01 GND A2/MISO A1/MOSI SCL/SCK PWM SDA/CSn 3.3V 5V GND GND PWM Regulated Power Supply 3.3V MCU AS5048 Page 9 Document Feedback AS5048 Adapter Board 5 Software example source code The following source code shows a 4-wire SPI application case. /*! ***************************************************************************** * \brief Reads out chip data via SPI interface * * This function is used to read out cordic value from chips supporting SPI * interface. * After calling this function the data can be displayed using #displayData. * * \param[in] die : index of the die to read out. * \param[out] dd : Buffer of type #t_displayData where the read out data * will be written to. * ***************************************************************************** */ static void spiReadData(u8 die, t_displayData * dd) { umword i; u16 dat; u16 agcreg; #ifdef AS5048_CHIPDESCRIPTION u16 magreg; #endif PARAMETER_UNUSED(die); dd->angleprec = 0; /* read agc value */ for (i = 0; i < 2; i++) { /* the result is available only just in the second transfer. transfers must be separated by chip selects */ dat = SPI_CMD_READ | SPI_REG_AGC; dat |= spiCalcEvenParity(dat); spiTransfer((u8*)&dat, sizeof(u16)); } agcreg = dat; #ifdef AS5048_CHIPDESCRIPTION for (i = 0; i < 2; i++) { /* the result is available only just in the second transfer. transfers must be separated by chip selects */ dat = SPI_CMD_READ | SPI_REG_MAG; ams Eval Kit Manual, Confidential [v1-3] 2014-Aug-01 Page 10 Document Feedback AS5048 Adapter Board dat |= spiCalcEvenParity(dat) << 15; spiTransfer((u8*)&dat, sizeof(u16)); } magreg = dat; #endif for (i = 0; i < 2; i++) { /* the result is available only just in the second transfer. transfers must be separated by chip selects */ dat = SPI_CMD_READ | SPI_REG_DATA; dat |= spiCalcEvenParity(dat); spiTransfer((u8*)&dat, sizeof(u16)); } #ifdef AS5048_CHIPDESCRIPTION if ((dat & 0x4000) || (agcreg & 0x4000) || (magreg & 0x4000)) #else if (((dat >> 1) & 0x1) || ((agcreg >> 1) & 0x1)) #endif { /* error flag set - need to reset it */ dat = SPI_CMD_READ | SPI_REG_CLRERR; dat |= spiCalcEvenParity(dat); spiTransfer((u8*)&dat, sizeof(u16)); } else { #ifdef AS5048_CHIPDESCRIPTION dd->agc = agcreg & 0xff; dd->value = dat & (currentChipDescription->positions - 31 - 1); dd->angle = (dd->value * 360) / currentChipDescription->positions; dd->magnitude = magreg & (currentChipDescription->positions - 31 - 1); dd->alarmLo = (agcreg >> 10) & 0x1; dd->alarmHi = (agcreg >> 11) & 0x1; #else dd->agc = (agcreg >> 2) & 0x3F; dd->value = (dat >> 2) & (currentChipDescription->positions - 1); dd->angle = (dd->value * 360) / currentChipDescription->positions; dd->alarmLo = (dat >> 14) & 0x1; dd->alarmHi = (dat >> 15) & 0x1; #endif } } ams Eval Kit Manual, Confidential [v1-3] 2014-Aug-01 Page 11 Document Feedback AS5048 Adapter Board 6 6.1 AS5048-EK-AB Hardware AS5048-EK-AB schematics Figure 8: AS5048-EK-AB schematics ams Eval Kit Manual, Confidential [v1-3] 2014-Aug-01 Page 12 Document Feedback AS5048 Adapter Board 6.2 AS5048-EK-AB PCB layout Figure 9: AS5048-EK-AB PCB layout ams Eval Kit Manual, Confidential [v1-3] 2014-Aug-01 Page 13 Document Feedback AS5048 Adapter Board 7 Ordering & Contact Information Ordering Code Description AS5048-EK-AB AS5048 Eval Kit Adapter Board Buy our products or get free samples online at: www.ams.com/ICdirect Technical Support is available at: www.ams.com/Technical-Support Provide feedback about this document at: www.ams.com/Document-Feedback For further information and requests, e-mail us at: [email protected] For sales offices, distributors and representatives, please visit: www.ams.com/contact Headquarters ams AG Tobelbaderstrasse 30 8141 Unterpremstaetten Austria, Europe Tel: +43 (0) 3136 500 0 Website: www.ams.com ams Eval Kit Manual, Confidential [v1-3] 2014-Aug-01 Page 14 Document Feedback AS5048 Adapter Board 8 Copyrights & Disclaimer Copyright ams AG, Tobelbader Strasse 30, 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. Demo Kits, Evaluation Kits and Reference Designs are provided to recipient on an “as is” basis for demonstration and evaluation purposes only and are not considered to be finished end-products intended and fit for general consumer use, commercial applications and applications with special requirements such as but not limited to medical equipment or automotive applications. Demo Kits, Evaluation Kits and Reference Designs have not been tested for compliance with electromagnetic compatibility (EMC) standards and directives, unless otherwise specified. Demo Kits, Evaluation Kits and Reference Designs shall be used by qualified personnel only. ams AG reserves the right to change functionality and price of Demo Kits, Evaluation Kits and Reference Designs at any time and without notice. Any express or implied warranties, including, but not limited to the implied warranties of merchantability and fitness for a particular purpose are disclaimed. Any claims and demands and any direct, indirect, incidental, special, exemplary or consequential damages arising from the inadequacy of the provided Demo Kits, Evaluation Kits and Reference Designs or incurred losses of any kind (e.g. loss of use, data or profits or business interruption however caused) as a consequence of their use are excluded. ams 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 ams AG rendering of technical or other services. ams Eval Kit Manual, Confidential [v1-3] 2014-Aug-01 Page 15 Document Feedback