Inductive sensing FAQ - Frequently asked questions

Questions

General

Q1: Which devices are covered in this Forum? 

Q2: Is the LDC1000 the best device for my design? 

LC tank design

Q3: What is the maximum target sensing distance? 

Q4: I use a rectangular coil. What is the maximum sensing distance? 

Q5: What is the min/max inductance or min/max coil diameter which the LDC1000/1041/1051 can drive?

Q6: I am using a small coil or spring with very low inductance. Can I still use it as a sensor?

Q7: Can you help me to design a PCB coil?

Q8: How can I design a rectangular, stretched, or racetrack coil?

Q9: Why does the LDC1000 sensor oscillation frequency not change when I change the value of the ‘Sensor Frequency’ register?

Q10: What are the physical properties of the PCB coil on the LDC1000 EVM?

Q11: I am not using all available PCB layers for my PCB coil design. Should I create a GND plane on the other layers?

Q12: What is the recommended copper thickness for a PCB coil?

Inductive sensing fundamentals

Q13. What are the general guidelines for sensing a target through metal?

Q14: Can I use an Inductance-to-Digital converter to measure lateral movement (linear position sensor)?

Q15: What effect does temperature have on the LDC1000/1041/1051? 

Q16: Why does inductance decrease when ferrous material is near the coil?

Q17: What do I need to consider when using a PCB coil for gear tooth counting?

Q18: When I touch the sensor coil, the GUI shows an increase in inductance. Why?

Q19: What is the influence of a motor magnetic field on LDC?

Q20: I am holding a permanent magnet close to coil and can see a decrease in inductance. Is the sensor affected by the magnetic fields of the magnet?

Q21: I have several coils in my system. Will the coils interfere?

Configuring the LDC

Q22: What are Rp min and Rp max values of LDC1000/1041/1051?

Q23: Using the LDC1000/1041/1051 EVM, how do I go about determining the correct Rp min and Rp max settings for my coil?

Q24: What do the numbers in the LDC1000/1041/1051 GUI data log mean?

Q25: How can I determine the optimal drive current on LDC1312, LDC1314, LDC1612, or LDC1614 if I don't know RP?

Q26: What is the LDC1000/1041/1051 wake up time to sensing after a power-on reset is applied?

Q27: What is the difference between Rp and proximity data?

Q28: What is the purpose of the CFB pin capacitor? What happens if I don’t follow the datasheet procedure for selecting the CFB pin capacitor value?

Q29: What does the red LED on the LDC1312, LDC1314, LDC1612, and LDC1614 EVMs indicate?

Q30: Why do I see spikes in the output of LDC1312, LDC1314, LDC1612, or LDC1614?

Q31: What is amplitude correction time between conversions for the LDC1312, LDC1314, LDC1612, and LDC1614?

Q32: What is the maximum sample rate of the LDC131x and LDC161x?

GUI and Software

Q33: Why does my LDC1000/LDC1041/LDC1051 EVM fail to connect when I use the Sensing Solutions EVM GUI?

Q34: Can I connect multiple LDC EVMs to the same computer?

Q35: Why are there repeated samples in my GUI data log file?

Q36: I have 'bricked' my LDC1312, LDC1314, LDC1612, or LDC1614 EVM during a failed firmware upload attempt. What can I do to restore functionality?

Q37: How can I communicate directly with the MSP430 on the LDC1000/1041/1051 EVM?

Q38: Do you have any code examples for communicating directly with the MSP430 on the LDC1000 EVM?

Q39: Is an LDC1000/1041/1051 firmware library for the MSP430 available?

Q40: How can I communicate directly with the MSP430 on the LDC1612, LDC1614, LDC1312, or LDC1314 EVM?

Q41: Do you have any code examples for communicating directly with the MSP430 on the LDC1612, LDC1614, LDC1312, or LDC1314 EVM?

Q42: Windows 8 prevents me from installing the LDC EVM drivers because of missing digital signature information. How can I install the drivers?


Answers

Q1: Which devices are covered in this Forum?

Answer: This forum covers the following Inductive-to-digital converters and Inductive proximity sensor AFEs:


Q2: Is the LDC1000 the best device for my design? 

The LDC1000 is the most suitable LDC for metal type identification applications. For other applications, our newer devices offer many advantages over the LDC1000:

  • The high-resolution multi-channel LDCs (LDC1612, LDC1614) are L-only devices which offer greatly improved measurement accuracy, better part-to-part variation, lower power consumption, easier design integration, and multiple channels.
  • The mid-resolution multi-channel LDCs (LDC1312, LDC1314) are L-only devices which offer better part-to-part variation, lower power consumption, easier design integration, and multiple channels.
  • The high-resolution, high-speed LDC1101 supports both L- and RP-measurements, greatly improved measurement accuracy, better part-to-part variation, lower power consumption, and easier design integration.
  • The LDC2114 and LDC2112 include internal algorithms optimized for inductive touch interfaces and provide extremely low supply current in a compact footprint.

For further information on device selection, refer to: http://www.ti.com/lit/an/snoa954a/snoa954a.pdf


Q3: What is the maximum target sensing distance?

Answer: For targets with a size comparable to the size of the coil, the following rules of thumb apply


Q4: I use a rectangular coil. What is the maximum sensing distance?

Answer: The maximum sensing distance is dominated by the short dimension of the coil. Using the short dimension, the same rules of thumb as for circular coils apply.


Q5. What is the min/max inductance or min/max coil diameter which the LDC1000/1041/1051 can drive?

Answer: There is no a single-number answer to this question. The LDC1000 is limited by the equivalent parallel resistance, Rp, as opposed to solely inductance. Rp = L/Rs/C, where Rs is the equivalent series resistance and C is the cap value. The LDC1000 can measure anywhere from 800 to 4MΩ Rp. 

Coil design governs both L and Rs, and for different coil designs the ratio of L/Rs varies. The smaller the capacitor, the higher Rp will become, which makes smaller coil designs possible. The resonance frequency of the LC tank, however, is limited from 5kHz to 5MHz, which limits the minimum size of the capacitor.


Q6. I am using a small coil or spring with very low inductance. Can I still use it as a sensor?

Answer: Yes, a series inductor can be added to increase the LC tank impedance. For more details, refer to this Analog Wire blog post.


Q7: Can you help me to design a PCB coil?

Answer: Certainly. The LDC Webench tool generates a wide range of 2-layer and 4-layer coil designs according to specific input parameters. Simulation results and coil parameters are provided. Webench can export the layout files to the following layout tools:

  • Altium Designer
  • CadSoft Eagle PCB (v6.4 or newer)
  • DesignSpark
  • Mentor Graphics PADS PCB
  • Cadence Allegro 16.0

The LDC Webench coil design tool is available here: http://www.ti.com/lsds/ti/analog/webench/inductive-sensing.page

For more details, refer to this Analog Wire blog post


Q8. How can I design a rectangular, stretched, or racetrack coil?

Answer: These coil types are currently not supported in WEBENCH. We have developed scripts for Altium to draw those coil types. You can download the scripts  here.


Q9: Why does the LDC1000/1041/1051 sensor oscillation frequency not change when I change the value of the ‘Sensor Frequency’ register?

Answer: The LDC1000 oscillation frequency depends solely on the parameters of the sensor, namely, inductance of the coil and cap value. The register value controls an internal parameter that ensures stable oscillation in LC tank. Please follow the procedure in the datasheet to calculate proper register value.


Q10: What are the physical properties of the PCB coil on the LDC1000/1041/1051 EVM?

Answer: The LDC1000 EVM is a 2-layer PCB with 23 turns per layer, 14mm outer diameter, 5mm inner diameter, 4mil (0.1mm) trace width, 4 mil (0.1mm) trace spacing. The top layer is clockwise inward; the bottom layer is clockwise outward (as seen from top). The EVM is manufactured with 1oz copper thickness (1.37mil or 34.8um)


Q11: I am not using all available PCB layers for my PCB coil design. Should I create a GND plane on the other layers?

Answer: No. It is important to use a keep-out area of at least the coil area on all unused PCB layers. Copper on layers above/below the coil acts as a target, which affects measurements and limits range.


Q12: What is the recommended copper thickness for a PCB coil?

Answer: In general, 1oz copper thickness (1.37mil or 34.8um) is sufficient and recommended for most applications. However, heavier and lighter copper plating also offer advantages in certain applications.

Increasing the copper plating will improve the Q of an equivalent coil, especially for coils operated at low frequencies. However, thicker copper traces cannot be manufactured with the same geometries, so the number of turns in a given area is reduced - and the inductance is correspondingly reduced by the reduction of number of turns squared.

Thinner copper can be used for smaller coils which are operated at higher frequencies (over 3MHz) but the Q will be reduced.


Q13: What are the general guidelines for sensing a target through metal?

Answer: The most important factor is sampling rate. 

  • Determine the minimum rate for the application.
  • Once we have the sampling rate, calculate the minimum LC frequency:
    • LC Frequency = rate * 192/3
  • From there, calculate the skin depth:
    • Skin Depth = 503*sqrt(ρ / (f * µ)), where ρ is resistivity of material to look through, µ is permeability, f is the LC frequency 

As an example, consider the following scenario:

  • We want to determine the maximum thickness of stainless steel (grade 316) that we can sense through for a turbine with one blade.  The blade is 36° wide and rotating at 100 Hz.  Using the steps above:
  • Sampling rate (using a simple model) = 2 *(360° / width) * frequency of rotation = 2 * (360°/36°) * 100Hz = 2kHz
  • LC Frequency = sampling rate * 192/3  = 128KHz
  • Maximum thickness we can see through = 503 * sqrt(0.75uΩm / (128kHz *1)) = 1.218mm

Q14: Can I use an Inductance-to-Digital converter to measure lateral movement (linear position sensor)?

Answer: Yes you can. As long as distance between coil and target is fixed or known, you can translate lateral movement to an inductance change that can be measured with an LDC. There are two approaches which are discussed in the Analog wire blog:

  1. Use a shaped target and a spiral coil
  2. Use a regular target and a non-homogeneous coil

Q15: What effect does temperature have on the LDC1000/1041/1051?

Answer: Please refer to the following app note: SNAA212 – LDC1000 Temperature Compensation


Q16: Why does inductance decrease when ferrous material is near the coil?

Answer: At 3.5 MHz, the magnetic field only insignificantly penetrates the nearby metal, whether it is ferrous or not. Thus, the inductance increase due to field magnification in ferrous material is insignificant.

However, eddy currents are still generated in either case, and they have a negative coupling coefficient with the coil, thus bringing down the inductance of the system.

More information is available here: Why does the inductance go down?


Q17: What do I need to consider when using a PCB coil for gear tooth counting?

Answer: When choosing the PCB coil for gear tooth counting application, the rule of thumb is that its diameter has to be equal or less than the gear thickness. The smaller the coil, the stronger the signal. Make the coil as small as practical/possible. Small coil LC tanks will have smaller Rp value, which will define the minimum coil size.
The coil should be located no more than 50% of the coil diameter away from the teeth. The closer the coil, the stronger the signal.


Q18: When I touch the sensor coil, the GUI shows an increase in inductance. Why?

Answer: This is a capacitive effect. The LDC measures the oscillation frequency, which is given by fsensor = 1/(2π * sqrt(L*C)). The GUI uses the sensor capacitor setting and the frequency counter data to calculate inductance. Touching the coil or the wires between the LDC and the coil adds tank capacitance. The actual sensor capacitor therefore no longer reflects the setting in the GUI. Accurate inductance measurements can only be made if the tank capacitance is known and remains constant.


Q19: What is the influence of a motor magnetic field on LDC?

Answer: Motor magnetic fields will have no impact on LDC, if the oscillation frequency of the LDC is set to MHz range. The motor magnetic field frequency is drastically smaller, and thus cannot couple into the LC tank.


Q20: I am holding a permanent magnet close to coil and can see a decrease in inductance. Is the sensor affected by the magnetic fields of the magnet?

Answer: No. The permanent magnetic field does not interfere with the measurement. However, the conductive material which the magnet is made of acts as a target itself.


Q21: I have several coils in my system. Will my coils interfere?

Answer: In certain circumstances, cross-talk between multiple coils is possible. To avoid cross-talk, ensure that at least one of the following conditions is met:

  • keep the center-to-center distance of the coils above 2D, where D is the average coil diameter.
  • keep the LC tank frequencies at least 15% apart. For coils with low Q, a larger frequency separation is advised. This can easily be achieved by choosing different sensor capacitor values.
  • Place a barrier of metal or ferrite between the coils.

Q22: What are Rp min and Rp max values of LDC1000/1041/1051?

Answer: Rp values and oscillation amplitude set the current limits that LDC1000/1041/1051 drives into the sensor (LC tank). Rp max sets the low limit of the current, where Rp min sets the high limit. Note that the actual current in the LC tank is Q(quality factor)* Current set by Vpp and Rp values. Please, refer to the diagram below:


Q23: Using the LDC1000/1041/1051 EVM, how do I go about determining the correct Rp min and Rp max settings for my coil?

Answer: Use the following procedure:

1) Set Rpmin to 3F, RpMAX to 0.
2) Expose the coil to the maximum metal coverage for your application (closest target position, thickest part etc)
3) Start reducing RpMIN setting 1 code at a time, and take Rp Measurements (they will go up with each change).To speed up tuning, it is also possible to change the value by more than 1 code at a time, for example by using binary search.
4) When proximity data gets in the range of 20,000 - 30,000 codes, that is your optimal RpMIN setting.
5) Move your target to a position where it's exposed the least (farthest position, thinnest part) etc.
6) Start increasing RpMAX setting 1 code at a time, and take Rp Measurements (they will go down with each change).
7) When Rp gets in the range of 2,000 - 3,000 codes, OR the difference between RpMIN and RpMAX values reaches x25 - x26, that is your optimal RpMAX setting. It may get too noisy, then back off 1-2 RpMAX codes.

Further information is provided in the LDC1000 EVM Quick Start Guide.


Q24: What do the numbers in the LDC1000/1041/1051 GUI data log mean?

Answer: in rev 1.0.4.1 of the LDC1000 GUI, the log contains the following data:

date
time stamp
proximity data
inductance (calculated using frequency count data and capacitor value user input)
proximity data
frequency count

Note that the proximity data occurs twice. The additional comma represents a field that has not been implemented in the GUI.

The proximity data is the digital output of the LDC. Using the proximity data, Rpmin, and Rpmax, it is possible to obtain the Resonant Impedance Rp by using the following equation:

R­p = (RpMAX * RpMIN) / [RpMIN*(1-Y) + RpMAX * Y]

Where Y = Proximity Data / 215, and Rp will be in Ohms.

Further information is provided in the LDC1000 EVM Quick Start Guide.


Q25: How can I determine the optimal drive current on LDC1312, LDC1314, LDC1612, or LDC1614 if I don't know RP?

Answer: For best performance, the following procedure is recommended for each channel:

One-time system calibration:

  1. Move the target to the maximum distance from the sensor
  2. Set SETTLECOUNT_CHx.CHx_SETTLECOUNT according to the reference clock, sensor frequency, and sensor Q factor
  3. Enable auto-calibration by setting CONFIG.RP_OVERRIDE_EN to b0
  4. Set CONFIG.SLEEP_MODE_EN to b0
  5. Wait until the device has performed at least one conversion for each channel
  6. Copy the value of DRIVE_CURRENT_CHx.CHx_INIT_IDRIVE into non-volatile memory

 Upon power-up:

  1. For each channel, copy the value of the previously recorded CHx_INIT_IDRIVE setting into register DRIVE_CURRENT_CHx.CHx_IDRIVE
  2. Disable auto-calibration by setting CONFIG.RP_OVERRIDE_EN to 1
  3. Disable auto-amplitude correction by  setting CONFIG.AUTO_AMP_DIS to 1

Q26: What is the LDC1000/1041/1051 wake up time to sensing after a power-on reset is applied? 

Answer: 2ms is power-up time. Coming from the sleep mode it will take a few LC oscillation cycles to achieve stable oscillation. The first 3-4 data samples should be discarded if data is retrieved using a timer clocked to the output data rate (polling).  If data is retrieved using DRDY function on the INT pin, then sampling after the first DRDY from wakeup will be valid data.


Q27: What is the difference between Rp and proximity data?

Answer: The proximity data is the digital output of the LDC. Using the proximity data, Rpmin, and Rpmax, it is possible to obtain the Resonant Impedance Rp by using the following equation:

R­p = (RpMAX * RpMIN) / [RpMIN*(1-Y) + RpMAX * Y]

Where Y = Proximity Data / 215, and Rp will be in Ohms. 


Q28: What is the purpose of the CFB pin capacitor? What happens if I don’t follow the datasheet procedure for selecting the CFB pin capacitor value?

Answer: This capacitor ensures stability of LC tank oscillation. At maximum target distance, the amplitude on the CFB pin should be 1Vpp. If the capacitor value is too low, the signal will clip, thus resulting in an increase of noise. If the capacitor value is too large, the signal amplitude will be too low, which degrades measurement resolution.


Q29: What does the red LED on the LDC1312, LDC1314, LDC1612, and LDC1614 EVMs indicate?

Answer: The red LED is not an indication of failure. It shows when the measured EVM inductance on either channel differs from the default inductance of the EVM coil.

For example, the red LED may be lit if

  • either of the two sensors has been replaced with a custom sensor, or
  • the user touches either of the sensor coils while plugging in the EVM, or
  • the EVM is plugged in while either of the sensor coils is in the presence of metal.

Q30: Why do I see spikes in the output of LDC1312, LDC1314, LDC1612, or LDC1614?

Answer: In most cases in which spikes or noise appear in the LDC output as shown in the screenshot, the deglitch function is set incorrectly. 

 

Please ensure that the input deglitch filter is set correctly. This value must be set to the smallest frequency above the oscillation frequency. For example, if you use the EVM sensor which oscillates at 2MHz, then MUX_CONFIG.DEGLITCH should be set to 100b (3.3MHz). 

If two sensors oscillate in different frequency bands the following methods are recommended:

  • set the DEGLITCH bandwidth to the higher of the bands. For example, if CH0 oscillates at 2MHz (1MHz-3.3MHz band) and CH1 oscillates at 7MHz (3.3MHz-10MHz band), then DEGLITCH should be set to b101 (10MHz cut-off) or
  • change the DEGLITCH value before each conversion to the optimal setting for the sensor that will perform the next conversion.

Q31: What is amplitude correction time between conversions for the LDC1312, LDC1314, LDC1612, and LDC1614?

Answer: The amplitude correction interval is 4 clock cycles; the +4 in datasheet equation 6 includes this factor: tCx = (CHx_RCOUNT ˣ 16 + 4) /fREFx. 

This time interval always occurs between samples, even if the device has the recommended AUTO_AMP_DIS=1 setting.


Q32: What is the maximum sample rate of the LDC131x and LDC161x?

Answer: The maximum sample rate is limited by the I2C protocal rate. At a 400kHz I2C SCLK, the maximum sample rates are:

Maximum sample rate
Number of active channels LDC1312 LDC1314 LDC1612 LDC1614
1 13.3ksps 13.04ksps 4.08ksps 4.08ksps
2 4.08ksps 4.08ksps 2.04ksps 2.04ksps
3 N/A 2.72ksps N/A 1.36ksps
4 N/A 2.04ksps N/A 1.02ksps

Note that RCOUNT and SETTLECOUNT also need to be configured to support the above sample rates. 

Q33: Why does my LDC1000/LDC1041/LDC1051 EVM fail to connect when I use the Sensing Solutions EVM GUI?

Answer: There may have an old firmware on the EVM. To make the EVM compatible with the Sensing Solutions GUI, please follow this procedure:

1. Please install the old LDC1000 GUI www.ti.com/.../snac058. The GUI will prompt automatically to upgrade the firmware.

2. After the firmware upgrade, the new Sensing Solutions GUI should work with the EVM: www.ti.com/.../snoc028


Q34: Can I connect multiple LDC EVMs to the same computer?

Answer: Yes. The maximum number of EVMs that can be used simultaneously is limited by the number of available USB ports. The procedure for connecting multiple EVMs to the same computer is as follows:

  1. Connect the desired number of EVMs to the available USB ports.
  2. Open one instance of the GUI, note down the com port # at the top of the screen. This EVM is the highest priority.
  3. Remove and replace each EVM individually until the COM port number changes. Note down the COM port number. This EVM is the next highest priority.
  4. Repeat this process until no EVMs are connected and the EVM with the lowest priority has been identified.
  5. When all of the EVMs are to be used simultaneously, open one GUI for each EVM and plug in the EVMs from lowest priority to highest priority – they should each claim their own instance of GUI as shown in the screenshot below:


Q35: Why are there repeated samples in my GUI data log file?

Answer: The uC Sampling Rate setting in the GUI affects how often the GUI retrieves data from the microcontroller. It does not configure the sampling rate of the LDC itself. To avoid repeated samples, ensure that the LDC data output rate is at least as fast as the GUI uC Sampling Rate setting. Information on how to configure the output data rate is provided in the datasheet in the section 'Output Data Rate'.


Q36: I have 'bricked' my LDC1312, LDC1314, LDC1612, or LDC1614 EVM during a failed firmware upload attempt. What can I do to restore functionality?

Answer: If you bricked your EVM, you may be able to re-flash the EVM as described in the user guide by connecting the PUR pin to VUSB. This can be done on the LDC1612 rev B EVM by connecting R2 to C29 as shown below.


Q37: How can I communicate directly with the MSP430 on the LDC1000/1041/1051 EVM? 

Answer: The LDC1000 EVM communicates to the GUI using USB CDC, which shows up as a virtual COM port. SPI reads and writes are passed though using a hybrid ASCII/numeric byte protocol:

Host to EVM:
[ Command | Register Address | Data ]
[ 2 hex chars (ASCII) | 2 hex chars (ASCII) | hex chars (width of 2, ASCII)... ]

EVM to Host 32bytes:
[ Command echo | Register Address echo | Data echo | Return Data (at zero-offset 8) ]
[ 2 hex chars (ASCII) | 2 hex chars (ASCII) | hex chars (width of 2, ASCII)... | Numeric Byte(s) ]


EVM to Host (Streaming of Polled Data, 16-bits L):
[ Rp raw data | Frequency Counter raw data ]
[ 1024 bytes | 1024 bytes ]
[ 16-bit Big Endian words x 512 | 16-bit Big Endian words x 512 ]

EVM to Host (Streaming of Polled Data, 24-bits L):
[ Rp raw data | Frequency Counter raw data ]
[ 1024 bytes | 1536 bytes ]
[ 16-bit Big Endian words x 512 | 24-bit Big Endian words x 512 ]

  • Data is streamed in chunks of 2048 bytes
  • The first 1024 bytes are Rp raw data, the rest are Frequency Counter raw data
  • Data is streamed Big Endian, 16-bit words
  • Samples are chronological (first word in buffer is first sample)

Commands are as follows:

Command_SPI_Byte_Write: "02"

  • Writes a byte to the LDC1000
  • send data length = 2 hex chars (ASCII); data: byte to write
  • return data length = 1 byte; data: numeric byte that was written

Command_SPI_Byte_Read: "03"

  • Reads a byte from the LDC1000
  • send data length = 0
  • return data length = 1 byte; data: numeric byte that was read

Command_Firmware_Version_Read: "09"

  • Reads the firmware version
  • send data length = 0
  • return data length = 4 bytes; data: numeric bytes, MSByte ... LSByte

Command_Timer_Interval: "08"

  • Sets the polling interval on the microcontroller for LDC1000 data
  • send data length = 4 numeric ASCII chars.  Timer clock period. (e.g. "1234" = 24MHz/1234 = 19.4kHz ),
  • return data length = 2 bytes; data: numeric 16-bit word, little endian.  Timer A0 Capture Compare Register 0 value.
  • Warning: Intervals faster than 35kHz are unsupported

Command_Start_Streaming 16-bits R, 16-bits L: "06"

  • Starts data polling and streaming to host
  • send data length = 0
  • return data length = 0

Command_Start_Streaming 16-bits R, 24-bits L: "0B"

  • Starts data polling and streaming to host
  • send data length = 0
  • return data length = 0

Command_Stop_Streaming: "07"

  • Stops data polling and streaming to host
  • send data length = 0
  • return data length = 0

Q38: Do you have any code examples for communicating directly with the MSP430 on the LDC1000 EVM?

Answer: 

Please see below short Pyhon script to read write LDC1000 registers:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import collections
import serial
import time
import struct
import msvcrt
from array import *


#############################################################################################
# USB CDC commands
LDC_READ = '03'
LDC_WRITE = '02'
LDC_FIRMWARE ='09'
LDC_STREAM_ON = '06'
LDC_STREAM_OFF = '07'
#############################################################################################

#############################################################################################
# LDC1000 addressing space
LDC1000_CMD_REVID       = '00'
LDC1000_CMD_RPMAX       = '01'
LDC1000_CMD_RPMIN       = '02'
LDC1000_CMD_SENSORFREQ  = '03'
LDC1000_CMD_LDCCONFIG   = '04'
LDC1000_CMD_CLKCONFIG   = '05'
LDC1000_CMD_THRESHILSB  = '06'
LDC1000_CMD_THRESHIMSB  = '07'
LDC1000_CMD_THRESLOLSB  = '08'
LDC1000_CMD_THRESLOMSB  = '09'
LDC1000_CMD_INTCONFIG   = '0A'
LDC1000_CMD_PWRCONFIG   = '0B'
LDC1000_CMD_STATUS      = '20'
LDC1000_CMD_PROXLSB     = '21'
LDC1000_CMD_PROXMSB     = '22'
LDC1000_CMD_FREQCTRLSB  = '23'
LDC1000_CMD_FREQCTRMID  = '24'
LDC1000_CMD_FREQCTRMSB  = '25'


DEBUG_PRINT_TX_DATA = 0
DEBUG_PRINT_RX_DATA = 0
DEBUG_PRINT_READ_DATA = 0


def write_reg(serial_port, addr, data):
    serial_port.write('02'+addr+data)
    s = serial_port.read(32)
    if DEBUG_PRINT_RX_DATA :
        print("Read:", s )

def read_reg(serial_port, addr):
    serial_port.write('03'+addr+'00')
    s = serial_port.read(32)
    if DEBUG_PRINT_RX_DATA :
        print("Read:", s )
    data_read = s[8]
    if DEBUG_PRINT_READ_DATA:
        print("Addr:", addr,"Data:", data_read )
    return data_read.encode('hex')

def ldc_config(serial_port):
    write_reg(serial_port, LDC1000_CMD_RPMAX,       '0E')
    write_reg(serial_port, LDC1000_CMD_RPMIN,       '3B')
    write_reg(serial_port, LDC1000_CMD_SENSORFREQ,  '94')
    write_reg(serial_port, LDC1000_CMD_LDCCONFIG,   '17')
    write_reg(serial_port, LDC1000_CMD_CLKCONFIG,   '02')
    write_reg(serial_port, LDC1000_CMD_INTCONFIG,   '04')

    write_reg(serial_port, LDC1000_CMD_THRESHILSB,  '50')
    write_reg(serial_port, LDC1000_CMD_THRESHIMSB,  '14')
    write_reg(serial_port, LDC1000_CMD_THRESLOLSB,  'C0')
    write_reg(serial_port, LDC1000_CMD_THRESLOMSB,  '12')
    
    
def main():
    serial_port = serial.Serial(port='COM12', baudrate=115200)

    write_reg (serial_port, LDC1000_CMD_PWRCONFIG, '00')
    ldc_config (serial_port)
    write_reg (serial_port, LDC1000_CMD_PWRCONFIG, '01')
    # Read Proximity Data LSB to update data
    try:
      while 1:
        # do loop stuff
        read_reg  (serial_port, LDC1000_CMD_PROXLSB)
        data_lsb    = read_reg  (serial_port, LDC1000_CMD_FREQCTRLSB)
        data_msb    = read_reg  (serial_port, LDC1000_CMD_FREQCTRMID)
        status      = read_reg  (serial_port, LDC1000_CMD_STATUS)

        rp_min      = read_reg  (serial_port, LDC1000_CMD_RPMAX)
        rp_max      = read_reg  (serial_port, LDC1000_CMD_RPMIN)
        freq        = read_reg  (serial_port, LDC1000_CMD_SENSORFREQ)
        conf        = read_reg  (serial_port, LDC1000_CMD_LDCCONFIG)
        clk         = read_reg  (serial_port, LDC1000_CMD_CLKCONFIG)
        int         = read_reg  (serial_port, LDC1000_CMD_INTCONFIG)
        
        th_hi_lsb       = read_reg  (serial_port, LDC1000_CMD_THRESHILSB)
        th_hi_msb       = read_reg  (serial_port, LDC1000_CMD_THRESHIMSB)
        th_lo_lsb       = read_reg  (serial_port, LDC1000_CMD_THRESLOLSB)
        th_lo_msb       = read_reg  (serial_port, LDC1000_CMD_THRESLOMSB)

        
        print("Frequency Counter=%s%s  Status=%s  rp_min=%s rp_max=%s freq=%s conf=%s clk=%s int=%s th_hi_lsb=%s th_hi_msb=%s th_lo_lsb=%s th_lo_msb=%s" % (data_msb, data_lsb, status, rp_min, rp_max, freq, conf, clk, int, th_hi_lsb, th_hi_msb, th_lo_lsb, th_lo_msb))
        time.sleep(.5)

    except KeyboardInterrupt:
        exit()

if __name__ == "__main__":
    main()


Q39: Is an LDC1000/1041/1051 firmware library for the MSP430 available?

Answer: Yes. The LDC1000 firmware library is written to support a wide range of MSP430 devices, from the G2 value series to the higher-performance 5xx/6xx series. Rapidly interface to a microcontroller with multiple, proven examples utilizing an extensible code library. The EVM firmware is also included in the GUI distribution under subfolder "Firmware" in the application installation directory.


Q40: How can I communicate directly with the MSP430 on the LDC1612, LDC1614, LDC1312, or LDC1314 EVM?

Answer: 

LDC13xx/16xx communication is accomplished via driver-simulated COM protocols. Settings are:

            Baud rate 115200

            No termination CHAR

            Data bits 8

            Parity None

            Stop bit 1

Flow control: None

Write register command

Write register command is used to set desired register settings. It is formed as follow:

4C 15 01 00 04 2A XX YY YY ZZ

Where

            4C 15 01 00 04 2A = Write register command header.

            XX is the register address to be written, expressed as HEX. For example, if register 12 is x0C, so XX = 0C

            YY YY is the 2 bytes of data to be written, in HEX, MSB 1st.

            ZZ is CRC-8 check for the command string, which is explained below.

Each HEX value represents corresponding ASCII character, which is written to COM port.

For example, if we need to write to register 11 (x1B) a value of x820D, the command is

4C 15 01 00 04 2A 1B 82 0D A3. In ASCII it appears as                            

After writing a register it is required to read back 32 bytes – MCU response to a command. Convert ASCII string into array of 8-bit numbers. It consists of the command sent + 21 bytes of 00 + CRC value. In the above example, correct response is 4C 15 01 00 04 2A 1B 82 0D A3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00A3.

4th byte (indicated in red above) is an error field. If this byte is 00, there is no error.

Read register command

Read register command is used to check LDC register settings. Read process consists of 2 steps:

1)      Set register command, which is required to indicate which register is to be read. The command format is: 4C 15 01 00 02 2A XX ZZ, where XX is the register address to be read, and ZZ is CRC-8 check for the command string. For example, to read back register 1B the command is 4C 15 01 00 02 2A 1B 10. After sending this command it is required to read 32 bytes. The 4th byte will indicate an error, if any.

2)      Read register command, in the format 4C 14 01 00 02 2A 02 ZZ, where ZZ is CRC-8 check. After sending this command it is required to read 32 bytes, as noted above. The 4th byte will indicate an error, if any. 7th and 8th bytes are MSB and LSB bytes of the register value. For example, if we read register x1B value, the response is 4C 14 01 00 03 2A 82 0D C6 A3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 C6

 

Start streaming command

To optimize data throughput a special command is implemented, which will continuously output data from LDC devices to COM port.

To start streaming, send 4C 05 01 00 06 01 29 04 04 30 2A C1. After sending this command it is required to read 32 bytes. 4th byte will indicate an error, if any.

After the stream is initialized, read 32 bytes at a time. An example read:

4C30 0100 092A 0151 42CB 0150 5FFF 1C00 0000 0000 0000 0000 0000 0000 0000 001C

Bytes 7-10 are the Ch0 data (marked in green), MSB 1st, bytes 11-14 are Ch1 data (marked in blue), MSB 1st. In this example, Ch0 data is x015142CB (22,102,731 in decimal), Ch1 is 01505FFF (22,044,671). Further conversion of the raw data to the frequency of oscillation is described in the LDC161x/131x datasheet

Stop streaming command

To stop the streaming, send the command 4C 06 01 00 01 01 D2. After sending this command it is required to read 32 bytes. 4th byte will indicate an error, if any.

 

CRC-8 check

CRC check is well described in http://en.wikipedia.org/wiki/Computation_of_cyclic_redundancy_checks

Please refer to the link for more detailed information.

The LDC 13xx/16xx EVMs use CRC-8 with polynomial coefficient indices of 8, 2, 1, and 0.

Outlined below is one of the possible implementations:

Convert each byte in the command to an array of Booleans (T = 1, F = 0), MSB being index 1. For example, xA7 becomes an array (T,F,T,F,F,T,T,T).

Concatenate the array of bytes, 1st byte being indices 1-8, 2nd – bytes 9-16 etc. For example, xA70F becomes (T,F,T,F,F,T,T,T,F,F,F,F,T,T,T,T). Record the array size N.

Form C = (T,F,F,F,F,F,T,T,T) – CRC array. Note that the indices of the non-zero coefficients are 8, 2, 1, 0.

Append to the Boolean command array an array of 8 False (F,F,F,F,F,F,F,F) at the end. Denote this array A.

For loop for i=1 to N

IF A[i] = True then

            Get B = array A subset starting at index i, length 9

            B’ = B XOR C

            Replace B in A with B’

End IF

End loop

Take the last 8 Booleans of the updated A, convert it to byte (MSB 1st). For example, if last 8 elements in A are (T,F,T,T,F,F,T,T), it converts to xB3

This is desired CRC-8 check value (ZZ value in the document)


Q41: Do you have any code examples for communicating directly with the MSP430 on the LDC1612, LDC1614, LDC1312, or LDC1314 EVM?

Answer: 

Please see below short Pyhon script to read write LDC1614 registers.

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import collections
import serial
import time
import struct
import msvcrt
from array import *
import binascii


#############################################################################################
# LDC1000 addressing space
LDC1614_DATA_MSB_CH0        = '00'
LDC1614_DATA_LSB_CH0        = '01'
LDC1614_DATA_MSB_CH1        = '02'
LDC1614_DATA_LSB_CH1        = '03'
LDC1614_DATA_MSB_CH2        = '04'
LDC1614_DATA_LSB_CH2        = '05'
LDC1614_DATA_MSB_CH3        = '06'
LDC1614_DATA_LSB_CH3        = '07'
LDC1614_RCOUNT_CH0          = '08'
LDC1614_RCOUNT_CH1          = '09'
LDC1614_RCOUNT_CH2          = '0A'
LDC1614_RCOUNT_CH3          = '0B'
LDC1614_OFFSET_CH0          = '0C'
LDC1614_OFFSET_CH1          = '0D'
LDC1614_OFFSET_CH2          = '0E'
LDC1614_OFFSET_CH3          = '0F'
LDC1614_SETTLECOUNT_CH0     = '10'
LDC1614_SETTLECOUNT_CH1     = '11'
LDC1614_SETTLECOUNT_CH2     = '12'
LDC1614_SETTLECOUNT_CH3     = '13'
LDC1614_CLOCK_DIVIDERS_CH0  = '14'
LDC1614_CLOCK_DIVIDERS_CH1  = '15'
LDC1614_CLOCK_DIVIDERS_CH2  = '16'
LDC1614_CLOCK_DIVIDERS_CH3  = '17'
LDC1614_STATUS              = '18'
LDC1614_ERROR_CONFIG        = '19'
LDC1614_CONFIG              = '1A'
LDC1614_MUX_CONFIG          = '1B'
LDC1614_RESET_DEV           = '1C'
LDC1614_DRIVE_CURRENT_CH0   = '1E'
LDC1614_DRIVE_CURRENT_CH1   = '1F'
LDC1614_DRIVE_CURRENT_CH2   = '20'
LDC1614_DRIVE_CURRENT_CH3   = '21'
LDC1614_MANUFACTURER_ID     = '7E'
LDC1614_DEVICE_ID           = '7F'


DEBUG_PRINT_TX_DATA = 0
DEBUG_PRINT_RX_DATA = 0
DEBUG_PRINT_READ_DATA = 0

class crc8:
    def __init__(self):
        self.crcTable = (0x00, 0x07, 0x0e, 0x09, 0x1c, 0x1b, 0x12, 0x15, 0x38,
            0x3f, 0x36, 0x31, 0x24, 0x23, 0x2a, 0x2d, 0x70, 0x77,
            0x7e, 0x79, 0x6c, 0x6b, 0x62, 0x65, 0x48, 0x4f, 0x46,
            0x41, 0x54, 0x53, 0x5a, 0x5d, 0xe0, 0xe7, 0xee, 0xe9,
            0xfc, 0xfb, 0xf2, 0xf5, 0xd8, 0xdf, 0xd6, 0xd1, 0xc4,
            0xc3, 0xca, 0xcd, 0x90, 0x97, 0x9e, 0x99, 0x8c, 0x8b,
            0x82, 0x85, 0xa8, 0xaf, 0xa6, 0xa1, 0xb4, 0xb3, 0xba,
            0xbd, 0xc7, 0xc0, 0xc9, 0xce, 0xdb, 0xdc, 0xd5, 0xd2,
            0xff, 0xf8, 0xf1, 0xf6, 0xe3, 0xe4, 0xed, 0xea, 0xb7,
            0xb0, 0xb9, 0xbe, 0xab, 0xac, 0xa5, 0xa2, 0x8f, 0x88,
            0x81, 0x86, 0x93, 0x94, 0x9d, 0x9a, 0x27, 0x20, 0x29,
            0x2e, 0x3b, 0x3c, 0x35, 0x32, 0x1f, 0x18, 0x11, 0x16,
            0x03, 0x04, 0x0d, 0x0a, 0x57, 0x50, 0x59, 0x5e, 0x4b,
            0x4c, 0x45, 0x42, 0x6f, 0x68, 0x61, 0x66, 0x73, 0x74,
            0x7d, 0x7a, 0x89, 0x8e, 0x87, 0x80, 0x95, 0x92, 0x9b,
            0x9c, 0xb1, 0xb6, 0xbf, 0xb8, 0xad, 0xaa, 0xa3, 0xa4,
            0xf9, 0xfe, 0xf7, 0xf0, 0xe5, 0xe2, 0xeb, 0xec, 0xc1,
            0xc6, 0xcf, 0xc8, 0xdd, 0xda, 0xd3, 0xd4, 0x69, 0x6e,
            0x67, 0x60, 0x75, 0x72, 0x7b, 0x7c, 0x51, 0x56, 0x5f,
            0x58, 0x4d, 0x4a, 0x43, 0x44, 0x19, 0x1e, 0x17, 0x10,
            0x05, 0x02, 0x0b, 0x0c, 0x21, 0x26, 0x2f, 0x28, 0x3d,
            0x3a, 0x33, 0x34, 0x4e, 0x49, 0x40, 0x47, 0x52, 0x55,
            0x5c, 0x5b, 0x76, 0x71, 0x78, 0x7f, 0x6a, 0x6d, 0x64,
            0x63, 0x3e, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2c, 0x2b,
            0x06, 0x01, 0x08, 0x0f, 0x1a, 0x1d, 0x14, 0x13, 0xae,
            0xa9, 0xa0, 0xa7, 0xb2, 0xb5, 0xbc, 0xbb, 0x96, 0x91,
            0x98, 0x9f, 0x8a, 0x8d, 0x84, 0x83, 0xde, 0xd9, 0xd0,
            0xd7, 0xc2, 0xc5, 0xcc, 0xcb, 0xe6, 0xe1, 0xe8, 0xef,
            0xfa, 0xfd, 0xf4, 0xf3)
    def crc(self, msg):
        runningCRC = 0
        for c in msg:
            c = ord(str(c))
            runningCRC = self.crcByte(runningCRC, c)
        return runningCRC
 
    def crcByte(self, oldCrc, byte):
        res = self.crcTable[oldCrc & 0xFF ^ byte & 0xFF];
        return res 

def write_reg(serial_port, addr, data):
    crc = crc8()
    serial_string = '4C150100042A'+ addr + data
    serial_string = serial_string.decode('hex')
    crc_byte = chr(crc.crc(serial_string))
    serial_port.write(serial_string+crc_byte)
    s = serial_port.read(32)
    if DEBUG_PRINT_RX_DATA:
        print("Read:%s" % (binascii.hexlify(s)))
    if (s[3] != '\x00'):
        print("Error in write register")
        exit()

def read_reg(serial_port, addr):

    crc = crc8()
    serial_string = '4C150100022A'+ addr
    serial_string = serial_string.decode('hex')
    crc_byte = chr(crc.crc(serial_string))
    serial_port.write(serial_string+crc_byte)
    s = serial_port.read(32)
    if DEBUG_PRINT_RX_DATA:
        print("Read:%s" % (binascii.hexlify(s)))
    if (s[3] != '\x00'):
        print("Error in set register")
        exit()
    serial_string = '4C140100022A02'
    serial_string = serial_string.decode('hex')
    crc_byte = chr(crc.crc(serial_string))
    serial_port.write(serial_string+crc_byte)
    s = serial_port.read(32)
    if DEBUG_PRINT_RX_DATA:
        print("Read:%s" % (binascii.hexlify(s)))
    if (s[3] != '\x00'):
        print("Error in read register")
        exit()
    data_read = s[6] + s[7]
    if DEBUG_PRINT_READ_DATA:
        print("Addr:", addr,"Data:", binascii.hexlify(data_read) )
    return binascii.hexlify(data_read)

def ldc_config(serial_port):
    write_reg(serial_port, LDC1614_MUX_CONFIG,       'C20F')
    
    
def main():
    serial_port = serial.Serial(port='COM13', baudrate=115200)
    device_id   = read_reg  (serial_port, LDC1614_DEVICE_ID)
    print("device_id=%s" % (device_id))

    write_reg (serial_port, LDC1614_CONFIG, '0200')
    ldc_config (serial_port)
    write_reg (serial_port, LDC1614_CONFIG, '0000')

    try:
      while 1:
        # do loop stuff
        data_lsb    = read_reg  (serial_port, LDC1614_DATA_LSB_CH0)
        data_msb    = read_reg  (serial_port, LDC1614_DATA_MSB_CH0)
        status      = read_reg  (serial_port, LDC1614_STATUS)
        
        print("Frequency Counter=%s%s  Status=%s  " % (data_msb, data_lsb, status))
        time.sleep(.5)

    except KeyboardInterrupt:
        exit()

if __name__ == "__main__":
    main()


Q42: Windows 8 prevents me from installing the LDC EVM drivers because of missing digital signature information. How can I install the drivers?

Answer: If you have problems to install the drivers under Windows 8, follow this procedure:

  1. Disable secure boot from BIOS/EFI
  2. Windows Key + R
  3. Enter shutdown.exe /r /o /f /t 00
  4. Click the "OK" button
  5. System will restart to a "Choose an option" screen
  6. Select "Troubleshoot" from "Choose an option" screen
  7. Select "Advanced options" from "Troubleshoot" screen
  8. Select "Windows Startup Settings" from "Advanced options" screen
  9. Click "Restart" button. System will restart to "Advanced Boot Options" screen
  10. Select "Disable Driver Signature Enforcement"
  11. Once the system starts, install the ldc1OOO.inf drivers

Best regards,
Ben Kasemsadeh
Applications Engineer
Silicon Valley Analog Group 
Texas Instruments

2 Replies