Documentation Home Page Cell Monitoring Device Emulation Add-On for NI VeriStand Home page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Certain cell monitoring devices can communicate with externally connected circuits via I2C or SPI protocols over GPIO lines. These external circuits, which act as I2C/SPI slaves, can be sensors, analog multiplexers, serial-to-parallel converters, and more. Although physical GPIO lines are absent in an emulated environment, it is possible to simulate the I2C/SPI slave as an external model on the target CPU and interface it with the emulated device on the FPGA. Communication is established through VeriStand channels instead of traditional I2C or SPI protocols. This guide provides an overview of the necessary project configuration to add the slave model and the command sequence to run during execution.

ExternalDevice-Simple.png

Notice that since this communication happens at CPU level, there will be a timing limitation defined by how fast the CMDE Add-on and the Simulation External Model are executing.

  • The configuration for the CMDE Add-on execution can be configured at the advanced performance section of the CMDE Add-On Custom Device page.

  • The configuration for the simulation model execution is described in the following page Setting Model Timing.

Project Configuration

  1. Check Compatibility

    • Ensure the emulated cell monitoring device supports WRCOMM and STCOMM commands. Documentation on supported commands for each Device type can be found in this Wiki space.

  2. Add External Model

    • Create a model of the external circuit and add it to the VeriStand project. Refer to Integrating and Executing Models for detailed instructions. The model interface should include:

      • Two inputs to receive COMM Register data from the emulated cell monitoring device:

        • Input 1: Control bits (ICOMx[3:0] and FCOMx[3:0])

        • Input 2: Data bits (Dx[7:0])

      • Two outputs to write data to the COMM Register of the emulated cell monitoring device:

        • Output 1: Control bits (ICOMx[3:0] and FCOMx[3:0])

        • Output 2: Data bits (Dx[7:0])

  3. Map Signals

    • In the VeriStand Editor, connect the signals between the external model and the cell monitoring device:

      • Map the WRCOMM Command and WRCOMM Data device channels to the inputs of the external model.

      • Map the outputs of the external model to the STCOMM Reply Command and STCOMM Reply Data device channels.

ExternalSensorConnections.PNG
  1. Connect SPI Master

    • Connect the SPI Master to the target DIO channels to establish SPI communication with the emulated device.

  2. Run Model

    • Save and deploy the VeriStand project.

Command Sequence

During execution, send the following sequence of commands from the SPI Master to the emulated device:

  1. WRCOMM

    • Data transmitted by the WRCOMM command is stored in the COMM Register of the emulated cell monitoring device. These values are continually written to the WRCOMM Command and WRCOMM Data channels, and subsequently received by the external model through the mapped input channels. Note that in a real system, the COMM Register values are transmitted to the I2C/SPI slave device only after the STCOMM command is received.

  2. STCOMM

    • When the STCOMM command is received, the emulated device reads the response written to the STCOMM Reply Command and STCOMM Reply Data channels by the external model. These values are stored in the COMM Register of the emulated device.

  3. RDCOMM

    • The SPI Master reads the values stored in the COMM Register.

 

  • No labels