Serial protocol
Protocol frame specifications
Serial protocol Explanation of frame/field separator bytes:
- STX = (0x02) Hex (frame data telegram start)
- ETX = (0x03) Hex (Frame data telegram end)
- FDT = (0x3B) Hex (field separator semicolon)
Every message sent or received by the module must be enclosed between STX (start transmission) and ETX (end transmission) markers in order to avoid misinterpretation and maintain consistency.
Commands
Command | Description | Action |
---|---|---|
r | Soft reset | The module will reset its state |
SR | Read all input ports | The module will send all input values separated by semicolons (FDT) |
SAxxxx | Write port X12 | The module set the port X12 pulse value to xxxx microseconds (µs) |
SBxxxx | Write port X13 | The module set the port X13 pulse value to xxxx microseconds (µs) |
SCxxxx | Write port X14 | The module set the port X14 pulse value to xxxx microseconds (µs) |
SDxxxx | Write port X15 | The module set the port X15 pulse value to xxxx microseconds (µs) |
Reading inputs
Jumper X10 not set
When the jumper X10 is not set, the input values have to be read manually by requesting them through a serial command.
Example: (get all input values)
[STX] [S] [R] [ETX]
the module will return a message similiar to this: (blanks are added for clarity)
0x02 1500;1500;1500;1500;1500; 0x03
being semicolon separated PWM values respective of X1, X2 ,X3 ,X4 ,X5.
The possible input values range from 700µs to 2300µs.
Jumper X10 is set
In case the X10 is set, the module will send the message above with a frequency of 50Hz
Writing to outputs
Example: (Output PWM 1500µs to Servo 'A' / port X12)
[STX] [S] [A] 1500 [ETX]
here as an ASCII string: (blanks are added for clarity)
0x02 SA1500 0x03
The same example in C (simplified)
char PropTxUartBuffer[8];
PropTxUartBuffer[0] = 0x02; // STX
PropTxUartBuffer[1] = ’S’;
PropTxUartBuffer[2] = ’A’;
PropTxUartBuffer[3] = ’1’;
PropTxUartBuffer[4] = ’5’;
PropTxUartBuffer[5] = ’0’;
PropTxUartBuffer[6] = ’0’;
PropTxUartBuffer[7] = 0x03; //ETX
Serial.print(PropTxUartBuffer); //this heavily depends on the serial port implementation
The possible output values range from 700µs to 2300µs. Everything below or over those is capped by the module to the nearest admitted value e.g 2310 becomes 2300.