• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[wiringX] bananapiM2 gpio 0 and 1 pin mode setting limits
#1
Hi,

I am going through bananapiM2 platform files in wiringX 'rewrtite' branch. In the file 'src/platform/lemaker/bananapim2.c' I see the following code for a gpio mode setting.

Code:
static int bananapiM2PinMode(int i, enum pinmode_t mode) {
        if(map[i] == -1) {
                return -1;
        }
        if((i == 0 || i == 1) && (mode != PINMODE_OUTPUT)) {
                wiringXLog(LOG_ERR, "The %s pin %d can only be used as output", bananapim2->name, i);      
                return -1;
        }
        return bananapim2->soc->pinMode(i, mode);
}

One can see that gpio 0 and 1 are forbidden to have any mode but output.

What is the reason for it? The hardware itself allows to have at least input mode for these pins.
 
Reply
#2
Just try it yourself. Using them as inputs doesn't work, while settings them as outputs does.
 
Reply
#3
(05-14-2016, 10:11 AM)curlymo Wrote: Just try it yourself. Using them as inputs doesn't work, while settings them as outputs does.

Allow me to disagree. I just checked, I can read from GPIO 0 (corresponding to PIN 11 of the connector and PG7 of the CPU) and GPIO 1 (PIN 12 of the connector and PH10 of the CPU) just fine.

I have to admit that I have done reading with the BPI-WiringPI gpio utility, but I double check that
these are the proper pins from the WiringX point of view via blinking an LED.

If you allow, I will prepare the pull request with a fix for this situation.

The check in question might be historical artifact of wiringX prior 'a87b44f3d20e' commit, where
these gpios were apparently used to control on board LEDs. By the way, It would be great to bring them back but apparently they are already exported to sys space via device tree in several distribution, the armbian would be an example of such.
 
Reply
#4
I'd hoped you disagreed and looking forward to your PR Smile
 
Reply
#5
(05-14-2016, 10:47 PM)curlymo Wrote: I'd hoped you disagreed and looking forward to your PR Smile
Done.

I have another set of patches regarding banana pi m2 in mind. But I would like to clarify the API.
What functions like waitForInterrupt, wiringXISR, wiringXValidGPIO, and wiringXGC suppose to do.
I think I searched the forum and google it, but I do not see the clear link with description.
I particulatly interested in what setIRQ(map) is doing. It is not implemented but yet is called in bananapiM2Setup.
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  wiringX pin numbering woutput 6 4,466 12-30-2017, 02:05 PM
Last Post: zackdvd
  wiringX terrar 1 2,730 11-04-2014, 10:16 PM
Last Post: curlymo

Forum Jump:


Browsing: 1 Guest(s)