CAN SPARK MAX Errors

Hi all,

While testing my new basic drive train code on our new chassis, I encountered an error with our SPARK MAX. I deployed code to the robot successfully but I continuously got the errors in the RIO log:

  • [CAN SPARK MAX] timed out while waiting for Periodic Status 0
  • [CAN SPARK MAX] WPILib or External HAL Error: CAN: Message not found.

(In Driver Station, these same errors came up but with Error Codes of 2 and 4 attached, I’m not sure at the moment which was which).

I updated all the SPARK MAX to 1.5.1 via USB-C, changed the CAN IDs from 20-23 to 1-4, and still, the error has persisted. I don’t think there is anything wrong code-wise as it builds correctly and deploys without any problems but I’m also relatively inexperienced with making a tank drive train with SPARKs. Here’s the current src file: https://github.com/lizzigan/loki2020.

One of our mentors went over the CAN wire connections and haven’t found any problems with them. I, myself, do not know that much about electronics but since the Spark MAX all successfully got the firmware update from one USB-C connection, I imagine that the connection isn’t broken. I’m not sure where to go from here in terms of troubleshooting the problem, and so any suggestions would be appreciated.

Thank you.
Team 219 Programming Captain

Can you send the deiver station log file? If the file is too big you can send it to support@revrobotics.com with a link to this thread. Make sure to include both the .dslog and .dsevents file

Here are both of those files, thank you.

2020_01_13 18_53_34 Mon.dslog (209.5 KB)
2020_01_13 18_53_34 Mon.dsevents (402.2 KB)

Make sure you don’t have two CAN devices sharing a single address.

So looking closer at your code I was able to recreate this issue. It looks like you create two instances of the DriveTrain() object, which creates two CANSparkMax objects with the same ID. Removing the second instance of the object resolved the issue.

Here are the two locations:

I am looking closer at why this causes this error in particular and improving the warning shown. For now removing the second object creation should fix the issue.

2 Likes

Thank you! That did get rid of the error with the CAN IDs!