Hi guys, I tried to access the PRU with a simple blink test on Beaglebone Black using libpruio library. But I get this error,
/*! \file libpruio_blink.c
blink test on libpruio
Compile by: ` gcc -Wall -o libpruio_blink libpruio_blink.c -lpruio `
*/
//! Message for the compiler.
#define _GNU_SOURCE 1
#include "stdio.h"
#include <termios.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/time.h>
#include "../c_wrapper/pruio.h"
#include "../c_wrapper/pruio_pins.h"
// The pin used to control LED
#define led_pin 44
void ledBlink(pruIo *Io, int c)
{
pruio_gpio_setValue(Io, led_pin, c);
}
//! The main function.
int main(int argc, char **argv)
{
pruIo *Io = pruio_new(PRUIO_DEF_ACTIVE, 0x98, 0, 1); //! create new driver structure
if (Io->Errr) {
printf("initialisation failed (%s)\n", Io->Errr);}
ledBlink(Io,0); //initialize pin config
//' pin config OK, transfer local settings to PRU and start PRU driver
if (pruio_config(Io, 1, 0x1FE, 0, 4)) {
printf("config failed (%s)\n", Io->Errr);}
int i = 0;
int blinkTime = 10;
printf("blink for %d times on %d beaglebone pin", blinkTime, led_pin);
for (i; i<blinkTime; i++)
{
ledBlink(Io, 1);
printf("%1d \n",pruio_gpio_Value(Io, led_pin));
sleep(1);
ledBlink(Io, 0);
printf("%1d \n",pruio_gpio_Value(Io, led_pin));
sleep(1);
printf("done %d\n",i);
}
pruio_destroy(Io); /* destroy driver structure */
return 0;
}
/*****/