SimVimCockpit Plugin

SimVimCockpit plugin and Arduino roles

SimVimCockpit doesn’t require any knowledge of Arduino on the user’s part, and doesn’t require installation of Arduino IDE or any libraries.

Now SimVimCockpit plugin became the most essential part of this interface. It’s a C++ program with about 15,000 lines of code. The Arduino is simply used as a handy and easily accessible device for use as an input/output controller..

The firmware code in the master board is more like a universal “driver” for all output devices and input controller, it’s a written from scratch program for AVR controller, without using any Arduino libraries, and it is changed very rarely (no need to upload it every time when a new plugin version is out).

Now the system can be considered a “cockpit simulator”, not just an input-output interface, because many inputs/outputs are not simply executing some commands or show dataref values, but rather call complex function for specific aircraft system or device (such as SimVim radios).

Data exchange sequence

SimVimCockpit can use either Ethernet (LAN) or USB connection (wich actually used as asynchronous virtual serial interface when USB ports are just used for serial emulation). Communication protocol in SimVim is synchronized with X-Plane frames and FPS timing is used as “strobes” to define the end of each frame (you can see blinking RX LED when USB is used) to more effectively synchronize I/O data and avoid loosing any bit of data packet.

You should know that any plugin that works with external programs / devices can send or receive data no more frequently than the X-Plane frame rate allows. So, if your X-Plane frame rate is 20 FPS for example, it can provide next changed data values for the plugin only in time 50 ms after the previous change.

Start Sequence:

  1. The plugin and controller firmware “find” each other at start, and the plugin establishes connection with the controller.
  2. Plugin – reads all data configuration files, creates all needed variable structures for data, different I/O types and output devices.
  3. Firmware – sends series of configuration requests to the plugin.
  4. Plugin – sends configuration data on every request.
  5. Firmware – configures controller ports for inputs/outputs, saves received parameter options for input/output environment. Data sending is blocked for plugin in this time.
  6. Firmware – sends current states of all inputs (switches, analog axis). Allows the plugin to send data and waits.
  7. Plugin – sends all current output values in one packet (or several, in the following X-Plane frames).
  8. Firmware – sends all received data to output functions ( LEDs, displays, gauges).

Work cycle:

  • Firmware tracks and stores all configured inputs, and waits for a strobe signal or data packet from the plugin. When the strobe/data is received, the firmware sends only the changed input states (switch/button positions, analog axis positions, encoders step count), to the plugin.
  • In every X-Plane frame, the plugin processes received data, checks all assigned conditions to disable, enable or change inputs parameters and sends all changes to X-Plane – executes commands , changes datarefs or calls some custom SimVim functions.
  • Then plugin reads data from the X-Plane variables accordingly with configuration, checks all assigned for outputs conditions (to disable, enable or change the source for some outputs) and sends output data packet to the controller. Only data that changed since the last frame are sent. If there were no changes in output data, only the strobe signal is sent.
  • SimVim firmware can potentially send data with the speed of 1000 times per second but sends them in every X-Plane frame (it’s X-Plane’s limitation – the plugin can send and receive data only with the frequency of X-Plane frame rate). In our earlier interfaces the firmware always sent data as soon as there were changes, and it could result in much redundand data when dealing with fast encoder rotation or analog input noise, especially if X-Plane had low framerate. Now, this data is only sent when requested by the plugin.