Not functional on RPi 2 running Raspbian with device tree disabled
A Python module to control the GPIO on a Raspberry Pi
Brought to you by:
croston
When the module is used on RPi 2 running Raspbian and device tree is disabled, nothing happens on the GPIO pins.
I found this code in c_gpio.c:
// get peri base from device tree if ((fp = fopen("/proc/device-tree/soc/ranges", "rb")) != NULL) { fseek(fp, 4, SEEK_SET); if (fread(buf, 1, sizeof buf, fp) == sizeof buf) { peri_base = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3] << 0; } fclose(fp); }
Obviously this doesn't work when device tree is disabled. Instead the module accesses the wrong memory region which explains nothing happens on the GPIO pins.
Since the BCM2836 has a peripheral base address of 3F000000h I suggest the module uses this value if it detects a BCM2836. Anyway that's what I do in my code and it always works nomatter device tree is enabled or disabled.
Already fixed in development version. Will be in next release.