STM32 is similar. Older models have CAN peripherals, newer ones have FDCAN. They need an external tranciever to take the digital RX/TX signals to the differential CAN lines.
I would aim for only this kind of support, and leave it to those who want to use them to implement the CAN controller SPI code.
On the one hand I think 6 motors is more than enough from an ESC board point of view - I don’t really know of any MCUs that can do more than 4 motors in 6-PWM. Also from the point of view of speed and reading all the sensors and currents it seems quite unrealistic.
But I was thinking more along the lines of things other than ESCs as well. Since CAN is a bus, there might be other sensors and “brain” components on there too. What if you do a topology where a robot controller is in charge of 20 motors - not directly driving them itself, but forwarding the CAN messages. Or a “snake” robot with lots of segments - they mightn’t all have their own CAN controller.
I wasn’t able to articulate it very well, but I was trying to argue for a more flexible approach in this regard.
I’m still thinking on that. Basically star topologies aren’t really supported due to the termination. You should really have a long terminated “bus line” with short unterminated “node lines” to each node. Diverging from this will affect the bus speed you can achieve. But in my kind of robot, the bus is so short anyway it probably won’t be an issue no matter how you wire it up.
Star topologies are supported with hubs, but that is something I would avoid. My robots don’t want a CAN-hub.
So I would include optional termination on each node, and probably provide 2 CAN “ports” to the same lines, so the bus is built up by connecting from node to node with cables that have plugs on both ends. The two end nodes get their termination option switched on and the bus is up and running!
You are absolutely correct! In this case I was thinking more about the protocol definition and not really about implementing the functionality
(someone else’s problem?)
I think its ok to define the protocol with a bit of ambition, as long as there is a simple way to implement it for simple cases - e.g. the parameterised version could be specified in the protocol, but the actual ESC could ignore the actual name parameter and work with only one settings.
And as for the implementation itself, for ESP32 it will be quite easy, I think. But as you point out, there is no clear definition of what needs to be saved. Some users may want to save a lot more than just the motor alignment, e.g. PIDs, or even user settings.
And on other MCUs there may not be a NVRAM or writeable flash, and you might have to use an EEPROM or similar external chip.
For all these reasons I would leave the settings saving as a kind of open thing, where SimpleFOC defines stub functions (or classes) that the user has to implement in the end. The examples could then contain sample code for some common cases (like ESP32 writing to flash) and example data formats to get users started.
I like it!
Yes but now it’s just “commands”, no tree with mixing at the same level. The difference is subtle, but I think this is much better. With the other system users would have wound up abusing motor5 and motor6 to define their own commands. Now this is built-in.