Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
thedmdim opened this issue Dec 10, 2023 · 12 comments
Open

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

thedmdim opened this issue Dec 10, 2023 · 12 comments

Comments

@thedmdim
Copy link

Hello!

  • orange pi zero h2+ 512mb
  • Armbian_23.11.1_Orangepizero_jammy_current_6.1.63

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
Copy link

bobk1955 commented Dec 11, 2023

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
Copy link

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
Copy link

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
Copy link

lsors commented Jan 14, 2024

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
Copy link

OrangePi zero plus use master branch is OK

@UMI64
Copy link

UMI64 commented Mar 7, 2024

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
Copy link

drozdi70 commented Mar 7, 2024

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

@SavooTerrordasPop100
Copy link

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
Copy link

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
Copy link

仅适用于任何想要命令克隆主分支的人,这对我有用: 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
Copy link

WWolf13 commented Sep 20, 2024

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
Copy link

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

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

切换前:
image

切换:
image

编译:
image
image

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests