Jump to content

Recommended Posts

Posted

Hi, my environment is:

Orange Pi One

ARMBIAN 5.34.171031 nightly Ubuntu 16.04.3 LTS 4.11.12-sun8i

WiringPi fork by WereCatf:

git clone https://github.com/WereCatf/WiringOP.git -b h3

./build

 

small c++ programm:

 

#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <wiringPi.h>
#include <pthread.h>


static volatile int globalCounter;

void myInterrupt(void) {
    ++globalCounter;
    printf("InterruptCounter: %5d\n", globalCounter);
    //digitalRead(7);
}

int main(void)
{
    if (wiringPiSetup() == -1) {
        printf("wiringPiSetup Error\n");
    }
    pinMode(7, INPUT);
    pullUpDnControl(7, PUD_UP);
    if (wiringPiISR(7, INT_EDGE_FALLING, &myInterrupt) < 0)
    {
        fprintf(stderr, "Unable to setup ISR: %s\n", strerror(errno));
        return 1;
    }
    for (;;)
    {
    //main programm code here...
    }
    return 0;
}
 

 

Compile:

gcc ./isr.c -o wg-daemon.out -lwiringPi -lwiringPiDev -lpthread -lm

 

and run it...

 

but when I put pin 7 in down state (gpio mode 7 down) ISR function begin fires (triggers) continuously (((((((

Here is output :

 

InterruptCounter: 132371
InterruptCounter: 132372
InterruptCounter: 132373
InterruptCounter: 132374
InterruptCounter: 132375
InterruptCounter: 132376
InterruptCounter: 132377
InterruptCounter: 132378
InterruptCounter: 132379
InterruptCounter: 132380
InterruptCounter: 132381
^C
root@orangepione:~/example#
 

 

but, when I add to ISR function 

"digitalRead(7);"

program works fine (((

 

 

 

Please tell me, what I do wrong

 

 

Posted

Anyone()

 

I just test this code with Raspberry Pi 3 and Wiring Pi library, all works perfect()

But on orange pi one still this problem(

Posted

I am observing the exact same behavior with the Orange Pi PC:

 

Hi, my environment is:

Orange Pi PC

BOARD=orangepipc
BOARD_NAME="Orange Pi PC"
BOARDFAMILY=sun8i
VERSION=5.38
LINUXFAMILY=sunxi
BRANCH=next
ARCH=arm
IMAGE_TYPE=stable
BOARD_TYPE=conf
INITRD_ARCH=arm
KERNEL_IMAGE_TYPE=zImage

 

WiringPi fork by WereCatf:

 

Do you have any newer information/insights on that matter?

 

Anayway, does calling digitalRead() in the interrupt-routine cause any problems? If not, this work around is acceptable for me. Thanks for the hint. :-)

 

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines