HWML 4-Axis Stepper Motor Controller Interface

SERIAL CONNECTION START
 1. Open serial port at desired baudrate (for example 921600), 8 data bits, no parity, 1 stop bit, no handshaking
 2. Reset Controller
    a. Set RTS off (embedded BSL line high)
    b. Set DTR on (embedded RST line low)
    c. Wait 0.1 second
    d. Set DTR off (embedded RST line high)
 3. Wait 1 second
 4. Send auto-baud initialization char - 0x41 ('A')
 5. Send carriage return char - 0x0D
 6. Receive carriage return char - 0x0D

BINARY COMMUNICATION
Query (from Host to Controller)
 1. Send binary prefix char - 0x00 (one zero byte)
 2. Send command char (one byte from Command Set)
 3. Send four long integer values (4 x 4 = 16 bytes; 0x80000000L (-2147483648) as dummy) in little-endian (Intel) order
Answer (from Controller to Host)
 1. Receive one byte defining the following data size: 0 (0x00) or 16 (0x10)
 2. If data size is 16 then receive four long integer values (16 bytes) in little-endian order
LITERAL COMMUNICATION
Query (from Host to Controller)
 1. Send literal string that includes:
    a. command char (from Command Set)
    b. up to four decimal numbers delimited with comma (','), any number may be omitted
    c. optional comment beginning with semicolon (';')
 2. Send carriage return char - 0x0D
Answer (from Controller to Host)
 1. Receive till carriage return char (0x0D) while getting:
    a. up to four decimal numbers delimited with comma (',')

INTERRUPT DIRECTIVES (from Host to Controller) after sending Query of Execute Queue, while waiting to Answer
Abort (Emergency Stop)
 1. Send Ctrl-A char - 0x01
Break (Pause)
 1. Send Ctrl-B char - 0x02
    if Queue is still running, it will freeze and wait for Continue or Abort or Decelerate and Abort directive
Continue (Resume)
 1. Send Ctrl-C char - 0x03
Decelerate and Abort (Graceful Stop mostly for Jog)
 1. Send Ctrl-D char - 0x04
Velocity Override Decrease by 10% (to min 10%; available any time, not just on Queue Execution)
 1. Send Ctrl-E char - 0x05
Velocity Override Reset (set to 100%; available any time, not just on Queue Execution)
 1. Send Ctrl-F char - 0x06
Velocity Override Increase by 10% (to max 200%; available any time, not just on Queue Execution)
 1. Send Ctrl-G char - 0x07
Report (available any time, not just on Queue Execution)
 1. Send Ctrl-R char - 0x12
 2. Wait for receiving Report data size byte - always 18 (0x12)
 3. Collect Report data (all values are in little-endian order):
    a. Receive two bytes of short integer Queue Run Position (starts from 1 on Queue Execution, otherwise - 0)
    b. Receive four bytes of long integer X coordinate
    c. Receive four bytes of long integer Y coordinate
    d. Receive four bytes of long integer Z coordinate
    e. Receive four bytes of long integer W coordinate

(C) Aryeh Eiderman  < leib @ hwml . com >