Robot Control Library
PRU

Description

Start and stop the PRU from userspace.

<rc/pru.h>

This is primarily for the PRU-dependent servo and encoder functions to use, however the user may elect to use their own PRU routines separately from those.

Functions

int rc_pru_start (int ch, const char *fw_name)
 
volatile uint32_t * rc_pru_shared_mem_ptr (void)
 fetches a pointer to the beginning of the PRU shared memory. More...
 
int rc_pru_stop (int ch)
 

Function Documentation

◆ rc_pru_start()

int rc_pru_start ( int  ch,
const char *  fw_name 
)

Starts a single specified PRU core running a provided firmware name.

This function requires root privileges and your custom firmware must exist in "/lib/firmware/". The default name for the two firmwares are "am335x-pru0-fw" and "am335x-pru1-fw", please don't overwrite these if they exist. Name your firmware image something like "am335x-pru0-mycustom-fw".

Parameters
[in]chpru core to start (0 or 1)
[in]fw_nameThe firmware image name, e.g. "am335x-pru0-fw", do not include '/lib/firmware' in the path, only the file name.
Returns
0 on success, -1 on failure.

◆ rc_pru_shared_mem_ptr()

volatile uint32_t* rc_pru_shared_mem_ptr ( void  )

fetches a pointer to the beginning of the PRU shared memory.

This is done by mapping to /dev/mem and therefore requires root privileges but provides extremely low-latency memory access to communicate with the PRU.

Returns
memory pointer on success, NULL on failure

◆ rc_pru_stop()

int rc_pru_stop ( int  ch)

Unloads pru binaries

Parameters
[in]chpru core to stop (0 or 1)
Returns
0 on success, -1 on failure.