Hi guys, I tried to access the PRU with a simple blink test on Beaglebone
Black using libpruio library. But I get this error,
**
initialisation failed (out of memory)
Segmentation fault
**
The code i used is partially based on the stepper.c from c_examples file is:
/*****/
/*! \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;
}
/*****/
Anyone have any ideas? Sorry if this is a noob post, newbie here.
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/beagleboard/960bcf4b-3e00-4c53-99ef-81e0eeeb60cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.