orangepi-xunlong / wiringOP

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

wiringPiSetup: mmap (PWM) failed: Invalid argument #96

Open thedmdim opened 9 months ago

thedmdim commented 9 months ago

Hello!

I installed wiringOP like this:

git clone https://github.com/orangepi-xunlong/wiringOP.git
cd wiringOP
./build clean
./build

When I run gpio -v i get:

gpio version: 2.46
Copyright (c) 2012-2018 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

  * Device tree is enabled.
  *--> Xunlong Orange Pi Zero

When I run gpio readall i get:

wiringPiSetup: mmap (PWM) failed: Invalid argument

Any suggestion how to get working gpio?

Maybe there is workaround? Actually I only need kinda toogle, so for example I press a button and there runned script.

bobk1955 commented 9 months ago

Yes, I am seeing the same message on an Orange Pi PC2. It seems something changed in an update just a few weeks ago. A "next" branch vs "master" branch issue?? I downloaded and compiled the master release, and it seems to work, at least on the H5 based PC2 model.

https://github.com/orangepi-xunlong/wiringOP/archive/refs/heads/master.zip

nategoossen commented 9 months ago

Same issue. Thought it was something with trying to install it on Armbian 23.11.1 Bookworm but building off that master release works fine. Thanks for the direction.

drozdi70 commented 8 months ago

while building from master.zip: OrangePi.h:198:36: error: ‘GPIO_PWM_OP’ undeclared (first use in this function); did you mean ‘GPIO_PWM’? 198 | #define GPIO_PWM GPIO_PWM_OP | ^~~ wiringPi.c:2451:85: note: in expansion of macro ‘GPIO_PWM’ 2451 | pwm = (uint32_t *)mmap(0, BLOCK_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, GPIO_PWM) ; | ^~~~ make: [Makefile:159: wiringPi.o] Error 1 make: Waiting for unfinished jobs....

and the installation fails on my orangepi5 plus

lsors commented 8 months ago

Yes, I am seeing the same message on an Orange Pi PC2. It seems something changed in an update just a few weeks ago. A "next" branch vs "master" branch issue?? I downloaded and compiled the master release, and it seems to work, at least on the H5 based PC2 model.

https://github.com/orangepi-xunlong/wiringOP/archive/refs/heads/master.zip

I also meet same issue in OrangePi zero , and use master branch is OK

yuanwb1984 commented 7 months ago

OrangePi zero plus use master branch is OK

UMI64 commented 6 months ago

I change wiringPi\wiringPi.h line 122 https://github.com/orangepi-xunlong/wiringOP/blob/next/wiringPi/wiringPi.h #define H3_PWM_BASE (0x01c21400) to #define H3_PWM_BASE (0x01C21000) and it fixed

drozdi70 commented 6 months ago

I recompiled and the same: orangepi@orangepi5-plus:~/work/wiringOP$ sudo gpio readall wiringPiSetup: mmap (PWM) failed: Operation not permitted

SavooTerrordasPop100 commented 6 months ago

Sim, estou vendo a mesma mensagem em um Orange Pi PC2. Parece que algo mudou em uma atualização há apenas algumas semanas. Um problema de ramificação "próxima" versus ramificação "mestre"? Baixei e compilei a versão master e parece funcionar, pelo menos no modelo PC2 baseado em H5.

https://github.com/orangepi-xunlong/wiringOP/archive/refs/heads/master.zip

I tried downloading from this link but it doesn't work. The error appears: "fatal: unable to acess 'https://github.com/orange.pi-xunlong/wiringOP/archive/refs/heads/master.zip/': Could not resolve host: github.com

elvis-hai-le commented 4 months ago

Just for anyone who wanted the commands to clone the master branch, this worked for me: git clone --branch master https://github.com/orangepi-xunlong/wiringOP.git cd wiringOP ./build clean ./build

And then of course, gpio readall to see pins.

I am using the OrangePi Lite.

youxiangfade commented 4 months ago

仅适用于任何想要命令克隆主分支的人,这对我有用: git clone --branch master https://github.com/orangepi-xunlong/wiringOP.git cd wiringOP ./build clean ./build

然后当然,要看别针。gpio readall

我正在使用 OrangePi Lite。

I followed your approach and successfully solved the problem. Thanks

Just for anyone who wanted the commands to clone the master branch, this worked for me: git clone --branch master https://github.com/orangepi-xunlong/wiringOP.git cd wiringOP ./build clean ./build

And then of course, to see pins.gpio readall

I am using the OrangePi Lite.

I followed your approach and successfully solved the problem. Thanks. I am using Orangepi one