MLX90393 Get Started Guide Datasheet by Melexis Technologies NV

View All Related Products | Download PDF Datasheet
M LX90393 Datasheet Warnings and cautions are shown in this format Vmuo
MLX90393 Getting Started Guide
Rev 004 Page 1 of 23 Jun-15
Abstract
This guide was written with the goal of describing the basic setup and
troubleshooting steps required for integrating the MLX90393 Triaxis device
in an application. A simple rotary sensing application is used as an example.
Applicable Applications
All rotary, linear, and joystick applications using the MLX90393.
Recommended Tools and Resources
MLX90393 Datasheet
Oscilloscope or I2C->PC adaptor with I2C decoding
MLX90393 EVB (evaluation board) and MBED LPC1768 board
Convention, Acronyms, and
Abbreviations
Number Format and Text
Values in hexadecimal are shown with a preceding “0x”. For
example: 0x12 is decimal 18.
Binary values are shown with a preceding “0b”. For example:
0b10010 is decimal 18.
Textual descriptions are shown in this format
Code examples are shown in this format
Warnings and cautions are shown in this format
Acronyms
SDA = Serial Data Line
MSb = Most Significant Bit
SCK = Serial Clock Line
LSb = Least Significant Bit
VDD = Analog Supply
MSB = Most Significant Byte
VDD_IO = Digital Supply
LSB = Least Significant Byte
MLX90393 Getting Started Guide
Rev 004 Page 2 of 23 Jun-15
Table of Contents
Abstract.............................................................................................................................................................................. 1
Applicable Applications...................................................................................................................................................... 1
Recommended Tools and Resources ................................................................................................................................. 1
Convention, Acronyms, and Abbreviations ....................................................................................................................... 1
Number Format and Text .............................................................................................................................................. 1
Acronyms ....................................................................................................................................................................... 1
Table of Contents ............................................................................................................................................................... 2
Pinout................................................................................................................................................................................. 4
Axis Definition .................................................................................................................................................................... 5
Practical getting started ..................................................................................................................................................... 6
Practical getting started guide ...................................................................................................................................... 7
MLX90393 interface library for mbed ........................................................................................................................... 7
CherryStone soft-and firmware releases & compatibility ............................................................................................. 8
Communication ................................................................................................................................................................. 9
I2C Protocol .................................................................................................................................................................... 9
SPI Protocol ................................................................................................................................................................. 10
Memory Model ................................................................................................................................................................ 11
HALLCONF ................................................................................................................................................................... 11
GAIN_SEL ..................................................................................................................................................................... 11
Z_SERIES ...................................................................................................................................................................... 11
BURST_DATA_RATE ..................................................................................................................................................... 11
BURST_SEL ................................................................................................................................................................... 12
TCMP_EN ..................................................................................................................................................................... 12
EXT_TRIG ..................................................................................................................................................................... 12
WOC_DIFF ................................................................................................................................................................... 12
COMM_MODE ............................................................................................................................................................. 12
TRIG_INT_SEL .............................................................................................................................................................. 12
OSR .............................................................................................................................................................................. 12
DIG_FILT ...................................................................................................................................................................... 12
RES_XYZ ....................................................................................................................................................................... 12
OSR2 ............................................................................................................................................................................ 13
SENS_TC_LT & SENS_TC_HT ........................................................................................................................................ 13
OFFSET_X, OFFSET_Y & OFFSET_Z ............................................................................................................................... 13
WOXY_THRESHOLD, WOZ_THRESHOLD & WOT_THRESHOLD.................................................................................... 13
Address 10-31 .............................................................................................................................................................. 13
Key Commands ................................................................................................................................................................ 14
MLX90393 Getting Started Guide
Rev 004 Page 3 of 23 Jun-15
CONTROL COMMANDS ................................................................................................................................................ 14
Exit (EX)........................................................................................................................................................................ 14
Reset (RT) .................................................................................................................................................................... 15
MEMORY COMMANDS ................................................................................................................................................ 15
Memory Store (HS) ...................................................................................................................................................... 15
Memory Recall (HR)..................................................................................................................................................... 15
Read Register (RR) ....................................................................................................................................................... 15
Write Register (WR) ..................................................................................................................................................... 15
MEASUREMENT COMMANDS ..................................................................................................................................... 15
Start Burst Mode (SB) .................................................................................................................................................. 15
Single Measurement (SM) ........................................................................................................................................... 16
Read Measurement (RM) ............................................................................................................................................ 16
Start Wake-up on Change (SWOC) .............................................................................................................................. 16
Application specific .......................................................................................................................................................... 17
Resolution.................................................................................................................................................................... 17
Calculation of conversion time .................................................................................................................................... 17
Sensitivity ......................................................................................................................................................................... 18
Available hardware (EVB) ............................................................................................................................................ 19
Example #1: Rotary Application ....................................................................................................................................... 20
Magnetic Configuration ............................................................................................................................................... 20
Suggested EEPROM Configuration .............................................................................................................................. 20
Rotary Code Example .................................................................................................................................................. 21
MLX90393 Getting Started Guide
Rev 004 Page 4 of 23 Jun-15
Pinout
The pinout for the MLX90393 is below.
MLX90393
VSS
VDD
VDDIO
INT/
TRG
MISO
SDA/
MOSI
A0
A1
NC
NC
INT
SCLK
CS
NC
NC
NC
PIN 1
Figure 1: Pinout
Pin Number
Pin Name
Pin Function
1
INT
Data ready signal output pin, active high (DRDY flag)
2
CS
Chip select, used when communicating in SPI mode
Pull high when in I2C mode
3
SCLK
Serial clock for both SPI and I2C mode
4, 9, 10, 14, 16
NC
-
5
SDA/MOSI
Data input pin in SPI mode, data input/output pin in I2C mode
6
MISO
Data output pin in SPI mode
7
INT/TRIG
Trigger pin, can be used to start measurement
8
VDDIO
Power supply for digital
11
A1
Bit 1 of the 7-bit I2C address (0 0 0 1 1 A1 A0)
12
A0
Bit 0 of the 7-bit I2C address (0 0 0 1 1 A1 A0)
13
VSS
Ground
15
Vdd
Power supply
MLX90393 Getting Started Guide
Rev 004 Page 5 of 23 Jun-15
Axis Definition
The axes of the MLX90393 are defined in the datasheet and are shown below.
Figure 2: MLX90393 QFN Axis Definitions
here http: www.mcom download |abwew»mn»time-engine-ZOIZ 3433 en here http: www.m.com download ni-Visa-run-time-enzine-Sflj 2257 en here httu: deve‘oner.mbed.orz media downloads drivers mbedWinSerial 16466.exe here mbed www.mbedgrglteamslmelexis LPC1768
MLX90393 Getting Started Guide
Rev 004 Page 7 of 23 Jun-15
Practical getting started guide
1. NI LabView Runtime Engine
A first step before installing the CherryStone executable is installing LabVIEW Run-Time Engine 12.0. This software
can be downloaded directly from National Instruments website.
32-bit version: Click here
http://www.ni.com/download/labview-run-time-engine-2012/3433/en/
2. NI VISA-driver
Visa Driver: Click here
http://www.ni.com/download/ni-visa-run-time-engine-5.0.3/2257/en
3. MBED driver
Make sure your mbed is connected while executing this step
Mbed Driver: Click here
http://developer.mbed.org/media/downloads/drivers/mbedWinSerial_16466.exe
4. CherryStone Software Executable
CherryStone (= the interface program, refer to diagram shown earlier in this document): Click here
5. MBED firmware
MBED SPI firmware: Click here
MBED I2C firmware: Click here
Upload the firmware to mbed:
· Connect your mbed to your PC/laptop - a new drive called “MBED” should appear.
· Download the firmware from the Melexis website (either SPI, or I2C) and drag and drop the file directly into
the drive”.
· Once the bin-file is uploaded, the mbed must be reset by pressing the push button at the center of the
mbed.
MLX90393 interface library for mbed
Sample code and a complete library holding all MLX90393’s functions are written for mbed and can be downloaded
from www.mbed.org/teams/melexis or directly from our website
The MBED used at Melexis is the LPC1768. Please note that the firmware BIN files made available have been
compiled for this specific MBED hardware. When using other MBED devices, or other microcontrollers in general, the
source code is recommended as a starting point for software development.
MLX90393 Getting Started Guide
Rev 004 Page 8 of 23 Jun-15
CherryStone soft-and firmware releases & compatibility
Date
CherryStone.exe
CherryStone.bin
January 2015
CherryStone 3
CherryStone3_I2C(SDA = p9, SCL = p10, A1=p21, A0=p22).bin
CherryStone3_SPI(MOSI =p5, MISO = p6, CLK= p7, CS=p8).bin
MLX90393 Getting Started Guide
Rev 004 Page 9 of 23 Jun-15
Communication
The MLX90393 can be used with either an SPI or an I2C bus. The use of both protocols will be explained in the next
sections. This user guide gives a brief introduction to our user interface tool for quick ‘plug and play’ solutions that
enables you to communicate with the MLX90393 without having to make the effort of implementing the
communication protocol yourself.
I2C Protocol
One initial hurdle with starting work with the MLX90393 is configuring the I2C bus correctly. The clock frequency can
be set between 10kHz (low-speed mode), 100kHz(standard mode), 400kHz (Fast mode). Every I2C device on the bus
must also be assigned an address. The two LSB’s of the MLX90393 I2C address can be selected via the A0 and A1 pins
allowing for four different addresses. In this document it is assumed that the A0 and A1 pins are shorted to ground.
This results in an I2C address of 0x19 (for MBED, in other environments this might be defined in another way).
The7 bit I2C address in MBED is defined as follows as a byte:
0 0 0 1 1 A1 A0 1
Defined by Melexis
R/W bit set
7 bit I2C address
Defined by connecting pins
A0 and A1 to GND/ VDD
Figure 3: MBED I2C address definition
The orange section is set in the NVRAM of the IC, the yellow section depends on how pins A0 and A1 are connected.
The last bit should be set for the MBED, no matter if one reads or write to the IC. The MBED will send on the bus the
correct R/W bit automatically.
The MLX90393 operates on a command / response configuration and can be broken down into two sequences:
Command Write and Response Read.
Command Write:
To initiate a communication sequence the master addresses the slave with the write bit set. If the MLX90393
recognizes the address it responds with an ACK. The master then issues the command to the MLX90393. If accepted,
the MLX90393 responds with another ACK.
I2C_ADDR[6:0] W ACK
S
COMMAND[7:0] ACK
SCL
SDA
123456789 123456789
Figure 4: Sending an I2C command
Response Read:
To read back the response the master addresses the MLX90393 with the R bit set. The master then sends enough
clock pulses to clock out all the required data bytes. The number of data bytes depends on the command transmitted
Nate: Failure to readdress the s‘ave after the Command Wrwte wwH result in the transaction failing.
MLX90393 Getting Started Guide
Rev 004 Page 10 of 23 Jun-15
and can range from zero (eg: NOP message) to eight (eg: measurement with all axes, temp, and a status byte). The
number of data bytes is indicated in the status byte which is always the first byte read out from the MLX90393.
I2C_ADDR[6:0] R ACK
Sr
STATUS_BYTE[7:0] ACK
SCL
SDA
123456789
P
123456789
Figure 5: I2C readback of status byte
Note: Failure to readdress the slave after the Command Write will result in the transaction failing.
SPI Protocol
One initial hurdle with starting work with the MLX90393 is configuring the SPI bus correctly. The chip can handle
clock frequencies up to 10MHz. The SPI communication is implemented in a half-duplex way, showing high
similarities with the I2C communication. Addressing on the bus is done through the \CS instead of physical addresses.
Both three- and four-wire SPI is possible (three wire by shorting the MISO and MOSI). SPI mode 3 is implemented:
CPHA=1 (data changed on leading edge and captured on trailing edge, and CPOL=1 (high level is inactive state). The
Chip Select line is active-low.
The MLX90393 operates on a command / response configuration and both are sequentially done in one go in SPI.
The communication is also bundled in bytes, equally MSB first and MSByte first. A command can of course consist of
more than 1 byte as can the response be from the MLX90393 in the form of multiple bytes after the status byte.
Figure 6 shows an example of an SPI command being followed by the readback of the status byte.
COMMAND[7:0]
SCL
MOSI
12345678 12345678
MISO
/CS
STATUS_BYTE[7:0]
X (4-wire SPI) or Z (3-wire SPI)
Z (3 & 4-wire SPI)
ADD NADD
Figure 6: SPI example
MLX90393 Getting Started Guide
Rev 004 Page 11 of 23 Jun-15
Memory Model
As the code example will be modifying the register contents it is useful to review the memory model of the
MLX90393. It operates with a dual memory model consisting of volatile and nonvolatile areas. During operating
conditions the values in the volatile memory are used and are loaded from nonvolatile memory at power up or when
a recall command is issued. It is necessary to know that if the write register command is issued this affects the
volatile memory only. A store command is needed to permanently store the modifications. Refer to the datasheet for
more details. The first 32 addresses are programmable by the user.
CUSTOMER AREA CUSTOMER AREA
MELEXIS AREA MELEXIS AREA
VOLATILE
MEMORY NON-VOLATILE
MEMORY
STORE (HS)
RECALL (HR)
RR WR
Figure 7: Memory model
Figure 8: Memory map of customer area
HALLCONF
Spinning and chopping rate adjustment.
HALLCONF[3:2] defines the duration of one Hall plate spinning phase in clock cycles: #clocks/spinning_phase = 8 *
2HALLCONF[3:2]. Default this value is 3.
HALLCONF[1:0] defines the number of amplifier chopping periods inside one spinning phase:
#chopping_periods/spinning_phase = 2HALLCONF[1:0]. Default this value is 0.
The default HALLCONF is 0xC.
GAIN_SEL
Selection of the gain, adjustable from 0 to 7. See sensitivity table for sensitivity of the IC in LSB/G for each setting of
the gain and the resolution.
Z_SERIES
Connection of the Hall plates for Z-axis measurements. Recommended setting: 0x0.
BURST_DATA_RATE
This parameter controls the data rate in burst mode and in WOC mode. The rate is defined as the time between the
end of one measurement and the start of a new measurement, regardless of the fact if the data is read out or not. A
15 14 13 12 11 10 9876543210
0 Z_SERIES
1 TRIG_INT_SEL WOC_DIFF EXT_TRIG TCMP_EN
2
3
4
5
6
7
8
9
OFFSET_X
OFFSET_Y
OFFSET_Z
WOXY_THRESHOLD
WOZ_THRESHOLD
WOT_THRESHOLD
RESERVED
OSR2
OSR
DIG_FILT
RES_XYZ
SENS_TC_HT
SENS_TC_LT
RESERVED_LOW
GAIN_SEL
HALLCONF
COMM_MODE
BURST_SEL
BURST_DATA_RATE
Note: The chip will not work properly with the following combinations: osa:o and DIG FILT:0 OSR:0 and DIG FlLT:1arid 05R:1and DlG FILT:0 Note: The chip will not work properly with the following combinations: osa:o and DIG FILT:0 OSR:0 and DIG FlLT:1arid 05R:1and DlG FILT:0
MLX90393 Getting Started Guide
Rev 004 Page 12 of 23 Jun-15
value of 0x0 means a continuous burst mode, other value encode as follows: interval = 20ms * BURST_DATA_RATE.
The max is 0x3F, corresponding to 1260ms. This interval can be observed by looking at the DRDY flag.
BURST_SEL
This parameter determines the measurements (X, Y, Z and Temp, or any combination of them) to be performed in the
case that the SB or SWOC command did not specify the measurements. The bit order is (from MSB to LSB): ZYXT.
TCMP_EN
Enables the temperature compensation. Please refer to the application note on the temperature compensation for
more info.
EXT_TRIG
When this bit is set, the external pin INT/TRIG can be used to start a measurement. This only works when
TRIG_INT_SEL is not set (digital input). Otherwise, changes at this pin will be ignored. The axes to be measured are
specified by BURST_SEL.
WOC_DIFF
Absolute or derivative WOC mode:
If 0, an absolute mode is used. Measurements are compared to the first measurements;
If 1, a relative mode is used. Measurements are compared to the previous ones.
COMM_MODE
Defines the communication mode. If it is 0x0 or 0x1, the IC can be used both by I2C and SPI. If 0x2, only SPI can be
used and if 0x3 only I2C can be used.
TRIG_INT_SEL
Selects the function of the INT/TRIG pin. When set, the pin is used as digital output, otherwise it is an input.
OSR
Defines the oversampling rate of the ADC decimation filter for magnetic measurements. OSR_ADC = 64 * 2OSR. This
will directly impact the measurement time for magnetic measurements.
Note: The chip will not work properly with the following combinations: OSR=0 and DIG_FILT=0, OSR=0 and
DIG_FILT=1 and OSR=1 and DIG_FILT=0
DIG_FILT
A control for the digital filter. An averaging over a certain amount (2DIG_FILT) will be done. This will directly impact the
measurement time for magnetic measurements.
Note: The chip will not work properly with the following combinations: OSR=0 and DIG_FILT=0, OSR=0 and
DIG_FILT=1 and OSR=1 and DIG_FILT=0
RES_XYZ
This 6 bit parameter consists out of three parts, one for each axis. The two MSBs act on the Z-axis, the 2 LSBs on the
X-axis and the middle 2 bits on the Y-axis. Internally each magnetic measurement is 19 bits long. On the output, only
16 bits can be read out. This parameter selects for each axis which 16 bits to read out. Please refer to section Error!
eference source not found. for further detailed information.
MLX90393 Getting Started Guide
Rev 004 Page 13 of 23 Jun-15
OSR2
Defines the oversampling rate of the ADC decimation filter for a temperature measurement. OSR_ADC = 64 * 2OSR.
This will directly impact the measurement time for the temperature measurement.
SENS_TC_LT & SENS_TC_HT
These parameters are used for the temperature compensation for the sensitivity drift of the Hall elements.
SENS_TC_HT is the parameter for temperatures above 35 degC, SENS_TC_LT is the parameter for temperatures
below 35 degC. Please refer to the application note on the temperature compensation for more info. These values
can be blindly programmed to the values given in this document (if not already programmed).
OFFSET_X, OFFSET_Y & OFFSET_Z
These parameters are used to compensate the offset in case the temperature compensation is enabled. They are not
used with TCMP disabled. Please refer to the application note on the temperature compensation for more info. These
values can be blindly programmed to the values given in this document (if not already programmed).
WOXY_THRESHOLD, WOZ_THRESHOLD & WOT_THRESHOLD
Defines the wake up thresholds on X, Y, Z axis or on temperature. The resolution of the temperature sensor is
45.2LSB/K.
Address 10-31
Address 10 to 31 are free to use by the customer. For example traceability information could be stored in here.
MLX90393 Getting Started Guide
Rev 004 Page 14 of 23 Jun-15
Key Commands
Table 1 shows an overview of all commands possible with the MLX90393. The amount of bytes to be sent and read
back is different for each command. In case more bytes are needed, first byte #1 is sent, then byte #2 and so on.
Table 1: Commands overview
Command
Symbol
CMD byte #1
CMD byte #2
CMD byte #3
CMD byte #4
# bytes to read back
EXit
EX
1000 0000
-
-
-
1 (status)
Start Burst mode
SB
0001 zyxt
-
-
-
1 (status)
Start Wake-up On
Change
SWOC
0010 zyxt
-
-
-
1 (status)
Start Measurement
(polling mode)
SM
0011 zyxt
-
-
-
1 (status)
Read Measurement
RM
0100 zyxt
-
-
-
1 (status) + 2*[z+x+y+t]
(data)
Read from a Register
RR
0101 0000
A[5:0] << 2
-
-
1 (status) + 2 (data)
Write from a Register
WR
0110 0000
D[15:8]
D[7:0]
A[5:0] << 2
1 (status)
Reset
RT
1111 0000
-
-
-
1 (status)
Memory Recall
HR
1101 0000
-
-
-
1 (status)
Memory Store
HS
1110 0000
-
-
-
1 (status)
No OPeration
NOP
0000 0000
-
-
-
1 (status)
All commands will return a status byte showing the current state the IC is in. The 8 bits out of which the status byte
consists are explained below:
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Burst_mode
WOC_mode
SM_mode
ERROR
SED
RS
D1
D0
Figure 9: Status byte
Burst_mode: if set, the IC is working in burst mode.
WOC_mode: if set, the IC is in wake-up-on-change mode
SM_mode: if set, the IC is executing a measurement sequence in polling mode. It can be initiated by a SM
command or a pulse on the TRIG input
ERROR: indicates an error. Can be set when reading out a measurement while the measurement is not yet
completed or when reading out the same measurement twice.
SED: indicates that a single bit error has been corrected by the NVRAM
RS: indicates that the device has been reset successfully by a reset command.
D1-D0: indicates the number of bytes (2D[1:0]) to follow the status byte after a read measurement or a read
register command has been sent.
CONTROL COMMANDS
Exit (EX)
The exit command is used to force the IC into idle mode. The command will be used to exit the burst mode and the
wake-up-on-change mode. During a single measurement in polling mode, the command is rejected. The status byte
will then show an error and indicate that the IC is in polling mode (SM_mode).
Warning: To reliably store the register it is required to suppiy the K: with 3.3V1VDD) Warning: The WR command modifies volatile memory and changes wiil be lost upon a power cycie. If the modified vaiues are reuuired to be DErmanEnl then a memorv store (H5) command must be issued after modifvinz the desired registers.
MLX90393 Getting Started Guide
Rev 004 Page 15 of 23 Jun-15
Reset (RT)
This command is used to reset the IC. On reset, the idle mode will be entered again. The status byte will reflect that
the reset has been successful.
MEMORY COMMANDS
Memory Store (HS)
If the HS command is used, the content from the volatile RAM is overwritten in the non-volatile RAM. On the next
reset, this content will be loaded into the volatile RAM.
Warning: To reliably store the register it is required to supply the IC with 3.3V (VDD)
Memory Recall (HR)
If the HR command is used, the content from the non-volatile RAM is overwritten in the volatile RAM. The same is
automatically done at start-up.
Read Register (RR)
The RR command is used to read out the content of one specific address of the volatile RAM. The address ranges
from 0 to 63. Remind that the last 32 addresses are MLX area which cannot be changed by the user. They are read-
only. Note that in the command, the address will be sent as if it is multiplied by 4 (shifted two bits).
Write Register (WR)
The WR command is used to write directly in the volatile RAM. The address ranges from 0 to 63. Remind that the last
32 addresses are MLX area which cannot be changed by the user. They are read-only. Note that in the command, the
address will be sent as if it is multiplied by 4 (shifted two bits). Always full words will be written. Words 0x00 to 0x09
are used to store operating parameters. Words 0x0A to 0x1F are free and usable to store any other data.
Warning: The WR command modifies volatile memory and changes will be lost upon a power cycle. If the modified
values are required to be permanent then a memory store (HS) command must be issued after modifying the
desired registers.
MEASUREMENT COMMANDS
These commands are used for doing measurements or are related to measurement based behavior. In all these
commands, the first byte consists out of 4 bits that determine the command and 4 bits (4 LSBs) stating the stuff to be
measured. In Table 1, these 4 LSBs are called z, y, x and t. By setting the correct bits, one can choose what
information needs to be measured or read back. z, y and x stand for the magnetic fields in 3D, t is temperature.
Disabling certain measurements will end up in a shorted measuring time.
Start Burst Mode (SB)
To start the burst measuring mode, this command will be used. It consists of a single byte with four user-defined bits:
z, y, x, and t. These four bits determine which axes will be converted whenever they are set to a 1. Setting an axis to 0
results in the MLX90393 not performing a conversion on that axis and therefore yields a faster conversion cycle and
reduced current consumption. When zyxt = 0x0, the SB command will enable the measurements specified by the
NVRAM parameter BURST_SEL. The command will only be accepted in case the IC is not operating in another mode
(WOC or SM mode). If this is the case, the error flag is raised in the status byte. In case the command is received
successfully, the Burst_mode flag of the status byte will be set. After the measurement is complete, the DRDY flag is
set (INT pin high). On the start of a new measurement, the DRDY flag is set low again, even if the previous
measurement has not been read out.
MLX90393 Getting Started Guide
Rev 004 Page 16 of 23 Jun-15
Single Measurement (SM)
The single measurement command is used to instruct the MLX90393 to perform an acquisition cycle. It consists of a
single byte with four user-defined bits: z, y, x, and t. These four bits determine which axes will be converted
whenever they are set to a 1. Setting an axis to 0 results in the MLX90393 not performing a conversion on that axis
and therefore yields a faster conversion cycle and reduced current consumption. When zyxt = 0x0, the SM command
will enable the measurements specified by the NVRAM parameter BURST_SEL (like with SB command). The command
will only be accepted in case the IC is not operating in another mode (WOC or burst mode). If this is the case, the
error flag is raised in the status byte. In case the command is received successfully, the SM_mode flag of the status
byte will be set. The next command following this command usually is RM. After the measurement is complete, the
DRDY flag is set (INT pin high).
Read Measurement (RM)
The Read Measurement command is used to retrieve the data previously acquired by the SM or SB command. Similar
to these commands, the RM command can also select which data is transmitted. Typically the value for z, y, x, and t
will be the same as the SM command preceding the RM command.
The status byte received from the MLX90393 will indicate the number of data bytes waiting to be read out. In the
case where all axes and temp are converted the number of bytes will be 8. The data is output in the following order:
T (MSB), T (LSB), X (MSB), X (LSB), Y (MSB), Y (LSB), Z (MSB), Z (LSB)
If an axis wasn’t selected to be read or converted then that value will be skipped in the transmission.
Start Wake-up on Change (SWOC)
If this command is sent, the WOC mode is entered. The IC will raise the DRDY flag (INT pin) when the thresholds are
crossed specified by WOXY_THRESHOLD, WOZ_THRESHOLD and WOT_THRESHOLD. Both a differential mode and
absolute mode is available (WOC_DIFF). For the differential mode, each change equal to the threshold after a RM
command will be flagged. The x, y, z and t in the command specify which measurements should be done. When zyxt =
0x0, the SWOC command will enable the measurements specified by the NVRAM parameter BURST_SEL.
The status byte will show the WOC mode has been entered.
MLX90393 Getting Started Guide
Rev 004 Page 17 of 23 Jun-15
Application specific
Resolution
The resolution of the sensor can be changed by parameter RES_XYZ. This 6 bit parameter consists out of three parts,
one for each axis. The two MSBs act on the Z-axis, the 2 LSBs on the X-axis and the middle 2 bits on the Y-axis.
Internally each magnetic measurement is 19 bits long. On the output, only 16 bits can be read out.
By setting the resolution, one can choose which 16 bits to read out as follows (for 0G):
Note that at 0G, the 19 bit value equals 0x20000. This means for resolution 0 and 1, the 16 bit output is centered
around 0 and in 2s complement format. For resolution 2, 0G equals 0x8000 and for resolution 3 0G equals 0x4000.
For 0G + 1LSB19bit this becomes:
For 0G - 1LSB19bit this becomes:
Calculation of conversion time
There are four parameters that determine the conversion time for a specific measurement: OSR, DIG_FILT, OSR2 and
ZYXT. The typical conversion time can be calculated as follows:
CONVTCONVXYZACTIVESTANDBYCONV TmTnTTT
Where
CONVXYZ
T
is the conversion time for 1 magnetic measurement (1 axis),
CONVT
T
the conversion time for the
temperature measurement. Based on ZYXT, the values of n and m can be filled in.
msTT ACTIVESTANDBY 5.0
FILTDIGOSR
CONVXYZ msT_
222063.0
2
218.0 OSR
CONVT msT
In the ‘worst case’, when all parameters are max and ZYXT equals 0b1111, the conversion time typically is 198.5ms.
Over temperature, these values will deviate due to the clock which gets slower at rising temperature.
18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res = 0x3 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res = 0x2 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res = 0x1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res = 0x0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res = 0x3 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
Res = 0x2 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
Res = 0x1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
Res = 0x0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res = 0x3 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Res = 0x2 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Res = 0x1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Res = 0x0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
MLX90393 Getting Started Guide
Rev 004 Page 18 of 23 Jun-15
Sensitivity
The sensitivity is dependent on the selected gain (Gain_sel) and the chosen resolution (RES_X/Y/Z). The typical
sensitivity in µT/LSb for different combination is as followed:
GAIN_SEL
RES = 0
RES = 1
RES = 2
RES = 3
SENSXY
SENSZ
SENSXY
SENSZ
SENSXY
SENSZ
SENSXY
SENSZ
0
0.805
1.468
1.610
2.936
3.220
5.872
6.440
11.744
1
0.644
1.174
1.288
2.349
2.576
4.698
5.152
9.395
2
0.483
0.881
0.966
1.762
1.932
3.523
3.864
7.046
3
0.403
0.734
0.805
1.468
1.610
2.936
3.220
5.872
4
0.322
0.587
0.644
1.174
1.288
2.349
2.576
4.698
5
0.268
0.489
0.537
0.979
1.073
1.957
2.147
3.915
6
0.215
0.391
0.429
0.783
0.859
1.566
1.717
3.132
7
0.161
0.294
0.322
0.587
0.644
1.174
1.288
2.349
The output range depends on the resolution and the saturation level of the IMC. This is given below for both
temperature compensation enabled and disabled. The difference between both is explained in the application note
on temperature compensation.
ABA
TCMP_EN = 0x0
TCMP_EN = 0x1
RANGE
TYPE
RANGE
TYPE
RESi
0
±215
2’s complement
0µT = 0LSB
±215
unsigned
0µT = 215LSB
1
±215
2’s complement
0µT = 0LSB
±215
unsigned
0µT = 215LSB
2
±22000
unsigned
0µT = 215LSB
N/A
3
±11000
unsigned
0µT = 215LSB
CONl
MLX90393 Getting Started Guide
Rev 004 Page 19 of 23 Jun-15
Available hardware (EVB)
A EVB is available for easy access to the MLX90393. A MLX90393 is soldered to the
PCB and extra samples are included in the box. Both SPI and I2C are supported.
Default the PCB is prepared to be used with SPI. Simply connect VDD, VSS, MISO,
MOSI, CS and SCLK to the microcontroller to communicate with the MLX90393
To use I2C, some soldering is needed depending on the address needed:
· Rcs should be shorted (or place 0 Ohm);
· The I2C address should be set to the desired value by shorting the correct R_Ax_x pads. Default 0 Ohm is
placed on R_A0_0 and R_A1_0 which sets the I2C address to 0x19 (Both A0 and A1 are shorted to VSS).
Moving the resistor to R_Ax_1 will connect the pin to the VDD.
· Optionally Rpu1 and Rpu2 are foreseen as a pull up for the SCL and SDA communication lines. Usually this
pull up is on the microcontroller side.
Only 4 wires are needed from the EVB to the microcontroller to work with I2C: VDD, VSS, SDA and SCL.
Also on the PCB is a pad for an optional decoupling capacitor C1 (Between VDD and VSS).
Below the schematic of the EVB can be seen. The orange external components are placed by default.
Dexter 6312007 Dexter 6312002 Nate: Far applications with high performance requirements it is suggested that a magnet supplier be cantacted ta define the best magnet for the agglication.
MLX90393 Getting Started Guide
Rev 004 Page 20 of 23 Jun-15
Example #1: Rotary Application
Rotary applications are among the most common and are also the easiest to implement as they require only two axes
of data and a minimum amount of post processing of the data.
Magnetic Configuration
A diametrically magnetized magnet (similar to the one shown in the above
image) is normally used and recommended. While there is no restriction on size
beyond that needed to fulfill the magnetic field strength requirement (10-50mT)
it is advised to not make the magnet too small in diameter as errors caused by
off-axis assembly errors increase as the magnet diameter shrinks. A general rule
of thumb is that the magnet diameter has to be ten times the maximum off-axis
error to maintain a nonlinearity error of less than 1 degree. The following
magnet configurations have been used with the sensor and yielded good results.
Care should be taken to select a magnet that does not exceed the magnetic field
limits over temperature, lifetime aging, and mechanical tolerances and wear.
Magnet
Diameter
Height
Magnetization
Material
Air Gap (mm)
Available
(mm)
(mm)
Min
Max
Part Number
1
10.52
2.72
Diametrical
SmCo
4.0
7.0
Dexter 6312007
2
6.50
2.69
Diametrical
SmCo
3.0
5.0
Dexter 6312002
TBD
TBD
Diametrical
NdFeB
TBD
TBD
TBD
TBD
Diametrical
NdFeB
TBD
TBD
TBD
TBD
Diametrical
Ceramic
TBD
TBD
Note: For applications with high performance requirements it is suggested that a magnet supplier be contacted to
define the best magnet for the application.
Suggested EEPROM Configuration
For rotary applications three EEPROM addresses may need to be modified. They control the gain, filter, and
communication mode among others. Suggested EEPROM values when using magnet 1 in the above table are given
below. These settings allow a sampling rate of 100Hz with minimal noise and a nominal airgap of 6mm.
Parameter
Value
Parameter
Value
ANA_RESERVED_LOW
0x0
EXT_TRIG
0x0
BIST
0x0
TCMP_EN
0x0
Z_SERIES
0x0
BURST_SEL
0x0
GAIN_SEL
0x5
BURST_DATA_RATE
0x0
HALL_CONF
0xC
OSR2
0x0
TRIG_INT
0x0
RES_XYZ
0x1
COMM_MODE
0x0
DIG_FILT
0x5
WOC_DIFF
0x0
OSR
0x0
Modifications to the above table can be made based on the users performance objectives.
MLX90393 Getting Started Guide
Rev 004 Page 21 of 23 Jun-15
Rotary Code Example
The following flowchart is an example for the microcontroller to configure the MLX90393 via a series of register
read/write operations, permanently store the modifications, and continuously read out the magnetic information.
Processing of the data is performed to obtain a magnetic angle and compute whether the gain should be modified.
After processing, the data is collected, formatted, and can be sent to a PC via the virtual serial port.
A SM/RM cycle is performed approximately every 100ms which does not include the time required to transmit the
various data over the serial port.
MLX90393 Getting Started Guide
Rev 004 Page 22 of 23 Jun-15
1
2Master
Master Slave
Slave
ID1 Read
ID1 Data
ID2 Read
ID2 Data
Sequence
3
4, 6,
8Master
Master Slave
Slave
ID3 Read
ID2 Data
WR 0x00..
Status
5, 7,
9
nMaster
Master Slave
Slave
RR 0x00..
SM
Status
n+1
n+3
Master Slave
RM
Status , RM Data
n+4
Loop three
times to write
0x00, 0x01,
0x02
n+2
Loop
Status, RR Data
Compute norm and update gain
Master Slave
WR 0x00..
Status
Master Slave
RR 0x00..
Status, RR Data
www.melexls.cam
MLX90393 Getting Started Guide
Rev 004 Page 23 of 23 Jun-15
Europe, Africa, Asia:
Phone: +32 1367 0495
Email: sales_europe@melexis.com
America:
Phone: +1 248 306 5400
Email: sales_usa@melexis.com
For the latest version of this document, go to our website at
www.melexis.com
Or for additional information contact your regional sales office
ISO/TS 16949 and ISO 14001 Certified

Products related to this Datasheet

BOARD EVAL FOR MLX90393
SENSOR HALL I2C/SPI 16QFN
SENSOR HALL I2C/SPI 16QFN
SENSOR HALL I2C/SPI 16QFN
SENSOR HALL I2C/SPI 16QFN
SENSOR HALL I2C/SPI 16QFN
SENSOR HALL I2C/SPI 16QFN
SENSOR HALL I2C/SPI 16QFN
SENSOR HALL I2C/SPI 16QFN
SENSOR HALL I2C/SPI 16QFN
SENSOR HALL I2C/SPI 16QFN
SENSOR HALL I2C/SPI 16QFN
SENSOR HALL I2C/SPI 16QFN
SENSOR HALL I2C/SPI 16QFN
SENSOR HALL I2C/SPI 16QFN
SENSOR HALL I2C/SPI 16QFN
SENSOR HALL I2C/SPI 16QFN
SENSOR HALL I2C/SPI 16QFN
SENSOR HALL I2C/SPI 16QFN
SENSOR HALL I2C/SPI 16QFN
SENSOR HALL I2C/SPI 16QFN