Closed bpesun closed 1 year ago
Hi bpsesun, there could be a few possibilities. First, make sure you are either running as root or with a user that has privileges to access the devices /dev/mem/ and /dev/vcio.
If the example still does not work, then let's have you enable debug logs, run the example again, and post the output for me to review. To enable debug logs, recreate the Makefile by adding in the option --enable-debug-logs
like so:
./configure --enable-debug-logs
Then remake and reinstall dma_pwm
sudo make uninstall && make clean && make && sudo make install
At this point you can rerun the example and post the debug logs printed to the the screen here.
Thanks a lot. please check the log:
root@pi-desktop:/home/pi/Desktop/dma_pwm-master# cd test
root@pi-desktop:/home/pi/Desktop/dma_pwm-master/test# cd bin
root@pi-desktop:/home/pi/Desktop/dma_pwm-master/test/bin# sudo ./dma_pwm_test
Configuring dma_pwm.c
Setting pulse width to 4995.900 us
Setting number of allocated pages to 16
Configured dma_pwm.c
dma_pwm.c configured
DEBUG logs enabled for dma_pwm.c!
Initializing dma_pwm.c
Signal 1 registered with signal handler
Signal 3 registered with signal handler
Signal 2 registered with signal handler
Signal 15 registered with signal handler
ERROR: get_pi_version() could not get PI board version
ERROR: Could not initialize dma_pwm.c
Could not request channel
root@pi-desktop:/home/pi/Desktop/dma_pwm-master/test/bin#
Could you look and see if the file "/proc/cpuinfo" exists? If so, can you cat it and post the contents?
root@pi-desktop:/proc# cat cpuinfo
processor : 0
BogoMIPS : 108.00
Features : fp asimd evtstrm crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3
processor : 1
BogoMIPS : 108.00
Features : fp asimd evtstrm crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3
processor : 2
BogoMIPS : 108.00
Features : fp asimd evtstrm crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3
processor : 3
BogoMIPS : 108.00
Features : fp asimd evtstrm crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3
Hardware : BCM2835
Revision : c03115
Serial : 10000000bb943a5f
Model : Raspberry Pi 4 Model B Rev 1.5
root@pi-desktop:/proc#
Ah, so turns out dma_pwm wasn't picking up on the "Pi 4 Model B Rev 1.5" revision. I've just pushed an update to the main branch to include this, hopefully everything will work for you now. You can go ahead and pull the latest commit, reinstall, and try the example again.
Thank you for your kind help. Yes ,it can work now.
In your test, you set and read the same channel, if it is possible to read other channel's pwm properties(like get_duty_cycle_pwm(19))?
In other words, if it is possible to read one or some pwm sigals from external remote controller and get their properties like duty?
Thanks.
Great to hear!
Unfortunately get_duty_cycle_pwm()
is internal to dwm_pma so it is only able to tell you the duty cycle of channels that were requested and configured via request_pwm()
& set_pwm()
.
Thank you very much for your great work and help.
Thanks for you example. I am using Pi 4b in ubuntu desktip 22.04.1 os. I run the executable dma_pwm_test under /bin ,but the result showed that could not request channel.
I have add the snd-blacklist.conf file with the content blacklist snd_bcm2835 , but get the same result. Hope to get your suggestion, thanks!