Comments (4)
Other time-critical operations can be a problem when USB is running. You can only increase DMA_BUF_SIZE in pwmsounddevice.cpp (line 41) so that the DMA buffer can hold the full sample and the conversion is done before playing. But this only works with fairly small static samples. Unfortunately I cannot do more about it at the moment.
from circle.
USB feature is quite important to take advantage for many application. I'd like to invastigate the root cause. But it is not a simple work as you mentioned. Thank you for your great work!
from circle.
Thank you! I think the problem is caused by the implementation of the frame scheduler for periodic interrupt transfers to low speed devices (keyboard, mouse) in dwhciframeschedper.cpp. Because it is important in which micro frame an USB split frame is transmitted one has to wait for that micro frame to come.
This can be done by using interrupts which generates a continous load of 8000 interrupts per second and the response time to this interrupt is very critical. AFAIK Linux on the Raspberry Pi uses this method and implements a special FIQ handler to meet the response time requirements.
The Circle USB HCI driver was intended to be used in a small UNIX like hobby OS with a text console without real-time requirements when it was developed. So I decided to simply (busy) wait for that micro frame which may happen in IRQ context. Because other interrupts will not be handled while waiting there may be an IRQ response time of about one milli-second at worst when an USB keyboard or mouse is connected to the system. That is too long to generate a continous data stream to the PWM FIFO via the platform DMA controller.
Unfortunately it is not easy to change this frame scheduling method and currently I cannot do that. The problem should not arise on USB Ethernet or mass-storage device only systems. In a desktop environment with keyboard and mouse PWM sound could be implemented using two chained DMA buffers alternating and generating an interrupt when one buffer was transfered so that there is enough time to fill the other. Unfortunately this is currently not supported by the CDMAChannel class.
from circle.
To clarify this: Circle is not a real-time OS and is not intended to be one. That means different simultaneous operations may interfere in respect of its timing behaviour. The provided samples are tested to work but if you try different combinations of hardware support classes this has to be tested by yourself. I have added a similar notice in the main README file. So this issue will not be fixed.
from circle.
Related Issues (20)
- USB CDC/ACM gadget HOT 19
- GetClockTicks without wrap HOT 3
- GPU support on Raspi 4 HOT 4
- Circle linker failure with softfp HOT 2
- Make USB gadget vendor and device strings configurable HOT 2
- Support for touchscreens with additional reports in HID descriptor HOT 7
- Question about log when testing with Qemu HOT 2
- Help with setting PREFIX HOT 4
- Question: Waveshare 5'' DSI display support? HOT 2
- Waveshare 15.6inch Capacitive Touch Screen HOT 2
- Can I run OpenCV? HOT 2
- Sample "07-usbstorage" fails with Pi5 HOT 8
- Unsuportted USB touch screen driver - Big Tree Tech HDMI7 HOT 10
- How to do GPIOPin button Interrupt correctly HOT 23
- FIQ support on RPI Zero 2 HOT 3
- How to remove all text not from own CSerialDevice HOT 11
- Ability to set HDMI output refresh rate HOT 3
- About memory management on CM4 HOT 2
- Building circle-stdlib w/Circle: This header is not available in freestanding mode. HOT 6
- I2S simultaneous input+output HOT 4
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 circle.