CAN operation

7 years 9 months ago #29531505 by rmankumbare
CAN operation was created by rmankumbare
Dear Roboteq,

We are working on defence grade project in which we want to control BLDC motor on CAN bus.

We are using Roboteq MDC2230 driver. We are referring (nxtgen_controllers_user manual, mdc2xxx_datasheet) these documents.

We are also using Roborun + pc utility. By using utility we have managed to run motor successfully in serial mode.

Now we are trying to run the motor using CAN bus, for that we are using NXP's LPC1769 microcontroller. From micro controller we are transmitting frames (refer snapshot of frame). CAN_H , CAN_L,GND are connected to drive .

Right now we are not able to run the motor using CAN bus.

Can you please elaborate frame structure that I shroud use to run motor successfully in CAN mode. Like what ID,data we should transmit to run the motor.

Our ultimate target is to run the motor osing LPC1769 microcontroller on CAN bus.




Attachments:

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

7 years 9 months ago - 7 years 9 months ago #29531506 by LROBBINS
Replied by LROBBINS on topic CAN operation
I'll jump in here as I am using raw CAN to control some brushed motors with an HDC2450. The frame you are sending is fine, but for the controller to "see" it you have to set its configuration (in your case for Raw CAN with bit rate matching that of your sending node) and do some scripting. In particular, you will need to use GetValue (_CF) to know whether a message is in the buffer (that value will be > 0 of there's a message waiting to be retrieved), then GetValue (_CAN, 1) to retrieve the ID of the first waiting message. If you have multiple CAN nodes, you may also want to mask that ID so that the controller pays attention only to certain messages (Roboteq has very limited pre-buffer masking and filtering). Then, you would use
NumData = GetValue (_CAN, 2) to find out how many data bytes are in that frame, and finally use GetValue (_CAN, 3+i) to get the data (looping i for the number of bytes to be retrieved).

I am attaching the RECEIVE_MESSAGE: subroutine from my script. The frames I send contain from 0 to 4 data bytes and the bitwise complements of the data in the remaining bytes. Because the limited pre-buffer masking means that any node in my multi-node setup might sent an ack, and therefore stop re-transmission of the message even if it has arrived corrupted at the intended recipient, these complements of the data are used as a secondary check that the message is intact, and the sending node continues to re-transmit until it gets a "confirm" from the Roboteq. (A similar secondary check tactic is used in some of the "safety critical" flavors of CANOpen.) So this subroutine is a bit more complicated than what's needed in most cases, but it serve as an example of how to script a controller to retrieve CAN frames.

Best of luck with your project.
Ciao,
Lenny

File Attachment:

File Name: RECEIVE_MESSAGE.txt
File Size:2 KB
Attachments:

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

7 years 8 months ago #29531576 by rmankumbare
Replied by rmankumbare on topic CAN operation
Following is our CAN frame prepared using RoboCANman document.

msg1.FrameType= DATA_FRAME;

msg1.IdType = CAN_STD_ID;

msg1.Id = 0X15; // This is 11 bit identifier

msg1.DLC = 8; // This is number of data bytes in 1 frame


Following 8 are payload bytes


msg1.Data[0] = 0x00; //Originating Node

msg1.Data[1] = 0x0D; //Command ID

msg1.Data[2] = 0x14; //Repeat Rate (ms)

msg1.Data[3] = 0x02; //Channel Select (1st Argument)

msg1.Data[4] = 0x00; //Data (2nd Argument)

msg1.Data[5] = 0x00; // Data (2nd Argument):

msg1.Data[6] = 0x00; // Data (2nd Argument):

msg1.Data[7] = 0x00; //Data (2nd Argument):


Our first target is to run motor in forward & reverse direction using CAN of micro-controller.

we having only 1 motor controller. So what should be there in originating & destination nodes?

Is scripting necessary even if I am not using Roborun+ utility?

Please share the CAN frame structure to interface single MDC2230 motor controller with any microcontroller having CAN interface.


Thank you.

My email Id is This email address is being protected from spambots. You need JavaScript enabled to view it.

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

7 years 8 months ago #29531578 by rmankumbare
Replied by rmankumbare on topic CAN operation
our hardware connections shown in attached file & other one is reference manual.

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

7 years 8 months ago #29531580 by rmankumbare
Replied by rmankumbare on topic CAN operation

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

Moderators: tonysantoni
Time to create page: 0.072 seconds