Controlling ODrives with a microcontroller using C

Hi folks,

I’d like to know if it’s possible to have an ARM microcontroller (master) communicating to multiple ODrives (slaves), by making use of existing C libraries. I find the Python interface very easy to use, and would basically like to use its C skeleton, or any other existing C libraries, via an API with the microcontroller.

Any suggestion about the communication protocol/medium (UART etc) that would make the problem easier to solve is very welcome.

Thanks in advance!

Are you saying you want to use something different than an arduino or teensy?

With either, you would be able to control multiple odrives at a time.

Check the link below for how he combines odrive with arduinos.

We currently support UART and USB, as well as CAN (development, under test) and I2C (requires some minor hardware modifications). Take your pick :slight_smile:

Hi,

Thanks for the answer. I actually already saw in your documentation that you have several supported protocols/media. What I wondered is whether any of them is also supported by a C library that can be run in a (let’s be specific) Atmel SAMD21 family of microprocessors.

Something that could make me just worry about the API the same way we can do with Python:

include <magic_library_to_communicate_with_odrive.h>
motor_id = initialize_motor( protocol_address ) // Very vague example, sorry
motor_position_setpoint( pos, motor_id ); // Once motor exists in my code, use API to interact with it

It doesn’t need to be something developed by ODrive, but could also be an existing (for example) CAN library that can generically support the work. What I’d like to avoid is the hardcore development of all bit-by-bit communication to control the ODrive.

Thanks in advance!

Ahhh ok. Uhh honestly I would recommend a Teensy. It has a very easy to use CAN library called FlexCAN. If you would prefer to avoid the Arduino API, pick up a CAN breakout board that uses an MCP2515 - there’s a million libraries for them. That being said, you’ll still have to write the API for ODrive comms on your side.

The most thorough API we have right now (besides Python) is the ASCII over UART that is being implemented by our Arduino library.

Hey,

Thanks. We had a look at the MCP2515. Perhaps we will try to use that, or a similar device, to get CAN capabilities on our microcontroller. The API shouldn’t be too big of a problem, given that the CAN messages seem well documented. Extra work to do though. I got spoiled from the world of open source projects by now :wink:

Very pleased with your prompt reactions anyway! Thank you