Blink demo, showing how to use the PRU microcontroller on the PocketBeagle
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
AM335x_PRU.cmd
LICENSE
Makefile
README.md
blink.c
resource_table.h

README.md

Blink demo for PocketBeagle PRU microcontroller

This is a simple "blink" demo using the PRU on the PocketBeagle. Note: it is designed to work with the 4.4.91 kernel; other kernels may have incompatible PRU APIs.

To run this demo:

  • Copy the files to the PocketBeagle
  • Connect an LED to pin P1_33.
  • Run "config-pin P1_33 pruout" to configure the pin as a PRU output.
  • As root, run "make install" to compile the code, install it on the PRU and start the PRU running.

This should flash the LED once per second. If you change the delay in blink.c from 100000000 to 1, the LED will flash at 4 MHz.

Files

blink.c - this is the simple code to turn PRU 0 output 1 on and off.

Makefile - compiles blink.c and starts it up on the PRU.

AM335x_PRU.cmd - this file defines how to package the binary file to load into the PRU. This is the default cmd file generated by CCS.

resource_table.h - this file defines resources used by the PRU. This is the default cmd file generated by CCS.

Development with CCS

This program is compiled from the command line. For more extensive use of the PRUs, you probably will want to use TI's CCS (Code Composer Studio) integrated development environment. I wrote about using CCS with the PRUs earlier here, but be warned that some things have changed since then.

Some internals

The Makefile causes the file to be loaded into the PRU by copying it to =/lib/firmware/am335x-pru0-fw= and then restarting the pru_rproc driver.

To stop the PRU, run the command:

 echo 4a334000.pru0 > /sys/bus/platform/drivers/pru-rproc/unbind

For more information on the PRU's libraries, see the TI pages.