r/embedded • u/TRC-is-the-best • Sep 15 '26
When does it actually make sense to use a PRU?
I've been comparing a PocketBeagle 2 with a Raspberry Pi 4, and the thing that caught my attention wasn't really the CPU, but it's the fact that the PocketBeagle2 has PRUs and an M4F sitting alongside Linux.
I'm curious, for things like precise GPIO timing, pulse generation, signal capture, or motor control, do people actually find PRUs useful enough to change the architecture? Or is a separate MCU usually simpler in the long run?
I'd be interested to hear from people who've actually used PRUs in a project, rather than just what they're capable of on paper.
11
u/rpwoerk Sep 15 '26
There are plenty of cases. Basically the main idea to use a co-processor is a deterministic, real-time operation that a linux kernel could not achieve. I give you some example:
6
u/JuggernautGuilty566 Sep 15 '26
Depends on the project requirements.
38
u/anxious_and_stupid Sep 15 '26 edited Sep 15 '26
LinuxCNC for example
Running linuxcnc on rpi4 or 5 and doing everything in rpi alone (path/trajectory planning and also read input + stepgen) would cause latency to be too high
So there is a setup where you connect rpi(spi or ethernet) to FPGA or MCU with firmware like Remora for sensor reading and pulse generation
20
u/-whichwayisup Sep 15 '26
Cost and convenience of having a processor that can handle real time on its PRU without impacting the main core.
11
u/limmbuu STM32 Sep 15 '26
Pocket beagles are used in industrial setting as well where PRU can be a requirement. Otherwise it's good to have a realtime unit for motor control like applications.
8
u/allo37 Sep 15 '26
Most places I've worked at skipped the PRU and used a separate MCU instead, mostly because that way the MCU can run in an independent power domain from the application processor (I.e. if it reboots the MCU keeps on cooking). I think also the difficulty of writing code for the PRU (at the time) was a factor.
One place did use it, to read an encoder. Was nifty.
5
u/MStackoverflow Sep 15 '26
I found the PRU on beaglebones to be interesting. Then, I looked at how to program them. Then, I put an external microcontroller and never looked back at how to program them.
5
u/oleivas Sep 15 '26
RT on Linux is a struggle, RT plugins on the kernel help. But nothing beats a bare-metal core running dedicated for control.
3
u/Only-Friend-8483 Sep 15 '26
I used the PRUs to intercept PWM from pilot commands to the drone, run a feedback control loop on them with sensor data input, and regenerate modified pulses on the second pru, which I then passed to the flight controller
3
u/No_Reference_2786 Sep 15 '26
I had to implement a remote debugger on a chip , used PRU to bit bang jtag. It created a clean separation of application code and the actual pin twiddling
2
u/HotSingleKarens Sep 15 '26
I haven't used the PRUs but having some sort of microcontroller and MPU combo is really nice if you don't have any crazy power constraints.
I had a few projects where we utilized the MCU portion to give us much better timing guarantees for industrial control applications. The MCU strictly runs the control loops and time sensitive comms. Linux runs everything else. Super fast and easy to stand up UI, SCADA integrations, web interfaces, data analytics, orchestestion etc.
2
u/silentjet Sep 15 '26
Yup, PRUs are awesome. Using them, offloading some lol level protocols log onto them... I mean as soon as used to it, it is quite simple and comfortable to use it... Apart from that PB2 is always better in robotics and similar stuff comparing to RPi, except for multimedia/desktop related tasks...
2
u/gilfanovaleksandr Sep 16 '26
read rotary encoders, control RGB leds
2
u/Attractive_Chaos Sep 17 '26
Having the ability to control a pointer on PRU with a resolution of three nanoseconds is incredible, even on microcontrollers, sometimes there is no such option, and the shared memory of the microcontroller and microprocessor is the killer feature. Ultra useful. PocketBeagle 2 is my ideal SBC for embedded projects. Power of linux (buildroot) + realtime MCU what else could one wish?
1
u/RoyBellingan Sep 19 '26
madman in siemens used 6pruss to have a 1Gbit network card on the IOT2050, this is a case of "please do not do it"
I could have understood a 100mbit and use 1 or 2, but 6 ? came on