Viability of changing firmware to run my code

I’ve been using ODrive mainly from raspberry pi and arduino because my only project so far was a rotary table controller (ie. rotate the table to a specific angle). It doesn’t need to be fast, so I didn’t have to worry about performance, specifically communication performance, at all.

Recently I started thinking about converting my cargo bike to an e-bike, but I would like to play with custom motor controller. I was thinking about using ODrive for that purpose, but I see a few limitations in controlling it from another board:

  • I would have to use two boards instead of just one (ie. odrive plus arduino or something else to control odrive). not a huge deal, but it adds one more point of failure
  • communication overhead might become an issue. I’d like to use a torque sensor and while I think it doesn’t necessarily need an instant response, I want it to be as smooth as possible
  • using a communication protocol instead of just directly controlling odrive from firmware seems like a coding overhead

Because of that my plan was to extend the firmware and to add my code directly there. Has someone done stuff like that? Are you aware of any projects with available source that achieved it? I haven’t got time to look into the source code thoroughly yet, so maybe it’s not hard, but having a proof of concept would certainly help.