• aditya mehrotra.

scout updates: wiring in the CAN system [updates]

Like we saw in one of the previous posts, we will need to do some thinking on how to wire the CAN system because our robot will need a 120ohm termination resistor on the end of the CAN line to work properly. The first thing we will do is figure out if the Arduino CAN Receiver we bought has this terminating resistor because then we can read the CAN Bits we are getting to an Arduino and also terminate the connection! It turns out according to this link above, that there IS a 120ohm terminating resistor!

So first, let's take out all the CAN wires, a USB for the first controller, and one of the Arduino MCP2515_CAN modules.

Now if we look at this, the green wire is CANL and the yellow is CANH. We will use this later when terminating. For NOW, let's just take the controllers and wire them together.

This is what the CAN wires now look like, no termination at the moment just the current system. We're going to add on EACH END of the can system, the Arduino CAN connectors as termination units. We could ALSO jumper the last two sets of can wires will 120 ohm resistors, but this is easier since we have the modules. Cut strip, and screw into the appropriate H/L terminals.

This is what the termination looks like. There's no need to use these modules as CAN Communication will likely happen though the Jetson TX1, but it might be good for a debug port or something later!

setting up some basics in CAN software:

Now we're going to setup some basic stuff in the software regarding CAN. That means setting up the CAN IDs. What I'll now do is plug a battery into the robot, and USB the controller with CAN ID "1" to the windows computer.

When we USB to a computer, we will open the Spark Max Client software and then try to connect to all of the Spark Max Controllers at the same time.

So that doesn't work yet, we're going to go through each device and update the firmware using the procedure in a previous post all to 1.5.1 so all the devices can use USB to CAN so we can see them all at the same time on the computer. All the devices need to be on 1.5.1 so we can update them together or all needed to be on 1.4.0, but since we have one on 1.5, I don't think this is going to work so we will go one-by-one. While we are at it, we are also setting the CAN IDs to that written on the device itself. You may need to restart the device multiple times as well.

In fact we turned off power to devices as well because it may be the CAN network is interring with the controller's updating.

The features of loading the firmware all at one probably work if we're using the regular FRC control system. But we aren't so we're going controller by controller. It's okay, leaving all the default settings, just changing the CAN IDs, not like the last post where we changed some settings that was just to play around. ALL settings to default.

Okay now all the devices have the same firmware and are set to the same configuration parameters. They all have their CAN IDs assigned as well. Now we will turn on main power and see if they all connect to the CAN network!

Okay so when we do this, they don't all appear on a CAN list like I thought they would. It seems USB to CAN is a bit more complicated than this. We will start working on connecting with USB to CAN from my MacBook where we compiled the libraries for USB to CAN and see if we can at least ping/connect-to all the devices to test CAN. For now, I think all the motor controller setup is done!

We may change parameters later based on performance!

#scout #firmware_updates #motors #controllers #updates

0 views0 comments
© copyright 2019 | aditya mehrotra