I have come back to this and I’m getting some really weird behaviour.
I have been using incremental mode for a while now with no problems at all (that I can see) so I’m pretty sure it’s specific to this SPI problem.
I am currently unable to run the AXIS_STATE_FULL_CALIBRATION_SEQUENCE
all the way through because spi_error_rate
jumps too high. So I have followed all the suggestions I could find on this thread and others to try to reduce noise.
To be specific, I have tried
- using 3.3V instead of 5V, making sure to use the same header as the SPI wires use.
- putting resistors in series with the SCK line. (I tried 10R and 100R, only having one of each, and not having anything between 20R-50R.)
- disabling the error bit check in the firmware as @grahameth did.
- increasing the
spi_error_rate
threshold to 0.5 as @towen did.
- replacing the five SPI wires with fatter cables, and braiding them together.
- improvising a ferrite ring and wrapping the motor cables around it.
- tying the metal chassis to ground
What I’ve noticed as I was trying these is that for a few moments, each change would appear to be an improvement. Then, all of a sudden, that improvement would be ‘undone’.
This was especially noticeable with the ferrite ring. There, the error rate fell to pretty much zero. It stayed that way for one or two first-halves of a calibration cycle (which wasn’t finishing due to an unrelated config error I found and fixed.)
But then, all of a sudden, it was as if everything suddenly went back to its pre-ferrite-installation behaviour. Ie - the error rate shooting up straight away and the calibration cycle erroring out with ENCODER_ERROR_ABS_SPI_COM_FAIL
I had made no changes at all to cause this. I was simply running odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE
followed by dump_errors(odrv0,True)
over and again, just as I had been before.
Then I tried it again after a ten minute pause, and found that it “worked badly” for one single run, then resumed not working at all after that. By “working badly”, I mean the spi_error_rate
got worse and worse, but at a slower rate than it had been. By not working at all, I mean the spi_error_rate
shoots up over the threshold straight away.
Further testing confirms that I can reliably get one single bad half-run, if I wait ten minutes after the last failure, and any subsequent tries (without waiting) end in immediate failure.
Here is a screenshot of the “bad but trying” calibration run: (Sorry for the poor quality.)
spi_error_rate
is orange, pos_estimate
is blue. 0.5 is the post-@towen bomb-out threshold for the spi_error_rate, so once the orange line gets higher than that the Odrive errors out. I don’t know why the pos_estimate is glitching out like that, unless comms noise is able to do that.
Here is a screenshot of what you get every time, if I run the calibration cycle again without waiting for ten minutes:
Sometimes the pos_estimate glitches - the pedals barely twitch but it reports a large turn:
Does anyone have a clue what might be going on?
Immediately after installing the ferrite ring, that orange line was totally flat, and now suddenly it’s acting like this. I am doubting my sanity here.