Skip to main content
Visitor
Oct 29, 2026 5:22 PM UTC
Question

Threadx USBX audio thread and peripheral thread

I’m trying to get two threads running, one that changes audio volume based on a rotary encoder input and one that actually pipes the music to the speaker. I am able to get both working independently with good audio on the audio thread, but I cannot get BOTH threads to work at the same time. I’ve been tweaking the thread priority, preemption priority, time slice/no time slice, and thread sleep parameters (the sleep not being a parameter but just a tx_thread_sleep() call and the end of the thread while loop). My last iteration had the following params and still didnt work:
Volume thread:

  • Priority: 16
  • Preempt: 0
  • Time slice: 1
  • sleep: 100

USB Audio thread:

  • Priority 15
  • Preempt: 15
  • Time slice: 200
  • sleep: 1
     

Would love to get direction in getting BOTH working with clear audio.