Interfacing an Arduino MEGA 2560 to a TMCM-101

Interfacing an Arduino MEGA 2560 to a TMCM-101

Postby Ken Johnson » 04 Jan 2011, 21:03

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);
}
}
Ken Johnson
User
User
 
Posts: 2
Joined: 04 Jan 2011, 20:06

Re: Interfacing an Arduino MEGA 2560 to a TMCM-101

Postby Olav Kahlbaum (TRINAMIC) » 05 Jan 2011, 09:14

Please make sure that the address pins (pins 31, 33, and 35) of the TMCM-101 module are all pulled low so that they will not affect the address of the module. Otherwise the address of the module might not be 1 (have you already tried the module with a PC and the TMCL-IDE?). Please also bear in mind that the serial interface pins of the TMCM-101 module work with TTL (5V) level, they do not have a level shifter.
In your program I can see only one mistake: the motor number must be 0 and not 1 (Command[3]=0 and not Command[3]=1).
User avatar
Olav Kahlbaum (TRINAMIC)
Site Admin
 
Posts: 3365
Joined: 11 Aug 2006, 08:02

Re: Interfacing an Arduino MEGA 2560 to a TMCM-101

Postby Ken Johnson » 06 Jan 2011, 00:55

Thank you. Pulling the address lines down fixed the problem. Interestingly, if I don't pull the lines down, I found that I can communicate with the module at address 8.

Thanks again for your help.
Ken Johnson
Ken Johnson
User
User
 
Posts: 2
Joined: 04 Jan 2011, 20:06

Re: Interfacing an Arduino MEGA 2560 to a TMCM-101

Postby Olav Kahlbaum (TRINAMIC) » 06 Jan 2011, 09:38

That's good news, thank you. When all address lines are ope, they will all be high (internal pull-up), which makes 7, and 1 is added to the address formed by the address lines. So this makes 8.
User avatar
Olav Kahlbaum (TRINAMIC)
Site Admin
 
Posts: 3365
Joined: 11 Aug 2006, 08:02

Re: Interfacing an Arduino MEGA 2560 to a TMCM-101

Postby eddy » 30 Jan 2012, 19:22

Hallo im working also with arduino but i just want to drive high current stepper Motors, (5 A) i have many cool programms in arduino and vvvv but i want to buy a high powered stepper driver, (es wäre toll wenn ich mit mein einige software and microkontroller arbeiten könntet) could you say me wich of your products could be nice?
danke danke..
thanks.
MFG.
EDDy
eddy
Newbie
Newbie
 
Posts: 1
Joined: 30 Jan 2012, 18:51

Re: Interfacing an Arduino MEGA 2560 to a TMCM-101

Postby Olav Kahlbaum (TRINAMIC) » 31 Jan 2012, 08:40

I think that for driving a 5A stepper motor the TMCM-142 would be the nicest solution.
User avatar
Olav Kahlbaum (TRINAMIC)
Site Admin
 
Posts: 3365
Joined: 11 Aug 2006, 08:02


Return to General Basics / Terminology / Getting started questions

Who is online

Users browsing this forum: Google [Bot] and 2 guests