LabVIEW FPGA IP for Texas Instruments ADS1258 16-Channel, 24-Bit ADC

Overview

The Texas Instruments ADS1258 is a 16-Channel 24-Bit Analog-to-Digital (ADC) converter that provides serial communication to a master device using the SPI protocol. This example demonstrats how to create the ADS1258 LabVIEW FPGA SPI-based driver IP. The example shows how to use the driver with a NI sbRIO.

Downloads:

1. Device Overview:

The Texas Instruments ADS1258 outputs digitized 24-bit analog voltages in a 4-byte (STATUS Byte plus three data bytes) format through the SPI serial interface accessed via the P5 3.3V Digital I/O Connector on the sbRIO. For more information on the SPI Protocol, please see Understanding the SPI Bus with NI LabVIEW and Implementing SPI Communication Protocol in LabVIEW FPGA. The necessary SPI signals are: SCLK, CS, DRDY, START, MISO (DOUT), and MOSI (DIN). This particular device requires a CPHA and CPOL = 0 and is hard coded onto the FPGA. To select which channels to read and to setup sampling parameters, a command is sent to the device to write the configuration registers after toggling the CS line. Reading data requires that 32-bits of data are clocked to the device with CS tied low in Auto-Scan mode.

2. Using NI RIO and LabVIEW FPGA with SPI Devices:

This example uses a device specific LabVIEW FPGA implementation of the SPI bus to communicate with an ADS1258 ADC through a TI ECG Analog Front End Evaluation Board. The core SPI engine was taken from the SPI Protocol available on IPNet and modified to work specifically with this device. This was performed to maximize performance and the communication rates in synchronizing the DRDY bit, and to enable streaming of SPI data from the FPGA to the LabVIEW Real Time OS. There are two LabVIEW layers in this example: the first layer is a LabVIEW FPGA interface that performs the SPI communication protocol and configures the device while the second layer is a host API that interacts with the FPGA from a host PC. The real-time SBRIO includes Front Panel VI's to interact with the FPGA and to send data to a host PC application.

The sbRIO Adapter to the Texas Instruments Electrocardiogram (ECG) Analog Front End Module will connect to either a digital sbRIO or a sbRIO which includes analog I/O capabilities. Power is supplied by the designed adapter board, but could also be supplied from the Analog Output pins on the J7 Analog I/O Connector if used.

6. Implementing an SPI Example in LabVIEW FPGA:

Using the host API created for communicating with the ADS1258 through the LabVIEW FPGA SPI engine makes it easy to retrieve digitized data. With the example provided, the low-level commands have been abstracted so communicating with the device simply involves setting registers parameters.

To run the program, open ADS1258 Host.vi from the ADS1258 Project.lvproj. This interface is the host to the FPGA SPI core and utilizes remote panel communication in order to run the code on the RealTime target while displaying the data on a PC. The program begins by opening a reference to the top-level FPGA VI and then writing the configuration registers with the Configure ADS1258 VI. Before the configurations registers are written, the core SPI engine starts running and utilizes a hard-coded clock mode with CPOL = 0 and CPHA = 0. As soon as this engine receives data to write to the configuration registers, the engine outputs the commands through the SPI protocol directly after toggling CS. The commands that are written are SPI Reset and Multiple Register Write followed by all register values.

Once the user is ready to begin reading data, the Start ADS1258 VI is called in order to start data conversions and is followed by a ADS1258 Read VI that pulls scaled data from the ADC and displays it on the chart from within a timed loop. When the Start ADS1258 VI is called, the device begins clocking out the 32 bits necessary to retrieve a STATUS byte and three bytes of channel data whenever a falling edge on DRDY is detected. The three data bytes are combined and scaled on the FPGA before they are returned to the RealTime host along with the STATUS byte. Here, it should be noted that the sampling rate is controlled by the timed loop in the real time application. Since timed loops give deterministic operation, sampling rates upwards of 500Hz per channel can be achieved with negligible jitter.

When the user is ready to terminate the read operation, the stop button is pressed on the ADS1258 Host VI. This exits the loop and results in ADS1258 Stop being called in order to stop the SPI engine. Finally, the FPGA reference is closed and the program can be exited properly.

Figure 1. ADS1258 Host.vi Front Panel

To move the example to another target, simply create a new LabVIEW FPGA project with the proper I/O lines and copy the ADS1258 Host.vi, ADS1258 SPI.vi, driver VIs, and FIFOs from this example project. Once the FPGA is recompiled and the correct connections are made, no additional configuration is necessary.

7. Conclusion:

Using the LabVIEW FPGA Module, it is possible to communicate with any SPI based ADC, DAC or embedded sensor. The SPI implementation from this example works with the ADS1258 and is written specifically for this device. For other devices where high data rates are necessary, the overall architecture and interface can be used as a template for streaming SPI communication. Find more device drivers written for LabVIEW FPGA here.

8. Related Documentation

Refer to the following documents to learn more about ECG measurements and the application of Graphical System Design using the NI sbRIO with the TI MDXMDKEK1258 Electrocardiogram (ECG) Analog Front End (AFE) module:

After modifying the IP to run on PXI-7831R, plotting on the graph is not similar to signal applied to ADS1258 at all. In the main control loop under "Clock Out" state, sequence of joining numbers should be modified. The IP returns 32-bits data, with ADC 24-bits conversion result placed at MSB (left most). Modification done is changing the arrangement by placing ADC result on right most of 32-bits data, correct signal is obtained on the graph. A suggestion is the 2.5 constant in the calculation part after joining numbers can be changed to control to allow user choosing different Vref. A problem is that when reading multiple channel (auto-scan), the graph plotting stops randomly while the VI is still running, can it be solved?