Replies: 4 comments 33 replies
-
Great you are getting this started, this has been on my task list for a long time just not a real high priority. I couldn't make it work and keep up sync right away so pushed it aside. One thing that could be an issue in player task is the hardware timer used for inital sync. I believe its clock is influenced by frequency scaling?! Maybe take a lock while waiting for initial sync helps? The other thing which could be problematic is a jittery latency measurement because of power management. Have a look at esp_timer and how it is affected by PM. This is used for the time ping-pong with the server. I think relevant lwip send functions are called by periodic timer callbacks, maybe a bunch are missed because of sleep and then sent in a row. I don't think 40us will be a problem in a multiroom setup. For stereo speakers they probably are. If you have a oscilloscope you could use two boards and and measure the same channel on both to see sync. Use a metronome signal 120bpm or similar. |
Beta Was this translation helpful? Give feedback.
-
Finally, I was able to get some useful measurements. My reference is a x86 server that generated a lot of noise on the scope, so I needed some additional filtering. I really need to get a second esp+dac Anyway, here are the results, energy average over 0.5-2h:
Conclusions so far:
Not sure what's the best solution. When I have time I will experiment more. |
Beta Was this translation helpful? Give feedback.
-
Got it working now.
That's actually my current implementation. Muting is ignored, but when the pcm queue is empty, the player_task will kill itself.
Thanks, that was the missing part :) So my current implementation is:
This is working fine, but I don't like the implementation and won't create a PR. Now I would keep player_task running and just take/release locks, resync, block task etc when needed. If you agree, I would implement this and create a PR for it. Might take a while, though...my time is limited :D |
Beta Was this translation helpful? Give feedback.
-
I have nothing to commit but a question in general. Is there a way to power down the dacs if they aren't used for some time..? |
Beta Was this translation helpful? Give feedback.
-
Hey everyone, I have been looking into reducing idle current and want to share findings and get some new ideas.
My setup is not optimized and consists of a ESP32 DevKit with pcm5102a dac. I will always compare current floor. There are higher peaks when e.g. wifi is transmitting, so to be more accurate we would need to integrate over some time. But for a first comparison floor is good enough guess.
Default idle current is around 83mA, not too bad but still, the device is doing almost nothing.
Power management needs to be enabled through menuconfig (components->powermanagement) and then activated in the code. With this CPU frequency scaling can be activated. Automatic light sleep mode requires additionally tickless idle freeRTOS mode (components->FreeRTOS->tickless idle).
Using this, idle current can be decreased to:
So I configured frequency scaling and if available automatic sleep mode.
Then I used initially a lock to deactivate it when music is playing (I set the lock in the
audio_set_mute
function). This is working after boot-up, but once the device is muted and un-muted again, it is out of sync. I figured that some timers got confused by the frequency scaling and tried to automatically stop the player task whenever the device is muted or music is stopped and then re-initialize it when music resumes. I got this working after some try and error and with light sleep and freq scaling it seems to keep the sync. However, for freq scaling only it gets out of sync again. Additionally I am not sure if stopping the player task is the right thing to do. It should be enough to reset the sync when music resumes.You can find a proof-of-concept in https://github.com/luar123/snapclient/tree/power_reduction
(You need to configure your board and enable power management through menuconfig.)
I have two questions:
Enabling power management features comes at the cost of increased interrupt latency
: 0.2-40uS. Do you think (or can someone test and measure) this will have a significant influence on the overall sync?Beta Was this translation helpful? Give feedback.
All reactions