orangepi-xunlong / wiringOP

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

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

Open thedmdim opened 11 months ago

thedmdim commented 11 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 11 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 11 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 10 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 10 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 10 months ago

OrangePi zero plus use master branch is OK

UMI64 commented 8 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 8 months ago

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

SavooTerrordasPop100 commented 8 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 7 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 6 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

WWolf13 commented 2 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

excellent, it works on H5Pi PC2

ZHH-start commented 3 weeks ago

这个是因为后面更新把前面已经实现的功能搞出问题了而已——辨别版本更新的方法可能有所不同,而老版本已经无人维护。

可以checkout到老版本当年发布支持的那个提交,这样可以解决问题。如我的板子是lite1,H3芯片: image 可以看到提交是2020年,提交号a846ffd8f5583516cd25c6b08e49fd9cc47728c4。

切换前: image

切换: image

编译: image image

编译完成后: image 可见成功解决问题。