Hall encoder illegal hall state

I have a different type of problem with error_illegal_hall_state.

I have a hobbysky motor with hall sensors.
The sequence on the encoder output is (a snippit of arduino code)
byte dat[3] ={{0,0,0},

I verified this using an arduino to read the pins. The encoders do require a pullup resistor. I’m using 10 k when I did the test.

Oskar’s post suggested that the odrive software considers the 000 and 111 lines to be an error – an illegal value.

So, what I’m hoping for is either an existing workaround that doesn’t involve putting an arduino in the middle to translate, or a pointer to the code that reads and does the verification.

I’ve done quite a bit of programming, but not in c++ and reading the files has been a bit of a challenge for me. A pointer to the file(s) involved in handling the hall sensors, and then perhaps a bit of coaching on how the current code works would probably be sufficient. Someone who, after I read on the files for a bit would be willing to have a dialog.

An existing method of coping would be much preferred of course.
Thanks in advance,
Jim Hurlburt
Bend, Oregon

Reading encoder.cpp

Would it work to have a ALT_MODE_HALL that used a decode_alt_hall function that used the above sequence for the hall sensor outputs?

Where does hall_state_, used in Encoder::update() come from?

Does the calibration routine handle different arrangements of the three sensor wires? Or do they have to be in a specific order?

If the software handles somewhat random arrangement of the sensor wires, how does it determine which direction the motor is rotating?

Am I even asking questions in the right manner?

Jim Hurlburt

Hi Jim,

Just curios, where did you get this info from?

In a thread started 7/18 – Encoder error ERROR_ILLEGAL_HALL_STATE

I also confirmed it in Firmware/MotorControl/encoder.cpp
static bool decode_hall()


Aha OK, seems I’ve missed this post.
I had the same (similar) question and if you go into the discord server, there you will find the easy solution, and the actual cause for those readings.


Thank you.
A bit more detail about “go into the discord server” , and where to find “the easy solution”?

I’m not pretty sure about how it goes, but you should receive an invitation to the discord.
Best to contact the admin staff for further information :slight_smile:


I had to get some sort of discord membership to post on this group.
Is there some deeper membership needed?

Some sort of expanded clue about what I am looking for on that site would be appreciated.