WiringPi on Odroid C2: No Revision in /proc/cpuinfo

Dear all,

I tried to use wiringPi under CE to make use of the Odroid’s gpio. I cross compiled it and obviously got a working binary. At least it launches and displays version info, help, etc.

Still it won’t access the gpio. This seems to be the case as the data under /proc/cpuinfo do not contain a line labeled „Revision“ which I guess is present in other operating systems. Is there a reason why this line is missing in CE? Any way to add it?

Also I tried forcing the program to just ignore the line and use „Revision : 0200“, which I think should be the correct entry for a C2. Unfortunately that only gets me the next error „Segmentation fault“ and still no working program. :frowning:

Here’s what I changed in ./wiringPi/wiringPi/wiringPi.c in Hardkernel’s wiringPi on github

added in line 304:
fgets ( line, 120, "Revision        : 0200\n");

What is the output of cat /proc/cpuinfo? Isn’t there “Hardware :”?

Yes, „Hardware : xxx“ is there, but no „Revision : xxx“.

Processor       : AArch64 Processor rev 4 (aarch64)
processor       : 0
processor       : 1
processor       : 2
processor       : 3
Features        : fp asimd evtstrm crc32 wp half thumb fastmult vfp edsp neon vfpv3 tlsi vfpv4 idiva idivt
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

Hardware        : ODROID-C2
Serial          : 1f0c000046333444444644343532bf20

Since WiringPi origins from the RPi, it’s looking for that line. No idea though, why Hardkernel didn’t remove that in their fork in the first place.

Anyways, as I wrote I tried to bypass it and hardcoded the revision into WiringPi, but it still won’t run. That’s a pity cause the gpio is one fine feature that could be put to great use.

Could you please specify the problem with logs or code where you stuck if possible?

On line 304 after fclose just put
sprintf(line, "Revision : 020b\n");
or maybe just 0200.

This solves one error, but brings up another one.

I added it to line 304 in …/wiringPi.c :

while (fgets (line, 120, cpuFd) != NULL)
        if (strncmp (line, "Revision", 8) == 0)
                break ;
fclose (cpuFd) ;
sprintf(line, "Revision : 020b\n");
if (strncmp (line, "Revision", 8) != 0)
        wiringPiFailure (WPI_FATAL, "No \"Revision\" line") ;

Compiled and launched on the C2 I get ERROR : file not found.(boardrev)
At least it’s a new error for a change…

This is not really an error. It just shows that file /sys/class/odroid/boardrev doesn’t exist and it sets revision to 1. WiringPi should work anyway.