Comments (5)
I am also seeing this issue. Here is some test code.
#!/usr/bin/env python
import RPIO
from RPIO import PWM
import time
PWM.setup()
RPIO.setup(25, RPIO.OUT, initial=RPIO.LOW)
PWM.init_channel(4)
PWM.init_channel(0)
PWM.add_channel_pulse(0, 25, 0, 100)
time.sleep(5000)
If you measure the output on a scope then the cycle time and pulse width are approximatery twice what they should be (i.e. cycle time 40ms rather than 20). If you comment out the PWM.init_channel(4) then the timing is correct.
Looking at the code, two dma engines are set up each consuming DMA_REQs. I am guessing that each individual engine is probably getting approximately half the DMA_REQs. I dont know how you can get round this. The split will probably not be exact as there is no guarantee at the microcode level that a particular channel will get any or all the DMA_REQs.
from rpio.
I've tried to investigated this issue some time ago. From what I remember:
I have the same behavior with C code driver and with the python bindings. I did not see any problem in the code. Each DMA channel has its own control structure with DMA CBs and specific GPIO masking variables.
Moreover the signal width is doubled when more than 1 channel is initialized and using PWM clock. With PCM there is no problem.
I've checked PWM registers with 1 or multiple DMA channels and did not note any modifications. So clock frequency is just divided when starting new dMA channel with PWM without any changes in PWM registers (range) ... I'm missing something. I also did not see anything special requirements concerning PWM clock divisor (in the datasheet).
I would need some more information concerning the oscillator and derived clocks. (In a specific data sheet)
from rpio.
#camusdv, I checked out w you said about the using the PCM fifo to source the DMA_REQs. I can confirm that the pulse width does not double on this case.
So to summarise.
- With the default PWM fifo as the timing (DMA_REQ) source using more than dma channels (dma engines) will cause pulse increment to double thus doubling the length of the subcycle and any pulses in it.
- Using the PCM fifo as the timing source having more than one dma channel works as expected.
So if you want to use more than DMA channel then you must use the PCM fifo as the clock source. Maybe the code should be modified to enforce this.
As to why this is happening I have no clue! I cannot see any difference in the broadcom spec between DMA_REQ line 5 and DMA_REQ line 2, on either the DMA engine side or the peripheral side.
from rpio.
Is there any update about this issue? I cant scope it but my ESC fails to start when I use 2 DMA channels, with only one it works perfectly ( servo needs 20ms sub time, for the ESC I want to use only 3ms sub type thats why I need more dma channels)
OR
how can I use the PCM fifo instead PWM with python ?
from rpio.
Hi, is there any update about this issue. When I initialize a second PWM channel, the first channel goes to full width.
from rpio.
Related Issues (20)
- RPIO ver.2 HOT 1
- Input function doen't work
- System hangs during reboot with RPIO python script running in docker HOT 1
- SystemError: This module can only be run on a Raspberry Pi! HOT 4
- Raspberry CM3 module unsupported. HOT 1
- Debian buster need #include <sys/sysmacros.h> inside pwm.c
- After upgrading to buster branch v2 stops working HOT 1
- Uncaught Error: Cannot find 'rpio'
- RPI 4 Model HOT 1
- RuntimeError: This module can only be run on a Raspberry Pi! HOT 2
- SystemError: This module can only be run on a Raspberry Pi!
- _PWM.cpython-37m-arm-linux-gnueabihf.so: undefined symbol: makedev HOT 4
- how disable debbug ?
- RPIO-0.10.0-py3.5-linux-armv7l.egg SystemError: This module can only be run on a Raspberry Pi! HOT 1
- Interrupted by signal 11: SIGSEGV
- mmap check
- System error
- Problem running RPIO on Raspberry Pi 4 HOT 2
- RPIO won't run on my Raspberry Pi 4, how to remove? HOT 1
- https://pythonhosted.org/RPIO/#installation seems outdated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rpio.