3 ms·
The CPU loaded a bytecode program into the PRU's memory and told it to run. The PRU ran a bytecode execution engine that was handcoded in assembly. The core o
by curveship 10y ago
The CPU loaded a bytecode program into the PRU's memory and told it to run.
The PRU ran a bytecode execution engine that was handcoded in assembly. The core of the engine was a loop:
- perform the routine for the current bytecode
- when the routine finished, spin on the PRU's embedded timer (the IEP) until 256 ticks (1.28us) had passed since the start of the cycle
- advanced to the next bytecode and repeated
External devices were connected either via I2C (those that didn't need super-tight timing) or to the pins controlled by the PRU. Some of the bytecodes controlled execution flow like loops while others were specific to the application, things like turn light on, move lens, trigger camera, etc.
There were a few more bells and whistles, like memory locations where flags were set by the engine to let the CPU know how progress was going.
It was a fun project. Unfortunately, the manufacturer of one of the core devices decided to stop making it, so that start-up had to go in a different direction.