orangepi-xunlong / wiringOP

wiringPi for Orange Pi
GNU Lesser General Public License v3.0
415 stars 192 forks source link

GPIO mode differs from example. Can't change. #47

Open ubombi opened 2 years ago

ubombi commented 2 years ago

I struggle enabling I2C on OPI4B. i2cdetect won't detect anything.
So far, only noticed that in example of this library SDA/SCL are in ALT3 mode, but in my case, those are IN.

README.md

+------+-----+----------+------+---+OrangePi 4+---+---+--+----------+-----+------+
| GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
|      |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |      |
|   64 |   0 | I2C2_SDA | ALT3 | 0 |  3 || 4  |   |      | 5V       |     |      |
|   65 |   1 | I2C2_SCL | ALT3 | 0 |  5 || 6  |   |      | GND      |     |      |
|  150 |   2 |     PWM1 |   IN | 0 |  7 || 8  | 1 | ALT2 | I2C3_SCL | 3   | 145  |
|      |     |      GND |      |   |  9 || 10 | 1 | ALT2 | I2C3_SDA | 4   | 144  |

Actual: ./gpio/gpio readall

+------+-----+----------+------+---+OrangePi 4+---+---+--+----------+-----+------+
| GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
|      |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |      |
|   64 |   0 | I2C2_SDA |   IN | 1 |  3 || 4  |   |      | 5V       |     |      |
|   65 |   1 | I2C2_SCL |   IN | 1 |  5 || 6  |   |      | GND      |     |      |
|  150 |   2 |     PWM1 | ALT2 | 1 |  7 || 8  | 1 | ALT2 | I2C3_SCL | 3   | 145  |
|      |     |      GND |      |   |  9 || 10 | 1 | ALT2 | I2C3_SDA | 4   | 144  |

It it okay this way? What does this mean?

I can't change it to ALT3 to check if it's related in any way, gpio fails with SegFault

orangepi-xunlong commented 2 years ago

Hi, Which image do you use?