How can I interface the Spark max Driver with CAN network?

Hello, I’m working with a Spark max driver with Brushless NEO motor, and I want to control the motor motion through the CAN network. I have a “Kvaser leaf light v2” which attached in image below. My problem what are the frames (messages) that should be sent from “Kvaser” to control the motor.


Thanks for help,

You’ll probably want to reach out to REV directly. Though some people have snooped parts of some messages, the protocol is not considered public. In particular, the FRC-specific safety protocols aren’t allowed to be discussed here.

REV may be able to provide you with an alternate solution to achieve the desired functionality.

2 Likes

I am not sure what you are working on for a project, but an alternative, if you are not able to dig into the communication protocol directly, would be to use a raspberry pi and a CAN compatible Hat that Rev supports natively. My recommendation would be to use the VMX-Pi. It works well (but you do need a specific firmware version on the Spark Max).

1 Like

Thanks for your help :slight_smile:
I’ll communicate with REV.
But where can I find the the parts of some messages (which you talked about)?

I’m working on a robot project and I use the Spark max driver. I need to control the motor by CAN Network from an external controller which has a CAN protocol, So I need to know the needed messages in order to send it from my controller. And the attached image (Kvaser leaf light v2) it is a cable work with USB with a special software, I use it to send a CAN messages to do a test.

Thank you for your response.

As @gerthworm mentioned, you probably will not be able to see the messages directly. Where I would start is the high level of the driver station logs. You will need WPILib installed on a host computer to access them in addition to the aforementioned hardware. If you go the VMX route, take a look at the directions here. The only low-level pieces we have access to are the public API docs. Another thought on a much higher level; you theoretically, could control the spark max directly through USB using their software.

One last thought. If you are not set on the spark max (which our team prefers by far), I am pretty sure the CTRE controllers (and Falcon motors) are compatible with the Hero Development board.

1 Like

Just to reiterate, you have two paths.

  1. Contact REV and see if they will help you with the definitions of the CAN frames they use.
  2. Reverse engineer the CAN frames. Easiest way is to hook up something like Intrepid’s Vehicle Spy, but may be possible in Wireshark as well.

As far as reverse engineering, some of the information here from WPILib docs and this information in REV’s user manual is helpful.

1 Like

Ok. Thank you

1 Like

“…but you have elected the way of pain” - Saruman, in “Lord of the Rings”.

I started down this path and have abandoned my Spark Max/Neo for the time being.
If you do not want to operate within the FRC WPILIB Robot framework and just want to write your own C++ program to control motors, I’d recommend using the Cross The Road Electronics’ motor controllers (Talon SRX) and their SocketCAN support.
I have been able to successfully control motors using a Talon and Victors and various USB to CAN adapters on a Raspberry Pi and Jetson Xavier NX.
Yes, you will still have to use brushed motors, and you will still need a windows PC to set your controller IDs, but I think you will save yourself a lot of frustration, unless someone else in this community has made progress controlling a SparkMax over SocketCAN and can assist you.

1 Like

As others have said, email us to [email protected] We have some information that we can share to help you get going.

You might also be interested in this thread if you have not already seen it.

If you end up learning anything useful from REV, please let us know, as there are others interested in the same topic.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.