mariusmmg2
mariusmmg2

Reputation: 723

BBB: GPIO signal won't stay high

So I have a BeagleBone Black board, and I want to be able to set some GPIO pin from a low value to a high value.

For achieving this I'm using the BlackLib1 library (a C++ library that offers general access to all beaglebone's pins).

That library haves a class called BlackGPIO that offers the functionality that I want.

BlackLib::BlackGPIO NSLP_pin(BlackLib::GPIO_61, BlackLib::output, BlackLib::SecureMode);

auto NSLP_pinMode = NSLP_pin.getValue();

NSLP_pin.setValue(BlackLib::low);

I expect that this lines of code will set the signal from a low value to a high one (the signal is low by default).

The problem is that the signal goes high only for about ~10ms (measured on a scope), and after that it goes low again.

What I do wrong?

How can I set the some GPIO pin at a certain value, and remain like that until I change it?

[1] link

Upvotes: 0

Views: 245

Answers (1)

Manoj
Manoj

Reputation: 111

The link specifies to export the BBB pins from command line and to set it HIGH or LOW. You can develop a small C++ function to send those commands to kernel to export, ON/OFF the BBB pins. I'm using the same method in my C application and it works perfect.

Example code snippet in C to Enable the pin:

FILE *GPIO;
GPIO = fopen("/sys/class/gpio/gpio65/direction", "w");
fseek(GPIO,0,SEEK_SET);
fprintf(GPIO,"61");
fflush(GPIO);
fclose(GPIO);

Upvotes: 0

Related Questions