Example: PRUSS GPIO toggling measured speed. More...
#include "BBB/pruio.bi"#include "BBB/pruio_pins.bi"#include "BBB/pruio_prussdrv.bi"
Go to the source code of this file.
Functions | |
| FUNCTION_AS_Int32 | load_firmware (BYVAL_AS_UInt32 IRam) | 
| load firmware to PRU  More... | |
| int | main () | 
Variables | |
| VAR | io = NEW PruIo(PRUIO_ACT_PRU1 OR PRUIO_ACT_PWM0) | 
| create new driver structure  | |
| UInt32 | pru_num | 
| which pru to use  | |
| UInt32 | pru_iram | 
| ID of its instruction ram.  | |
| UInt32 | pru_dram | 
| ID of its data ram.  | |
| UInt32 | pru_intr | 
| ID of its interrupt.  | |
| float_t | f | 
| the measured frequency  | |
| float_t | d | 
| the measured duty cycle  | |
| UInt32_PTR | dram | 
| a pointer to PRU data ram  | |
Example: PRUSS GPIO toggling measured speed.
This file contains an example for parallel usage of the other PRUSS. The firmware toggles a GPIO pin at reduced speed. (Maximum is 100 MHz pulse train, we add 4 NOOPs to reduce it to 20 MHz for better measurments.) Find a functional description in section pruss_toggle.
Licence: GPLv3, Copyright 2018-2023 by Thomas{ doT ]Freiherr[ At ]gmx[ DoT }net
Compile by: fbc -Wall pruss_toggle.bas
Definition in file pruss_toggle.bas.
| FUNCTION_AS_Int32 load_firmware | ( | BYVAL_AS_UInt32 | IRam | ) | 
load firmware to PRU
| IRam | The IRam ID for the PRU to use | 
The instructions are compiled by command
pasm -V3 -c pruss_toggle.p
from source code (named pruss_toggle.p)
.origin 0 LDI r0, 0 LBBO r1, r0, 0, 12 // load parameters in r1 (bitnumber), r2 (counter), r3 (interrupt) LDI r0, 1 LSL r1, r0, r1.b0 // generate bit mask start: LOOP finished, r2.w0 XOR r30, r30, r1 // togle output, max. 200 MHz toggling LDI r0, 0 // NOOPs here, CAP is only 100 MHz LDI r0, 0 // 1 + 4 x NOOP = 5 cycles LDI r0, 0 // --> 40 MHz toggling frequency LDI r0, 0 // --> 20 MHz pulse train finished: MOV r31.b0, r3.b0 // send notification to host HALT JMP start
Definition at line 53 of file pruss_toggle.bas.

| int main | ( | ) | 
The main function.
Definition at line 170 of file pruss_toggle.bas.
