Simulating_A_Hm2_Eth_Driver - rmu75/linuxcnc-wiki GitHub Wiki


date: '2025-08-03T12:04:18' title: Simulating A Hm2 Eth Driver

Components for Simulating Hardware in LinuxCNC

In some situations, it�s useful to simulate hardware rather than testing directly on a real machine. Especially when programming new routines where hardware could be damaged when something fails. This github-repository (link on buttom of page) provides components and configuration examples to create a realistic simulation environment in LinuxCNC, using your existing .ini and .hal files.

The goal is to reuse your actual machine configuration and detect hardware availability on startup. During startup the ip-address of the mesa-card is pinged, and in case of no replay the simulation component is loaded.

This is especially useful for:

  • Testing configurations without physical hardware
  • Running LinuxCNC on a virtual machine
  • Developing or debugging HAL logic
  • Teaching or learning LinuxCNC without access to physical machines

The mock of the 7i76e currently supports the configuration of the card with parameters: e.g. "num_encoders=1 num_pwmgens=1 num_stepgens=3 sserial_port_0=20xxxx".

On the github page you also find a detailed list of currently mocked and stubbed Pins and Parameters

    <b>Note:</b> Let me know if you need Pins and/or Parameter stubbed/mocked to be able to simulate your machine.
    Stubbed Pins / Parameters: These connectors exists for wiring but no additional logic included in component.
    Mocked Pins / Parameters: These connectors are contains simulated logic

I tried to write the component in a generic way, so it should be quite easy to add missing pins or even adapting a 7i95 or 7i96 card.

Hardware Simulated

This project currently includes simulation support for:

  • Mesa 7i76e card
  • Touch probe
  • Laser fork light barrier
  • Simple virtual objects (ring and quad workpieces)
  • Limit and home switches
  • Emergency stop
  • Spindle ready signal

Idea and Workflow

    Use the same .ini and .hal files for both real and simulated machines.
    At startup, a Tcl script checks whether the hardware is reachable (via ping).
    If not reachable, the mocked version (component) of the hardware is loaded.
    Additional simulation components can then be included based on this logic.

For details and latest version, please checkout the github project page on: https://github.com/pkl42/linuxcnc_components_sim

⚠️ **GitHub.com Fallback** ⚠️