MOTOR CONTROL AGENT – MCA

The upper software layer of the Motor Control FPGA IP is based on the AXI4-Lite IP interface , which provides a simple and reliable connection to MicroBlaze, Zynq, and ZynqMP processors.

Moving from the hardware domain to the software domain, two main options are available: Bare-Metal and Operating System.

BARE METAL

The software is developed using the AMD Vitis toolchain in the C programming language.

The Board Support Platform (BSP) provides drivers for the Motor Control FPGA IP and the Power Board FPGA IP.

Supported CPUs include: MicroBlaze, Zynq (Cortex-A9), ZynqMP (Cortex-A53, Cortex-R5).

Main implemented functions:

  • interface with Motor Control and Power Board FPGA IPs via 32-bit memory-mapped registers
  • tiny UDP/IP protocol with minimal RAM usage (server side of the MCM protocol)
  • lightweight CLI over UART 115200-8-N-1
  • uses a single ARM core (Zynq/ZynqMP) or a single MicroBlaze instance
  • requires a hardware timer (AXI Timer for MicroBlaze; PL Timer for Zynq/ZynqMP)
  • requires an Ethernet MAC (AXI EthernetLite for MicroBlaze; PL MAC for Zynq/ZynqMP)
  • interrupt-free design: all operations run in polling mode with no live loops
  • remote QSPI flash read/erase/program (single-chip interface supported)
  • extendable to include custom embedded-application logic
  • for Zynq, code may run from QSPI flash or OCM, with or without external DDR

The Bare-Metal MCA is provided as open-source code and may be freely used or modified when used together with QDESYS IP.

LINUX OPERATING SYSTEM

Under Linux, access to FPGA PL peripherals requires a kernel driver.

The AMD/Xilinx PetaLinux Tools provide a straightforward procedure to build the Linux boot image and root filesystem using the PetaLinux BSP and the Vivado XSA descriptor.

QDESYS supplies the following Linux software components:

  • qmfoc.ko — loadable kernel module
  • libqmfoc.so — shared library
  • qmfocctl — command-line utility

qmfoc.ko features:

  • initializes data structures using the device tree generated by PetaLinux
  • implements a UDP/IP server protocol compatible with the MCA Bare-Metal software
  • direct access to Motor Control IPs through standard Linux interfaces (open(), close(), ioctl())
  • background thread for periodic tasks, including temperature reading and watchdog supervision

libqmfoc.so features:

  • read/write of motor-configuration XML files
  • math compiler converting engineering parameters into FPGA register values
  • supports configuration of qmfoc.ko using the Vivado XSA file (alternative to DT-based mode)
  • exports the same API used by the MCA remote GUI DLL
  • Python wrapper functions (for scripting and automation)

qmfocctl features:

  • configures qmfoc.ko using a Vivado XSA hardware file

QNX OPERATING SYSTEM

  • Under QNX, the same AMD Vitis BSP and U-Boot/device-tree are reused. The software driver is implemented as a QNX Resource Manager, providing the same library API and user-interface model as the Linux version.