Giter Site home page Giter Site logo

Comments (4)

rsta2 avatar rsta2 commented on September 8, 2024

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.

meesokim avatar meesokim commented on September 8, 2024

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.

rsta2 avatar rsta2 commented on September 8, 2024

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.

rsta2 avatar rsta2 commented on September 8, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.