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.
Can you send the deiver station log file? If the file is too big you can send it to [email protected] with a link to this thread. Make sure to include both the .dslog and .dsevents file
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.