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

usb: audio: high CPU load when running headphones_microphone sample #26857

Open
koffes opened this issue Jul 14, 2020 · 7 comments
Open

usb: audio: high CPU load when running headphones_microphone sample #26857

koffes opened this issue Jul 14, 2020 · 7 comments
Assignees
Labels
area: USB Universal Serial Bus Enhancement Changes/Updates/Additions to existing features platform: nRF Nordic nRFx

Comments

@koffes
Copy link
Collaborator

koffes commented Jul 14, 2020

Is your enhancement proposal related to a problem? Please describe.
Running the mentioned sample on the nRF52840. Vanilla setup, no changes to config.

The CPU loads are:
Idle: 4 %
Playback 33 %
Paused playback: 33 %. Goes down to 26 % after a while
Play and record: 52 %

Describe the solution you'd like
Please try to enable DMA. This will likely reduce CPU load significantly.

@emob-nordic @alexsven

@koffes koffes added the Enhancement Changes/Updates/Additions to existing features label Jul 14, 2020
@eobalski eobalski added the area: USB Universal Serial Bus label Jul 14, 2020
@eobalski eobalski self-assigned this Jul 14, 2020
@jfischer-no jfischer-no assigned jfischer-no and unassigned eobalski Nov 16, 2020
@alexsven
Copy link
Collaborator

alexsven commented Dec 3, 2020

I have done some testing on the headset sample with a nRF5340.

I have tested two set ups, one with stereo hp + stereo mic (vanilla sample) and another where I remove one channel from both hp and mic from the overlay file, thus creating a mono device.

The starting CPU load before any audio has been played is 10%, then I start the audio and I see that the CPU load goes up to 40% for stereo hp and 37% for mono hp. When I at the same time sink the mic line by recording with Audacity I get 63% for stereo and 57% for mono. When stopping audio and stopping sink I get 33% for both usecases after a while.

EDIT: CPU load was measured using
CONFIG_TRACING=y
CONFIG_TRACING_CPU_STATS=y
CONFIG_TRACING_CPU_STATS_LOG=y
CONFIG_TRACING_CPU_STATS_INTERVAL=5000

@jfischer-no jfischer-no changed the title High CPU load when running samples/subsys/usb/audio/headphones_microphone usb: audio: high CPU load when running headphones_microphone sample Dec 3, 2020
@alexsven
Copy link
Collaborator

alexsven commented Dec 3, 2020

Ran one more test: Headphones only
Starting CPU load: 7%
Playing audio: 28%
Paused: 21%

@ddavidebor
Copy link

@koffes I see this has been opened for a long time. Is there an update on this?

@koffes
Copy link
Collaborator Author

koffes commented Apr 26, 2021

@ddavidebor We are waiting for this issue to be resolved as part of #26935

@alexsven
Copy link
Collaborator

alexsven commented Feb 2, 2022

Testing again with v3.0.0-rc1 and nRF5340
Stereo headphones: 19% CPU,
Stereo headset: 22%, 10% is consumed by sysworkq.

This was run on an nRF5340

@alexsven
Copy link
Collaborator

alexsven commented Feb 2, 2022

Testing on nRF52840 I get:
Stereo headphones : 21%
Stereo headset: 24% for USB thread, 11% for sysworkq

@tmon-nordic tmon-nordic added the platform: nRF Nordic nRFx label Oct 19, 2023
@tmon-nordic
Copy link
Contributor

#64174 makes rather significant amount of cpu time available to application because it eliminates busy loop inside interrupt while waiting for DMA to finish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: USB Universal Serial Bus Enhancement Changes/Updates/Additions to existing features platform: nRF Nordic nRFx
Projects
None yet
Development

No branches or pull requests

6 participants