SDC2160N CAN-Node ID

5 years 2 months ago #29530879 by jaghvi
SDC2160N CAN-Node ID was created by jaghvi
I am trying to use CAN for SDC2160N. What is the default node. I am using it with arduino. It works well with RS232 but not CAN.

RS232:
Serial2.print('!');
Serial2.print('G'); // Motor GO command
Serial2.print(' '); // Space
Serial2.print('1'); // Channel Number
Serial2.print(' '); // Space
Serial2.print(200); // Motor Power Value
Serial2.println(); // Motor Power Value

CAN:
unsigned char roboteQ[7] = {'!','G',' ','1' ,' ', 200 ,'\n'};

// send data: id = 0x00, standrad frame, data len = 8, stmp: data buf

CAN.sendMsgBuf(0x01,0, 7, roboteQ);

Please Log in or Create an account to join the conversation.

5 years 2 months ago #29530880 by TechSupport
Replied by TechSupport on topic SDC2160N CAN-Node ID
Which can interface are you using? Different can modes have very specifics that have to be followed to work correctly.
The following user(s) said Thank You: jaghvi

Please Log in or Create an account to join the conversation.

5 years 2 months ago #29530881 by jaghvi
Replied by jaghvi on topic SDC2160N CAN-Node ID
I am using canOpen. I have connected the DB9 connector to my arduino CAN, both trying to communciate at 125kbps.

Please Log in or Create an account to join the conversation.

5 years 2 months ago #29530882 by TechSupport
Replied by TechSupport on topic SDC2160N CAN-Node ID
The can open requires many things. One of them is looking at the header and frames.

Here is a sample script you can run in your controller.

top:
if (getvalue(_CF, 1) > 0) ' if one or more frame is received
Header = getvalue(_CAN, 1)
ByteCount = getvalue(_CAN, 2)
Byte1 = getvalue(_CAN, 4)
Byte2 = getvalue(_CAN, 5)
print(Header,"\t", ByteCount,"\t",Byte1,"\t",Byte2,"\r")
end if
wait(10)
goto top

Please Log in or Create an account to join the conversation.

5 years 2 months ago #29530883 by jaghvi
Replied by jaghvi on topic SDC2160N CAN-Node ID
All I need to send is command velocity, that is it. DO you think the other protocols will be more beneficial.

Thanks

Please Log in or Create an account to join the conversation.

5 years 2 months ago #29530884 by TechSupport
Replied by TechSupport on topic SDC2160N CAN-Node ID
Does your arduino use can mini?

If so, you could have it write to one of the 16 var variable bytes.

In the controller you would have to write a script that can change that velocity command via that value.

So assume we use var 1. Your arduino sets a value to the controller var 1. Also assume open loop mode command 0 to +1000 or -1000.

dim vel as integer
top:
vel = getvalue(_Var, 1)
setcommand(_G, 1, vel)
wait(10)
goto top

Please Log in or Create an account to join the conversation.

5 years 2 months ago #29530885 by jaghvi
Replied by jaghvi on topic SDC2160N CAN-Node ID
The CAN-BUS Shield on Arduino adopts MCP2515 CAN Bus controller with SPI interface

Please Log in or Create an account to join the conversation.

5 years 2 months ago #29530886 by TechSupport
Replied by TechSupport on topic SDC2160N CAN-Node ID
Are you able to send the TPDO?

TPDO1: 0x180 + NodeID
TPDO2: 0x280 + NodeID

Var 1 = bytes 1-4 and var 2 = bytes 6-8
Page 120 of user manual.

Please Log in or Create an account to join the conversation.

5 years 2 months ago #29530887 by jaghvi
Replied by jaghvi on topic SDC2160N CAN-Node ID
Also if you see RoboCAN interface, It is quite simple and elegant. The way I am sending code matches with the way they are sending data.
SetCANCommand(id, cc, ch, vv)SetCANConfig(id, cc, ch, vv)

Where:
id is the remote Node Id in decimal
cc is the Command code, eg _G
cc is the channel number. Put 1 for commands that do not normally require a channel number
vv is the value

Example:
SetCANCommand(04, _G, 1, 500)


unsigned char roboteQ[7] = {'!','G',' ','1' ,' ', 200,'\n'};
CAN.sendMsgBuf(0x01,0, 7, roboteQ);


I am not a CAN expert. Its is my first robotics interface with CAN. So, In case my questions are silly please pardon me.

Please Log in or Create an account to join the conversation.

5 years 2 months ago #29530888 by TechSupport
Replied by TechSupport on topic SDC2160N CAN-Node ID
The Robocan is a proprietary protocol. It is a modified serial protocol that gets converted to can message.

The syntax is @ node id then command

@02!G 1 500
The following user(s) said Thank You: jaghvi

Please Log in or Create an account to join the conversation.

Moderators: tonysantoni
Time to create page: 0.109 seconds