Menu

#102 Not functional on RPi 2 running Raspbian with device tree disabled

Duplicate
None
High
Patch
2015-09-01
2015-03-30
No

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.

Discussion

  • Ben Croston

    Ben Croston - 2015-09-01

    Already fixed in development version. Will be in next release.

     
  • Ben Croston

    Ben Croston - 2015-09-01
    • status: New --> Duplicate
    • assigned_to: Ben Croston
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.