Courtesy of ChatGPT o3:
byte index what TMCL expects (RS-485 / RS-232) what your code sends
0 module address OK (0x01)
1 command number OK
2 type / parameter number you put the motor here
3 motor / bank you put value-MSB here
4-7 32-bit value (MSB first) shifted one byte to the left
8 checksum (sum of bytes 0-7) you write 0x00, checksum is at byte 7
Because of the mis-alignment the checksum that finally lands in byte 8 is wrong, so the module answers with
status 0x01 = “wrong checksum” – not “invalid command”
Analog Devices
.
Correct 9-byte frame
- address
[1] command
[2] type / parameter
[3] motor or bank
[4] value >> 24
[5] value >> 16
[6] value >> 8
[7] value
[8] checksum (sum of bytes 0-7, 8-bit)
``` :contentReference
[oaicite:1]{index=1}
Example for **ROR motor 2 speed 350** taken from the manual:
01 01 00 02 00 00 01 5E 62
byte 2 is just a “don’t-care” type for ROR/ROL, so it is 0 :contentReference[oaicite:2]{index=2}.
---
### Fixing your code
```csharp
private void SendTMCLCommand(byte command,
byte type, // new!
byte motorOrBank,
int value)
{
if (_serialPort == null || !_serialPort.IsOpen) return;
var tmcl = new byte[9];
tmcl[0] = 0x01; // module address
tmcl[1] = command; // command number
tmcl[2] = type; // parameter / type
tmcl[3] = motorOrBank; // motor or bank
tmcl[4] = (byte)(value >> 24);
tmcl[5] = (byte)(value >> 16);
tmcl[6] = (byte)(value >> 8);
tmcl[7] = (byte)(value);
// checksum over bytes 0-7
byte checksum = 0;
for (int i = 0; i < 8; i++) checksum += tmcl
;
tmcl[8] = checksum; // <-- last byte!
_serialPort.DiscardInBuffer();
_serialPort.Write(tmcl, 0, 9);
...
}
Using it in your test routine
byte m = 0; // motor 0
// Read firmware version -> GGP, param 70 (example)
SendTMCLCommand(0x0A, 70, 0, 0); // GGP 70, bank 0
// Set acceleration (SAP param 5)
SendTMCLCommand(0x05, 5, m, safeAmax);
// Set max current (SAP param 6)
SendTMCLCommand(0x05, 6, m, safeCmax);
// Rotate left (ROL)
SendTMCLCommand(0x02, 0, m, safeVmax);
// Stop (MST)
SendTMCLCommand(0x03, 0, m, 0);
(There is no “ENA” command 0x0B; 0x0B is STGP. Driver enable is usually axis-parameter 255 or a GPIO pin.)
After these changes the module should reply with status 0x64 (100 decimal) = OK.
Quick checklist
Symptom Fix
Status 01 checksum wrong – write it to byte 8
Status 02 command byte invalid (e.g. 0x00 or 0x0B)
All commands “wrong type” check the type/parameter byte (byte 2)
Still no motion make sure motor power is on and parameter Max Velocity / Acceleration / Current are sane
This packet layout is identical for every TMCL module, including the TMCM-1290
Analog Devices
. Once the frame is built exactly as above you should see the motor rotate just like it does from the TMCL IDE.