Ok, yet another revelation for me this is. When designing Replicape rev 0 and rev 1, I spent an inordinate amount of time trying to work around the limitation that only some of the GPIO pins were available to the PRU. As it turns out, this assumption was was not right. In fact, all GPIO pins are available to both PRUs!
The downside is that it does take a bit longer to toggle the pins since the PRU must access the global memory instead of the local memory. How much longer? About four times:
In both the pictures above, the time division is 20ns. The fast method uses one instruction for each update, since it is only a MOV command. The “slow” uses four instructions for one SBBO command to toggle the state of the pin, so there is a significant difference, but still the minimum pulse width for the DRV8825 stepper motor controllers is 1.9ms, so even with the slow method, you can toggle the pin 100 times for each “legal” toggle.
Here are the source codes for the assembly:
// Fast speed test. Each loop iteration takes 3 instruction cycles = 15ns .origin 0 .entrypoint START START: LBCO r0, C4, 4, 4 CLR r0, r0, 4 SBCO r0, C4, 4, 4 BLINK: MOV r30, 1<<14 MOV r30, 0 QBA BLINK
// Slow speed test. Each loop takes 4+4+1 = 9 instruction cycles = 45ns .origin 0 .entrypoint START #define GPIO1 0x4804c000 #define GPIO_CLEARDATAOUT 0x190 #define GPIO_SETDATAOUT 0x194 START: LBCO r0, C4, 4, 4 CLR r0, r0, 4 SBCO r0, C4, 4, 4 MOV r2, 1<<12 MOV r3, GPIO1 | GPIO_SETDATAOUT MOV r4, GPIO1 | GPIO_CLEARDATAOUT BLINK: SBBO r2, r3, 0, 4 SBBO r2, r4, 0, 4 QBA BLINK