I have been using this motor controller for building a small walking robot. During further development of that project, specifically trying to get virtual model control working correctly, I started running into performance issues. Even with performance optimizations, there was only so much I could do without really significant effort. I have been using the SAMD21 microcontroller, a Cortex M0 core running at 48MHz and 32KB of SRAM. It does not have an FPU, which was starting to be a major issue. When I tried to perform significant pre-calculations of the motion profiles, I ran into memory issues. The clear next revision then was to move up to a more powerful microcontroller, particularly one with an FPU. My projects are also as much about learning as building stuff, so I also decided to use an STM32 since I have limited experience with those. I have also been building more PCBs with JLCPCB, and they have numerous STM32 options.
I chose the STM32F407, which represents a really significant upgrade in many ways:
- Clock rate increase to 168MHz (3.5X faster)
- Memory increase to 192KB (6X more)
- Has an FPU (likely 50+X faster for some operations, not including clock speed upgrades)
- Has an onboard CAN controller
- Has multiple onboard quadrature decoders (reduce overhead from interrupts used on SAMD21 version)
Besides the major upgrade on the MCU, I made a few other usability upgrades:
- Added 2 LEDs for status indication
- Voltage reference for more accurate current feedback
The image below shows the upgraded design. The connectors and mounting holes have not moved, so that I can easily swap out the older versions. This design has been ordered and I'm just waiting for it to arrive. In the meantime I can make some progress on the firmware, pulling in much of the development work I made for the SAMD21 into the STM firmware.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.