Hello
I'm trying to control a TMCM-101 module with an Arduino MEGA 2560 controller through the Serial1 port on the Arduino (which is a 5V TTL logic port). The TMCM-101 is powered up and its green LED flashes, I can see the Arduino transmit the bytes on an oscilloscope, but I never get a reply from the TMCM-101 module and the oscilloscope shows no activity on the TMCM's transmit line.
Is there anyway to diagnose the TMCM board to verify that it is not damaged in some way or that it has properly received the command?
The code I'm using on the Arduino programming language (which is a subset of C) is pasted below. Thanks for any tips.
Regards
Ken Johnson
void setup() {
Serial.begin(9600); // PC to Arduino comms
Serial1.begin(9600); // Arduino to Trinamic comms
byte Command[9];
byte Checksum;
char CR=13;
Serial.println("trinamic test");
// command 1 1 0 1 0 0 0 0 chksum
Command[0] = 1; // address
Command[1] = 1; // command rotate right
Command[2] = 0; // type number
Command[3] = 1; // motor number
for(int i=4; i<8; i++)
{
Command[i] = 0;
}
// compute checksum
Checksum = Command[0];
for(int i=1; i<8; i++)
{
Checksum += Command[i];
}
Command[8] = Checksum;
// send the command
Serial1.write(Command,9); // send 9 bytes to Trinamic
// echo commands to PC
for(int i=0; i<9; i++)
{
// Serial1.write(Command[i]);
Serial.print(i);
Serial.print(" ");
Serial.println(Command[i],BIN);
}
//Serial1.write('13');
Serial.println();
Serial.println("waiting for data");
// receive answer
if (Serial1.available()) {
delay(5);
Serial.print('data available');
int inByte = Serial1.read();
Serial.print(inByte, BYTE);
}
}
