smathis 25286652d5
Some checks failed
Test And Build / Lint (push) Failing after 3s
Test And Build / Build (push) Successful in 7s
Moved version definition in Makefile
The expected version can now be set in the Makefile via USR_CXXFLAGS.
Additionally, the README.md has received documentation regarding the
version check. Lastly, the version check can now be disabled by omitting
the flags or setting one of them to a negative value.
2025-08-22 13:18:43 +02:00
2025-07-04 14:18:44 +02:00
2025-08-22 13:18:43 +02:00
2025-04-17 16:50:42 +02:00
2025-02-17 09:31:35 +01:00
2025-08-22 13:18:43 +02:00
2025-08-22 13:18:43 +02:00

masterMacs

Please read the documentation of sinqMotor first: https://git.psi.ch/sinq-epics-modules/sinqmotor

Overview

This is a driver for the masterMacs motion controller with the SINQ communication protocol. It is based on the sinqMotor shared library (https://git.psi.ch/sinq-epics-modules/sinqmotor). The header files contain detailed documentation for all public functions. The headers themselves are exported when building the library to allow other drivers to depend on this one.

Compatible to MasterMACS software 2.0.0.

User guide

This driver is a standard sinqMotor-derived driver and does not need any specific configuration. For the general configuration, please see https://git.psi.ch/sinq-epics-modules/sinqmotor/-/blob/main/README.md.

The folder "utils" contains utility scripts for working with masterMacs motor controllers:

  • decodeStatus.py: Take the return message of a R10 (read status) command and print it in human-readable form.
  • decodeError.py: Take the return message of a R11 (read error) command and print it in human-readable form.
  • writeRead.py: Send messages to the controller and receive answers.

Developer guide

Usage in IOC shell

masterMacs exposes the following IOC shell functions (all in masterMacsController.cpp):

  • masterMacsController: Create a new controller object.
  • masterMacsAxis: Create a new axis object.

The full mcu.cmd file looks like this:

# Define the name of the controller and the corresponding port
epicsEnvSet("NAME","mcu")
epicsEnvSet("ASYN_PORT","p$(NAME)")

# Create the TCP/IP socket used to talk with the controller. The socket can be adressed from within the IOC shell via the port name
drvAsynIPPortConfigure("$(ASYN_PORT)","172.28.101.24:1025")

# Create the controller object with the defined name and connect it to the socket via the port name.
# The other parameters are as follows:
# 8: Maximum number of axes
# 0.05: Busy poll period in seconds
# 1: Idle poll period in seconds
# 1: Socket communication timeout in seconds
masterMacsController("$(NAME)", "$(ASYN_PORT)", 8, 0.05, 1, 1);

# Define some axes for the specified MCU at the given slot (1, 2 and 5). No slot may be used twice!
masterMacsAxis("$(NAME)",1);
masterMacsAxis("$(NAME)",2);
masterMacsAxis("$(NAME)",5);

# Set the number of subsequent timeouts 
setMaxSubsequentTimeouts("$(NAME)", 20);

# Configure the timeout frequency watchdog:
setThresholdComTimeout("$(NAME)", 100, 1);

# Parametrize the EPICS record database with the substitution file named after the MCU.
epicsEnvSet("SINQDBPATH","$(masterMacs_DB)/sinqMotor.db")
dbLoadTemplate("$(TOP)/$(NAME).substitutions", "INSTR=$(INSTR)$(NAME):,CONTROLLER=$(NAME)")
epicsEnvSet("SINQDBPATH","$(masterMacs_DB)/masterMacs.db")
dbLoadTemplate("$(TOP)/$(NAME).substitutions", "INSTR=$(INSTR)$(NAME):,CONTROLLER=$(NAME)")
dbLoadRecords("$(masterMacs_DB)/asynRecord.db","P=$(INSTR)$(NAME),PORT=$(ASYN_PORT)")

Versioning

Please see the documentation for the module sinqMotor: https://git.psi.ch/sinq-epics-modules/sinqmotor/-/blob/main/README.md.

Firmware version checking

This driver expects a certain version of the firmware running on the controller itself. This is checked at IOC startup by reading the version directly from the hardware. If the firmware version is incompatible to the driver, the IOC will be shut down. If the firmware version cannot be read (e.g. because the variable used to do so does not exist yet on old firmware versions), the firmware is assumed to be compatible to the driver.

The version check is separated into a check of the major and the minor firmware version against expected values. The firmware is seen as compatible if the following conditions hold:

  • Read-out major version == Expected major version
  • Read-out read major version >= Expected minor version

The expected versions are defined via compiler flags in Makefile:

USR_CXXFLAGS += -DFIRMWARE_MAJOR_VERSION=1 -DFIRMWARE_MINOR_VERSION=0

Be aware that these flags are only used to compile C++-files (.cpp, .cxx) and not C-files (.c). For C-files, the Makefile variable USR_CFLAGS must be used.

In order to disable the checks, the flags can be set to -1 or just be removed entirely. If one of the flags is not given, both the major and the minor version checks are deactivated.

How to build it

Please see the documentation for the module sinqMotor: https://git.psi.ch/sinq-epics-modules/sinqmotor/-/blob/main/README.md.

Description
Driver for the SINQ masterMacs motion controller family
Readme 363 KiB
Languages
C++ 83.6%
Python 15.3%
Makefile 1.1%