[SOLVED]GPIO issues
Posted: Tue Jul 02, 2013 5:53 am
I'm running 3.6.11+ #474 (soft float) and I've written a c++ app (in Qt4.8.2) that listens for signals on one or more GPIO pins. My app was working just fine until I upgraded to the current release, but now it can't map the GPIO locations.
The code (somewhat abridged, but you get the idea):
I've looked at all getrlimit() and ulimit have to offer, but can find no reason there why the mmap call is failing.
Any help would be gratefully received.
Tony
The code (somewhat abridged, but you get the idea):
Code: Select all
#define GPIO_BASE 0x22000000
#define BLOCK_SIZE (4 * 1024)
bool PiGPIO::setupio()
{
if((mem_fd = open("/dev/mem", O_RDWR | O_SYNC)) < 0) return false; // this succeeds when run as root
gpio_map = (char *) mmap(
NULL,
BLOCK_SIZE,
PROT_READ | PROT_WRITE,
mem_fd,
GPIO_BASE); // always fails with errno 11 (EAGAIN -- Resource temporarily unavailable)
// etc
}
Any help would be gratefully received.
Tony