Spark Max / NEO encoder setup reading NAN

Last week we had a Spark Max controller go “bizarro” on us.

During an afternoon of testing the robot started stuttering during any attempt to drive forward in autonomous. Since is was happening at such a specific time, we assumed it was a recent software change, but reverting back to old code did not help.

Eventually we discovered that one controller was returning NAN for the encoder value and +/- infinity for speed (as displayed on the ShuffleBoard display). We read these values using the Java Api. Outwardly, the motor was running fine, but when the software used the encoder values (in Auto) all hell broke loose.

We initially assumed bad encoder cables or motor failure, but installing a new motor did not help.

Prior to the problem we had set all the motor controllers to Unlimited current protection, but did not like this setting, so we had set them all back. We thought this may have triggered a bad firmware setting, so we went back in and reloaded the firmware and setup the controller in our standard configuration (40A limit) but it did not fix the problem.

Finally we decided to just replaced the Spark Max controller and the problem went away (with the original motor/encoder setup).

Any suggestion to get our controller running again, or is it toast?

Does this mean that during TeleOp the motor ran fine? The Spark Max uses the encoders to drive NEOs, if the encoder cable to the motor was broken physically, the motor would not move.

Also, have you tried reflashing the controller with the latest firmware?

1 Like

I think I answered all those questions…

Yes, the motors ran fine as long as we ignored the encoder values.
Yes, we reloaded the firmware (with what was running fine before)
Yes, We verified that it was not actually the encoder/cable since switching in a new motor provided us with no improvement. I know the motors wont run without the encoder cable plugged in, but I thought it might be one broken wire.

Interestingly enough, when we switched from forward direction to reverse direction, the reported velocity when from + infinity to - infinity… pretty funny really.

Hence my confusion…

We also checked that the position source information had not been switched in the firmware setup.

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