Using NI Multisim to Design a Custom CompactRIO Module with Freescale MMA7260Q Acceleration Sensor

Publish Date: Feb 24, 2014 | 15 Ratings | 4.13 out of 5 |  PDF


This application note outlines the process required to design a custom CompactRIO module using the National Instruments suite of circuit design and prototyping tools: NI Multisim and NI Ultiboard.

Multisim and Ultiboard provide engineers with an integrated circuit design platform to simulate, validate and prototype complete designs, including those for custom C series modules. The Ultiboard layout package includes free C Series module templates that can be easily used to complete your design.

This custom Freescale MMA7260Q Low-g Sensor module provides an example of chip evaluation and rapid prototyping with CompactRIO.

Table of Contents

  1. Custom Module Development – Process Overview and Application Development
  2. Capture and Layout of a Freescale MMA7260Q Module Using Multisim and Ultiboard
  3. Creating the Freescale MMA7260Q Custom Module Driver in LabVIEW FPGA
  4. Application Development in LabVIEW FPGA and LabVIEW Real-Time (Buffered Data Acquisition Architecture)
  5. Configuring the Real-Time Application from a Web Browser
  6. Perfoming Analysis of Real-Time Data from MMA7260Q Module with LabVIEW Express VIs
  7. Additional Information and Resources

1. Custom Module Development – Process Overview and Application Development

The CompactRIO Module Development Kit (MDK) provides a manual with the communication protocol and physical specifications necessary to design a custom CompactRIO Module. Background knowledge of analog and digital fundamentals along with at least some exposure to circuit design will be needed. Experience with LabVIEW Real-Time and LabVIEW FPGA is also recommended. The following are the hardware and software requirements used in this application:

 Requirements for MMA7260Q Custom cRIO Module
 Requirements for cRIO Prototype using MMA7260Q

Module Development Resources

  1. cRIO-955x module development kit (MDK)
  2. Assorted module housings and connectors (include in MDK)

Circuit Capture, Simulation, and Layout

  1. NI Multisim Capture and Simulation Environment
  2. NI Ultiboard Layout and Routing Environment

Electrical Components for MMA7260Q Module

  1. Freescale MMA7260Q low g 3-axis sensor
  2. Low-drop out (LDO) regulator (5 V down to 3.3 V) 
  3. Surface-mount (SMT) capacitors and resistors of various values

Application Development Software

  1. LabVIEW Professional Edition
  2. LabVIEW FPGA Module

CompactRIO Hardware

  1. cRIO-910x 4-clot reconfigurable embedded chassis
  2. cRIO-900x real-time controller
  3. cRIO-9215 4-channel 16-bit simultaneous-sampling analog input module
  4. Freescale MMA7260Q custom CompactRIO module



Back to Top

2. Capture and Layout of a Freescale MMA7260Q Module Using Multisim and Ultiboard

The Freescale MMA7260Q custom CompactRIO module has two main design requirements. First, with the module, the user must be able to control the inputs of the Freescale MMA7260Q sensor (selectable g-range, sleep mode, etc.) in software. Secondly, the module should output the proper values from the Freescale MMA7260Q sensor so other I/O (NI cRIO-9215 analog input module) can read the sensor values with 16-bit accuracy.

From the datasheet of the Freescale MMA7260Q, the signal connection requirements are found to be the following:

1) Inputs – g-Select1, g-Select2, and Sleep Mode
2) Outputs – Xout, Yout, and Zout
3) Power and Ground – Vss and Vdd

Figure 1. MMA7260Q Connection Diagram

Source: “±1.5g - 6g Three-Axis Low-g Micromachined Accelerometer”. Freescale Semiconductor. Technical Data. MMA7260Q. Rev 0, 04/2005.

The inputs of the Freescale MMA7260Q are all TTL logic, and as such will be controlled by the outputs from the Xilinx Virtex-II FPGA which resides on the backplane of the CompactRIO chassis. The FPGA itself will be programmed using the LabVIEW FPGA Module, to allow for graphical-programming at a much higher level of abstraction than that of a hardware descriptive language (HDL), which is traditionally used to program an FPGA.

The outputs of the Freescale MMA7260Q will be routed to the BNC connectors of the custom module. The design decision to use BNCs versus an alternative connector such as a 25-pin combicon, is to provide the most durable and reliable connectivity of the Freescale MMA7260Q outputs to the cRIO-9215 Analog Input Module.

The final signal connection requirement of the Freescale MMA7260Q are the power and ground pins. While the ground pin connection is straightforward and will be tied to the ground from the CompactRIO backplane, the power requirement of the MMA7260Q varies from the available power supplied by the CompactRIO backplane. Power specifications from the CompactRIO backplane are discussed in more detail in the CompactRIO MDK. In this case, it will be necessary to incorporate power supply circuitry that will drop the supply voltage of 5 V to the required 3.3 V for the MMA7260Q. This will be accomplished by using a Low-Drop Out (LDO) Regulator. This is the only additional chip used in the circuit design of the custom module, aside from the necessary surface-mount (SMT) capacitors and resistors. When discussing power, an important consideration in the design of a custom CompactRIO module, is whether isolated circuitry is needed or not. In the case of this module, because no signals will be received from the outside world, a nonisolated design will suffice. However, in many cases it would be necessary to provide an electrical and physical barrier between the power supply of the FPGA and the I/O circuitry.

A design option not implemented in this module but worth mentioning, is the ID EEPROM (discussed in detail in the CompactRIO MDK). In most cases when designing a custom CompactRIO module, it is recommended to program an ID EEPROM so both the Measurement & Automation Explorer (MAX) configuration utility, and LabVIEW can automatically recognize the module. However, when prototyping a system with a custom module that won't be mass-produced, it may be convenient to skip the step of programming the EEPROM, which is the case of this example.

Now that the individual circuit components have been analyzed, the next step is to design the schematic in Multisim. The following diagram show the I/O circuitry. If desired, simulation of the circuit can be performed during this stage of the design.

Figure 2. Multisim Schematic of MMA7260Q Circuity

After the schematic is complete, it can be exported from Multisim into Ultiboard for the board layout phase of the design. One advantage of using the Multisim and Ultiboard for custom CompactRIO module development is that Ultiboard conveniently has templates for creating custom CompactRIO modules; measuring the dimensions of the PCB and through-holes is not necessary. You can access the built-in CompactRIO module templates in Ultiboard by selecting Place>>From Database and choosing Board Outlines from the database tree.

The following diagram shows the four CompactRIO templates available in Ultiboard:

1. 10 Pin Screwterm
2. 25 Pin D-Sub
3. Bare Template
4. BNC Template

Figure 3. Selecting a Built-In CompactRIO Module Template in Ultiboard.

Now that the board template has been selected, the placing of components is performed. If the proper component sizes were specified in Multisim, then exporting the schematic to Ultiboard will save time in placing components. Ultiboard contains a number of convenient and flexible tools for layout with Multisim such as annotation, cross-probing and routing; however, this design is simple enough that routing the signals manually was chosen. Before routing can be performed, however, the landpattern (or footprint) of the Freescale MMA7260Q must first be entered using the Component Wizard in Ultiboard, as it is a custom landpattern. This step is necessary because the Freescale MMA7260Q sensor is not yet in the Ultiboard Parts Library.

The following diagram is the solder footprint of the chip that will be defined using the Component Wizard:

Figure 4. Solder Footprint of the MMA7260Q

Source: “±1.5g - 6g Three Axis Low-g Micromachined Accelerometer”. Freescale Semiconductor. Technical Data. MMA7260Q. Rev 0, 04/2005.

Using these dimensions with the Component Wizard, we can create this component to add to the Ultiboard parts library.

Figure 5. Component Wizard Steps in Ultiboard

After walking through the seven steps of the Component Wizard, the part will appear in footprint edit mode. In this example, the solder pads for all the inputs/outputs of the chip were correctly outlined with the component wizard, but the large solder pad in the middle of the footprint needed to be added manually during footprint edit mode. By using the large solder pad (thermal pad), the MMA7260Q can achieve optimal heat dissipation on the PCB.


Figure 6. Footprint Edit Mode in Ultiboard

Similarly the Low-Drop Out regular must be entered into the parts library with the Component Wizard, or selected from one of the sample parts. Once that is complete, the board can be routed out in preparation of board fabrication.

The following diagram shows the 2-layered PCB, with the components on the top layer and a large ground plane represented in red on the bottom layer.

Figure 7. Board Layout in Ultiboard

Now that the board is complete, the Gerber files can be exported and sent electronically to a company that specializes in printed circuit board (PCB) fabrication for creating the PCB. Once the PCB is competed, the components can be soldered to the board and the CompactRIO connectors and housing can be put in place.

The following picture shows what the finished Freescale MMA7260Q module looks like after completion.

Figure 8. Completed cRIO Module

Back to Top

3. Creating the Freescale MMA7260Q Custom Module Driver in LabVIEW FPGA

After you develop the hardware, you must create a driver VI for the custom module. A driver VI is used in the block diagram of a LabVIEW FPGA Module VI to define the functionality of a CompactRIO module.

First, you must configure the hardware so that it recognizes that a generic CompactRIO Module is present. A generic CompactRIO can be recognized on a machine only with the CompactRIO MDK installed (refer to the MDK for more information). Complete the following steps to configure a CompactRIO system for one instance of the custom I/O module.

1. Launch LabVIEW and select an FPGA device as the execution target. The Embedded Project Manager window appears.
2. Select File » New and create a LabVIEW Embedded Project (LEP) file.
3. Select Hardware » Configure Target for CompactRIO in the Embedded Project Manager window. The Configure Target for CompactRIO dialog box appears.

Figure 9. The Configure Target for CompactRIO Dialog Box

4. Select the slot for which you want to configure the driver VI.
5. Select cRIO-generic from the Module Type pull-down menu.
6. Enter a name for the module in the Module Name textbox. Enter a name that represents the module type and the instance of the module. For example, this module is named "/Slot2/MMA7260Q".
7. Click the OK button.

Once the hardware is properly configured, it is time to develop the driver VI. The example driver VI for this module is very straightforward. When this VI is executed, it will perform digital outputs based on the user values for “g-Select1” and “g-Select2”. The MMA7260Q module can be modified depending on the end-user application and the desired g level.

Figure 10. Driver Code to Control the MMA7260Q g-Select Levels

Back to Top

4. Application Development in LabVIEW FPGA and LabVIEW Real-Time (Buffered Data Acquisition Architecture)

After the custom module has been developed, it can be implemented into a complete application. There are two main goals of this application:
1. Allow the user to configure the MMA7260Q module settings remotely via a Web browser.
2. Provide for quick and easy data analysis of the acquired sensor values from the MMA7260Q module using LabVIEW Express VIs.

With these goals in mind, LabVIEW code will be running on three targets – the FPGA of the CompactRIO (LabVIEW FPGA), the real-time controller of the CompactRIO (LabVIEW Real-Time), and a Windows host machine. The architecture used in this application is based on the following tutorial found on Developing High Speed Continuous Buffered Data Acquisition Applications with CompactRIO. Only minor additions to the FPGA and Real-Time code from this proven architecture will need to be added.

Figure 11. MMA7260Q Module Application Architecture (FPGA, Real-Time and Windows Host)

Starting at the lowest-level first, the FPGA code is written using the LabVIEW FPGA module.

Figure 12. Reconfigurable FPGA Application Block Diagram

The “Empty FIFO” loop on the top left of the block diagram simply empties the FIFOs before acquiring data. In the “Acquisition and Buffering” loop, 4-analog input channels are simultaneously sampled by the cRIO-9215. Voltage values from the MMA7260Q module can be read back in with 16-bit resolution. A Loop Timer function with 1 µs resolution is used to determine the sampling rate for the analog input module. The LabVIEW FPGA compiler will always start functions simultaneously and execute them in parallel if no data dependency or programming structure exists to define the timing relationship of the functions. The sequence structure placed around the Loop Timer and Analog Input functions ensures correct timing on the first several iterations by guaranteeing that the analog input operation occurs after the Loop Timer delay (rather than executing the functions simultaneously).

The “Communication to Host” loop performs a handshake with the Real-Time application to ensure that all the buffered data is read before emptying the FIFO and acquiring new data.

The driver portion of the code is also added to the block diagram in the “Read g-Range and Alarms” loop, for user-selectable g-levels. Additional FPGA code is added for AC and DC Limits, in the in anticipation of using a digital output module to alarm of excessive vibration or incorrect orientation of the sensor module.

Now that the FPGA code is written, the Real-Time part of the application is created. The code running on the CompactRIO real-time controller calls the "Open VI" to download the compiled FPGA code to the CompactRIO chassis.

A While loop on the top left of the diagram calibrates the cRIO-9215 at the start of the application. Next, a Timed Loop with the highest priority uses a Read/Write control to configure the g-level settings of the MMA7260Q. An inner For loop contains another Read/Write control, to communicate with the FPGA and read the buffered data (sensor values from the MMA7260Q). Finally, a normal priority While loop receives data from the Timed Loop using Real-Time FIFOs, and then passes that data over TCP/IP so a Windows host machine can perform high-level analysis on the data. Note that analysis could alternatively be performed on the Real-Time target, as opposed to passing it to a Windows host with TCP/IP. However, a Windows host is desirable in order to perform analysis on the data with Express Vis for minimal programming overhead.

Figure 13. LabVIEW Real-Time Application Block Diagram

Back to Top

5. Configuring the Real-Time Application from a Web Browser

A LabVIEW Web Server will be used with our Real-Time target (the CompactRIO controller), so another machine can conveniently connect with an Internet Web browser and configure the Real-Time application.

With LabVIEW targeted to the CompactRIO controller, the configuration options will be modified under Tools»RT Target: x.x.x.x Options… You can configure different network settings, e.g. access lists from different hosts, permissions to view different VIs, and directory locations for the start-up executable.

In the Web Server: Configuration pull-down menu, the Web server is enabled by checking the Enable Web Server option. The rest of the options should be the defaults.

In the Web Server: Browser Access pull-down menu, full control is enabled from every computer that accesses the Real-Time system, by selecting Allow Viewing and Controlling, and enter an asterisk in the text field.

From the Web Server: Visible VIs pull-down menu, all Vis are enable for viewing by entering an asterisk in the text field.

Figure 14. Configuring Web Server Option


Next, the Web Publishing Tool is configured by navigating to Tools»Web Publishing Tool…

Figure 15. Configuring the Web Publishing Tool

You can configure and customize the view of the Web page that will be generated by typing the document title, header, and footer. Use these fields to describe what type of information the Web page will be showing, such as “CompactRIO Freescale MMA7260Q Sensor Demo (RT)”.

Open an Internet Explorer window and enter the IP address of the CompactRIO system “ftp://x.x.x.x” (for example, This will open an FTP session to your Real-Time target so you can upload the html file to the onboard Web server.

Now, an Internet Web browser window can be opened to type in the address “http://x.x.x.x/CompactRIO Sensor Demo (RT).htm”.

The Web page will load into the Web browser as shown below.

Figure 16. Configuring the Real-Time Application from a Web Browser

Right-click on the VI and select Request Control of VI. You will have full control of the VI, just as if you were working with it from LabVIEW.

This Web page can display the front panel of the VI because it is running in your Real-Time target. You can close LabVIEW and the VI will continue running and the Web page will continue displaying the front panel.


Back to Top

6. Perfoming Analysis of Real-Time Data from MMA7260Q Module with LabVIEW Express VIs

The final step in developing the CompactRIO application using the Freescale MMA7260Q module is to analyze the real-time data after it has passed over Ethernet from the Real-Time target to the Windows target.

A built-in TCP/IP receiver function pulls the data from the remote server, as specified by the IP address of the Real-Time target. The output of the TCP/IP receiver function can connect directly to LabVIEW Express Vis for data analysis.

Figure 17. Block Diagram and Front Panel of Windows Host Application

On the front panel, a graph indicator of the raw sensor values is shown on the left and spectral and distortion measurements are shown on the right.

This application has now accomplished both of the goals set forth at the beginning of the development:

  1. Allow the user to configure the MMA7260Q module settings remotely via a Web browser.
  2. Provide quick and easy data analysis of the acquired sensor values from the MMA7260Q module using LabVIEW Express VIs.


Back to Top

7. Additional Information and Resources

  1. Information on custom module development for CompactRIO
  2. Learn more about Multisim and Ultiboard
  3. Find more circuit design resources at the Technical Library
  4. Multisim and Ultiboard application notes and tutorials
  5. Introduction to Multisim

Back to Top

Bookmark & Share


Rate this document

Answered Your Question?
Yes No