vedderb / bldc

The VESC motor control firmware
2.08k stars 1.31k forks source link

Unexpected sensor port voltage on VESC 6 75V #710

Closed dcodeIO closed 4 months ago

dcodeIO commented 4 months ago

Recently I tried to use yet another ABI encoder with a VESC 6 75V, which didn't work, so I eventually checked voltage levels and found that the encoder needs 5V but was given 3.3V. However, the VESC's sensor port should output 5V in ABI mode:

https://github.com/vedderb/bldc/blob/d61bde5841080dd9a31b76b2968c9ac945db8e3a/encoder/encoder.c#L74-L75

So I became curious and tested the other sensor port modes as well, and to my surprise I got:

Encoder Measured sensor port voltage Should be as per encoder.c
Hall Sensors 3.3V 5V
ABI Encoder 3.3V 5V
AS5047 Encoder 5V 3.3V
AD2S1205 Resolver 3.3V 5V
Sin/Cos Encoder 3.3V 5V
TS5700N8501 Encoder 3.3V 5V
TS5700N8501 Encoder (Multiturn) 3.3V 5V
MT6816 Encoder (SPI) 3.3V 5V
AS5X47U Encoder (SPI) 5V 3.3V
BISSC Encoder (SPI) 3.3V 5V
TLE5012 Encoder (SSC SW) 3.3V 5V
TLE5012 Encoder (SSC HW) 3.3V 5V

As can be seen, on this particular VESC 6 75V, the actual and expected voltage levels appear to be exactly inverted to what encoder.c states. Is this a bug?

Hw: 60_75, Fw: v6.05 Beta 25. The device looks like this one. Perhaps wrong firmware?

dcodeIO commented 4 months ago

Likely answering my own question: When I build and flash 60_75_mk2, the voltages are not inverted anymore. Seeing that in both targets the defines are inverted, that makes sense. So the mk2 FW fits anything that is not an mk1 I suppose :)