tinymovr / Tinymovr

Compact brushless motor controller with FOC, integrated absolute encoder and CAN Bus.
https://tinymovr.com
GNU General Public License v3.0
229 stars 37 forks source link

CAN timing issue #345

Open maxikrie opened 2 months ago

maxikrie commented 2 months ago

Hi,

I am facing an issue where two out of three boards (pixhawk-6c-mini) have an issue receiving data from the tinymovr M5 over CAN interface. I have analyzed the signals and it seems to me that on one hand the edges of the response are not very sharp and also the signal seems to drift, potentially causing the issue?

In any case with all boards the sending part seems to be fine and the tinymovr reacts on the incoming data. I have attached two images of the CAN Lo part of the signal where in the second images the white dots and red crosses show expected defined polarity. It looks like that it is sometimes actually changing polarity in this exact moment.

The canine interface and GUI seem to handle this without a problem and all data is shown in the GUI.

Thanks for your help!

Screenshot from 2024-04-26 18-11-09 Screenshot from 2024-04-26 18-12-07

yconst commented 2 months ago

It seems that the timing issue is due to the internal oscillator drift. This is a known issue, and we are investigating whether to have an external crystal oscillator in upcoming hardware versions.

Nonetheless, it seems that the pixhawk might have different CAN Bus settings to CANine (which, as you mentioned seems to work). It could be worth, if possible, to reconfigure the pixhawk can settings to resemble the ones of CANine: https://github.com/tinymovr/CANine/blob/67da4a52d44cdf5b18b52eae8d0f14d3b56ca3d4/Core/Src/can.c#L71

The edges appear within acceptable limits.