3 ms·
Ditto for robotics. 8 PIO units are enough to read and log four quadrature encoders at practically no interrupt cost, so it's possible to build a perfectly perf
by moffkalast 2y ago
Ditto for robotics. 8 PIO units are enough to read and log four quadrature encoders at practically no interrupt cost, so it's possible to build a perfectly performant closed loop controller in something as slow as Micropython.
- Teknoman117 2y agoYou don't even need the 8 :), 4 quadrature inputs will fit on one PIO block. Some lovely person got a quadrature decoder into 24 instructions, so you can potentially still do something useful on the same PIO block if you only need one or two quadrature encoders.
- moffkalast 2y agoI mean yeah one block is 8 units right? Two pins per encoder which both need a unit each.
- Teknoman117 2y ago4 units per block, 2 blocks per RP2040.
- 05 2y agoMany, many cheap MCUs have peripherals that can decode quadrature in hardware. E.g, PCNT on ESP32, timer modes on STM32 etc. Might as well use PIO to implement I2C or UART :)
- fest 2y ago> Might as well use PIO to implement I2C or UART :) PIO actually came in handy for me when interfacing with an x-ray sensor which had 12 or 14 bits long UART data frame- not many micros have such a flexibility in their UART peripherals.
- moffkalast 2y ago> PCNT on ESP32 Damn TIL, never heard of that. I'll have to try it, thanks!
- m-ee 2y agoIt’s also possible to build a perfectly performant closed loop controller with micropython on an STM32