Jump to content

WiringOP version 2.46 or 2.48 seems changed but not working input selection pull up/down


Andreag

Recommended Posts

Hello,

I cloned the master branch of WiringOP one month ago, it reported same version 2.46 and it was working except for the option to activate internal pull up/down.

Trying it in C code using:

pullUpDnControl(n, PUD_DOWN);

or by terminal with:

gpio mode 1 down

same behavior, nothing happen.. by default, unfortunately in my case, it seem active a pull up resistor for all inputs.

 

I searched on the web and found there was a bug, fixed.

I checked again the main branch and in effect it is different now, the new code is:

    *(gpio + GPPUD)              = pud & 3 ;		delayMicroseconds (5) ;
    *(gpio + gpioToPUDCLK [pin]) = 1 << (pin & 31) ;	delayMicroseconds (5) ;
    
    *(gpio + GPPUD)              = 0 ;			delayMicroseconds (5) ;
    *(gpio + gpioToPUDCLK [pin]) = 0 ;			delayMicroseconds (5) ;

but executing it I get "segmentation fault", debugging deeply the reason is that "gpio" address is zero.

 

I tried to clone the "next" branch but it is even worst, it won't compile, many errors, log from terminal attached.

 

What I can do in order to fix.. of simply to setup all inputs with pulldown resistor active?

Thanks in advance

Andrea

 

log.txt

Link to comment
Share on other sites

Hello Andrea, I have the same wiringOP version and also in my case it seems the Orange Pi pulls the input UP by default without considering the SW setup cmd (pullUpDnControl(0, PUD_DOWN);) --- By the way I'm using a OPi ZERO.

Is there somebody that can help with a solution or just a workaround?

At the moment I've added a pull-down resistor of 1.8kOhm. Therefore the two voltage states are 1.0 and 2.1 (instead of 0 and 3.3). It works but I'm wondering if it is possible to improve. 

Many thanks!

Edited by SergioAiello
Link to comment
Share on other sites

Additionally the cmd gpioRead stops working after ISR setup

 

   printf (" main1 - %d\n", digitalRead (2));

   wiringPiISR (2, INT_EDGE_BOTH, myInterrupt1) ; 
   printf (" main2 %d\n", digitalRead (2));
 

output:

root@MansaConsMon:/home/lapamo15/GPIO/wiringOP# ./ottobre2023
 main1 - 1
 main2 - 0
Waiting ...
 

And 'gpioRead' output will not change even if the INPUT toggles between 3.3 and 0V

Note: the interrupt function detects correctly the input changes, but the 'digitalRead' output is always LOW

Interrupt function triggered by the rising edge.

Signal level at input '2' is 3.3V (measured by a tester) and the command 'gpio read 2' output is '0' (which should be '1').

 

It seems there is a conflict between 'wiringPiISR' and 'digitalRead'.

 

Edited by SergioAiello
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines