I’m sure you have a lot of suggestions but perhaps you can consider moving to the Cypress PSOC 6 platform from the STM32. I was going to do this myself for our own projects but Odrive may consider the advantages. I suggest the dual core M4+M0 Psoc 62 series: https://www.cypress.com/file/385916/download
There are a number of advantages of PSOC for hardware motor control. Namely there are 8x 32bit with hardware quadrature decoders, 24x 16 bit pwm so can easily support 8 axis (eg 1 counter for decoder, 3x pwm for each coil) in hardware. In addition, FreeRTOS is built into Psoc creator.
For those not familiary with Psoc, another advantage is it has programmable digital UDB blocks. Previoulsy we used PSOC 5LP for a lot of projects and it’s super nice to add things like hardware shift registers or lookup tables in hardware (supports Verilog for UDB custom components). It really is similar to having a small easy to use FPGA. In addition, the routing is very flexible and every pin can be used as both analog or digital through the built in Mux.
The Psoc 6 has dual core with shared memory so can dedicate one CPU to things time sensitive or require high performance. However, with so many things programmable in hardware blocks, it would just be easier overall.
It doesn’t look like that chip supports CANbus. Does this SOC have benefits with regards to providing similar interfaces to industrial motor controllers?
Apparently CANBus is coming to another updated PSOC6. It’s already available in PSOC5LP but I have no use for it personally. Canbus is a pretty slow interface. Seems you could just use RS485/LVDS.
Personally, I like PSoC for its flexibility but it is too proprietary for my liking. If I can’t build on Linux with a free & open source compiler ie GCC, then I have a natural sense of nausea.
That said I would appreciate a more powerful mcu on the ODrive. I’d be very interested in a version employing the STM32H7 series which support CAN-FD.
I’ve used and suggested a 5LP in the past. Originally the PSoC 6 wasn’t going to have an FPU I believe(?), so it was pointless to move to it since the STM32 has hardware peripherals for the quadrature and motor timers anyway, so none of that is done in the processor loop.
The PWM output is center-aligned which iirc uses two UDBs per axis, so you get half of what you actually want? That’s might be me vaguely misremembering though.
If you can do 6 axes of incrermental encoder decoding + 6 axis motor timer control with center-alignment and safe shut-off* all in hardware that would make for a really incredible robot arm controller
CANbus is really nice for tying a lot of relatively slow axes together.
*@madcowswe what was the term that STM32 uses for the motor timers that shut off to a safe state? I forget.
With 32x hardware timers which all support quadrature decode you can easily support 6 axes. PSOC has 2x hardware analog comparators and 2x op amps which can kill the PWM directly or with an AND gate. This is quite easy as you just set the hardware DAC to some current that feeds into the hardware compare and the hardware compare will turn off the current if it exceeds it. You can even use the op amp to multiply the voltage but it’s already built in with the TI DRV chip used on odrive. This is way safer than any interrupt routine and an excellent backup to prevent any blown devices.
The remaining 12 UDB can be programmed in verilog to do additional complex features. For example, it’s incredibly easy to do a hardware analog compare of the total current and if it’s to high shut off specific gates and put motor into rapid or slow decay of your choice. Rapid and slow decay can be also be programmed in hardware in Verilog.
PSOC 6 has modbus which is based on eclipse and compiles under linux which I actually hate and much rather use psoc creator.
Since Odrive is using freertos and based on M4 then it should be relatively easy port to PSOC6 which has dual core M4 and M0+.
Programmable logic gates combined with fast processor with programmable analog op amps and comparators really makes for a nice motor controller system.
We already use PSOC 5LP for similar purposes and planned closed loop motor control for PSOC 5LP using fixed point or PSOC6 with floating point.
Didn’t they get rid of most of the analog processing on the PSOC 6? Or did they get enough backlash that they decided to not go with their completely pointless design that everyone was saying they’d skip and just continue buying 5LPs?
We used PSOC 5LP in our products for 3+ years. PSOC5LP is great chip but PSOC6 just has more horsepower. I don’t know what the deal with getting rid of psoc creator and using eclipse but I don’t like it and really main reason we haven’t switched completely. PSOC6 still has all the analog hardware like op amps and comparators etc. It’s 3.3v only since it’s 40microns process. It’s also the same price as psoc 5lp so a good deal cost wise. PSOC6 is pretty dense BGA package only however.