Set control_mode from GPIO

Hello,

Is it possible to map the control_mode into a GPIO input? For example, I would like to change from position_control to velocity_control from a PWM input, such as when under 1500us sets the control_mode as position_control and, over that, sets it as velocity_control.
A simple digital low/ high as input for changing between modes would also work in my case.

Thank you in advance!

Hi - this currently isn’t possible in the firmware. Could you let me know more about your application? It may be simplest for you to have a cheap external microcontroller like an Arduino Nano that receives the PWM input and commands the ODrive over serial.

Hi solomondg,

Thanks for the fast response! What you are suggesting is something we are also considering, but we were looking for a fast and simpler solution. We are already using an external microcontroller, but all its serial connections are being used by other systems and we wanted to avoid adding any other microcontroller.

We also have a CAN connection available in the already used micro and, from the docs, it seems that it’s possible to send most of the serial commands through it. Nevertheless, we only wanted to see whether what I asked was possible before getting to work on integrating the CAN protocol.

I see! Yes, CAN overall is going to be the absolute best solution. Everything possible over USB/UART is also possible over CAN, with the new arbitrary parameter access feature.