Recently Alexis took the design decision to drop the IrDA idea (see this post) and to instead use an additional ESP32 to communicate between the rotating main board and the bottom PCB (which is in charge of controlling the motor).
So now the bottom PCB has an ESP32 for the purpose of receiving speed instructions from the main board over Wifi.
Yesterday, I wondered whether we could actually drop the STM32 processor on the bottom PCB and let the ESP32’s CPUs handle everything. We decided that the question was worth investigating, as there really isn’t that much to do on the bottom PCB.
To clarify, these are the required tasks:
- regularly receive a target speed over Wifi
- detect with accurate timing when the position sensor (Hall sensor or optical sensor) signals a completed rotation
- deduce the current motor speed and compute the PID correction to the ESC’s throttle value
- regularly generate a DShot signal with most up-to-date throttle value (at least every 10ms)
We haven’t come to any definite conclusions yet, but I looked through the reference manual today. It seems like we could generate DShot over SPI using the SPI DMA interface (p. 119 of this technical reference manual). As for accurately capturing the time of the sensor interrupt, we’re not sure yet what kind of timing garanties the ESP32 offers for handling IRQs, but I think we could use the capture timer in the MCPWM module (p. 437 of the same reference manual).
If you’re familiar with the ESP32, your insights are welcome ! We’ll keep looking in the coming days and let you know what we decide.
That’s all for now, stay tuned 🙂