KMA199E All information provided in this document is subject to legal disclaimers. © NXP B.V. 2011. All rights reserved.
Product data sheet Rev. 2 — 7 December 2011 19 of 32
NXP Semiconductors
KMA199E
Programmable angle sensor
13.4.1 Software example in C
1 #include <stdio.h.>
2
3 // calc_crc accepts unsigned 16-bit data in data
4 int calc_crc(int crc, unsigned int data)
5{
6 const int gpoly = 0x107; // generator polynomial
7 int i; //index variable
8 for (i = 15; i >= 0; i--) {
9 crc <<= 1; //shift left
10 crc = (int) ((data & (1u<<i))>>i);
11 // XOR of with generator polynomial when MSB(9) = HIGH
12 if (crc & 0x100) crc ^= gpoly;
13 }
14 return crc;
15 }
16 int main(void)
17 {
18 int crc, crc_res, i;
19 // 8 LSB are CRC field filled with 0
20 unsigned int data_seq[] = {0x1111, 0x2222, 0x3333, 0x4444,
21 0x5555, 0x6666, 0x7777, 0x8888,
22 0x9999, 0xAAAA, 0xBBBB, 0xCCCC,
23 0xDDDD, 0xEEEE, 0xFFFF, 0x4200};
24 // calculate checksum over all data
25 crc = 0xFF; // start value of crc register
26 printf(“Address\tValue\n”);
27 for (i = 0; i <= 15; i++)
28 {
29 printf(“0x%1X\t0x%04X\n”, i, data_seq[i]);
30 crc = calc_crc(crc, data_seq[i]);
31 }
32 crc_res = crc; // crc_res = 0x6F
33 printf(“\nChecksum\n0x%02X\n”, crc_res);
34 // check procedure for above data sequence
35 crc = 0xFF;
36 for (i = 0; i <= 14; i++)
37 crc = calc_crc(crc, data_seq[i]);
38 // last word gets crc inserted
39 crc = calc_crc(crc, data_seq[i] crc_res);
40 printf(“\nCheck procedure for data sequence: must be 0x00 is 0x%02X.\n”,crc);
41 return 1;
42 }
The checksum of this data sequence is 6Fh.
KMA199E All information provided in this document is subject to legal disclaimers. © NXP B.V. 2011. All rights reserved.
Product data sheet Rev. 2 — 7 December 2011 20 of 32
NXP Semiconductors
KMA199E
Programmable angle sensor
13.5 Registers
13.5.1 Command registers
In order to enter the command mode, the signature given in Table 16 has to be written via
the OWI into the specific register. This must be done as described in Section 13.3.3
, with
a write command, followed by the signature, but after a power-on reset and not later than
t
cmd(ent)
.
Table 16. Command registers
Command
write/read
Register Bit Access Field Description
82h/83h CTRL1 15 R IN_DIAG_MODE shows if there is a diagnostic condition present;
this bit is not affected by the setting of the register
field FORCE_DIAG_OFF
14 R/W FORCE_DIAG_OFF force diagnostic mode off; default: 0b
13 - - reserved
12 R LOW_VOLTAGE_DET low voltage condition detected
11 R/W EEP_CP_CLOCK_EN charge pump clock on (must be set after setting
EEPROM write enable signal for writing to
EEPROM); default: 0b
10 and 9 - - reserved
8 R EEP_ERR_CORRECT EDC: EEPROM error has been corrected; updated
every EEPROM readout and stays set once set
7 R EEP_UNCORR_ERR EDC: EEPROM uncorrectable error has been
detected; updated every EEPROM readout and
stays set once set
6 R MAGNET_LOST_DET magnet-lost detected; bit stays set even if the
condition disappears; for this detection which leads
to diagnostic mode, the magnet-lost detection must
be enabled
5 - - reserved
4 R CRC_BAD CRC check has failed (checked during start-up)
3to0 - - reserved
94h/- SIGNATURE 15 to 0 W SIGNATURE write signature 9BA4h within t
cmd(ent)
to enter
command mode; for more details see
Section 13.3.3
96h/97h TESTCTRL0 15 to 12 - - reserved
11 W EEP_WRITE_EN EEPROM write enable signal (must be set before
writing to EEPROM)
0605h — disabled (default)
0E05h — enabled
10 to 0 - - reserved
KMA199E All information provided in this document is subject to legal disclaimers. © NXP B.V. 2011. All rights reserved.
Product data sheet Rev. 2 — 7 December 2011 21 of 32
NXP Semiconductors
KMA199E
Programmable angle sensor
13.5.2 EEPROM registers
The device includes several internal registers, which are used for purposes, such as
customization and identification.
The initial signature allows read access to all areas, but write access just to customer
registers only. Write accesses to reserved areas are ignored. Since these registers are
implemented as EEPROM cells, writing to the registers needs a specific time t
prog
after
each write access.
Since there is no check for the programming time, the user has to take care that no other
access to the EEPROM is done during the programming. The EEPROM must not be
addressed during the time t
prog
.
Note: Before data can be stored in the EEPROM, the internal charge pump has to be
switched on for the duration of programming by setting register CTRL1, bit 11
EEP_CP_CLOCK_EN, as well as register TESTCTRL0, bit 11 EEP_WRITE_EN. For
calculating the checksum, all register addresses have to be read out and consulted,
although some of them are reserved for calibration purposes.
Table 17. EEPROM registers
Address Command
write/read
Register Bit Description Default
MSB/LSB
0h 00h/01h reserved - addresses are reserved for calibration purposes
Note: These addresses have to be read out for
calculating the checksum. The content stored in
these registers may not be changed!
[1]
1h 02h/03h
2h 04h/05h
3h 06h/07h
4h 08h/09h
5h 0Ah/0Bh
6h 0Ch/0Dh
7h 0Eh/0Fh ZERO_ANGLE 15 to 0 mechanical zero degree position 00h/00h
8h 10h/11h MAGNET_LOST 15 to 0 magnet-lost detection
0000h — disabled
004Fh — enabled
00h/00h
9h 12h/13h ANG_RNG_MULT_LSB 15 to 3 least significant bits of angular range multiplicator 20h/00h
2 to 0 undefined
[2]
Ah 14h/15h CLAMP_LO 15 to 13 undefined
[2]
01h/00h
12 to 0 lower clamping level output voltage
Bh 16h/17h CLAMP_HI 15 to 13 undefined
[2]
12h/FFh
12 to 0 upper clamping level output voltage
Ch 18h/19h ID_LO 15 to 0 lower 16 bits of identification code 00h/00h
Dh 1Ah/1Bh ID_HI 15 to 0 upper 16 bits of identification code 00h/00h
Eh 1Ch/1Dh CLAMP_SW_ANGLE 15 to 6 when angle is bigger than CLAMP_SW_ANGLE
the output will switch to CLAMP_LO for a positive
slope
FFh/C1h
ANG_RNG_MULT_MSB 5 to 0 most significant bits of angular range multiplicator

KMA199E,115

Mfr. #:
Manufacturer:
NXP Semiconductors
Description:
Motion & Position Sensors Board Mount Motion & Position Sensors ANGULAR SENSR SYSTEM
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union

Products related to this Datasheet