API

USB / UART API to communicate with the Brushless DC Motor Controller

The communication protocol is based on ASCII encoding.

Motor Command Parameter

The motor command is set by sending the following message: $!MC:value\r\n where the value range is listed in the table below.

Run-time Parameters

The following parameters are sent as either feedback messages or status messages.

Feedback message structure

The device transmits a feedback message regularly with 50 ms interval (freq. 20hz).

The format: &f:FC:MCC:MRPM:CRC16\r\n. The minimum size is 12 bytes, the max is 40 bytes.

Status message structure

The device transmits a status message regularly with 200 ms interval (freq. 5 hz).

The format: &s:MSTAT:MVOLT:MTEMP:MC:MERR:CRC16\r\n. The minimum size is 18 bytes, the max is 36 bytes.

CRC calculation

CRC16 is applied to the feedback and status messages.

Polynomial: 0x1021. Initial value: 0xFFFF.

The crc16 value is calculated over the start of the message byte and all the data. For the feedback message it covers &f:FC:MCC:MRPM, for the status message: &s:MSTAT:MVOLT:MTEMP:MC:MERR. First the string message (in ASCII) is prepared with the crc16 appended at the end.

Calculated crc16 is simply added as another data parameter to the end of the status or feedback.

Configuration Parameters

Any configuration parameters could be set by using the following command: $!conf_param_Code:value\r\n

For example, to set the motor acceleration rate the following command is used: $!MAC:25000\r\n. An a out of range value is ignored by the firmware. To save any configuration changes into FLASH memory please see maintenance commands.

The command to read / output configuration parameters is: $?conf_param_Code\r\n.

For example, the command to know the current value of motor acceleration rate is: $?MAC\r\n (the result from the motor controller will be &?MAC:value ).

The command to request all configuration parameters is: $??\r\n

Maintenance commands

A maintenance command is called by sending the following message: $^cmd_name\r\n

Where cmd_name can be found from the table below.

For example, the command $^MVER\r\n is used to request the version of the motor controller.

Last updated