We've roughly based our design on the L2 reference design, getting rid of some of its features we didn't need, changing out the clocking mechanism, replacing it with a low jitter clock and algorithm. We've also changed the DAC and some back end stuff.
It seems to work very well and sound great except that I can't seem to change SPDif frequencies more than 7 times.
The system seems to hang.
After some tracing, it seems to hang in decouple.xc, where it tells the audio thread that the frequency has changed.
It sends a token into delivery in audio.xc, which shuts it down, reinitializes and it sends a token back to the decouple thread. The decouple thread waits for this token, reinitializes some things, turns the interrupt back on and it is ready to receive more SPDif data, at the higher speed this time.
Well, this works well for up to 7 times. After 7 times, the handshake token from the audio thread is not being received by the decouple thread, for some reason.
I've put some test points where the token is sent and where the token is received. It clearly hangs waiting for the token.
The following code can be found in decouple, around line 750 or so:
/* Wait for handshake back and pass back up */
p_USB_debugLED <: 1; // turn on debug LED
p_USB_debugLED <: 0; // turn on debug LED
What could be the cause for this? Can a channel go bad somehow? Could I have run out of heap or stack somehow? It does it at after switching sampling rates exactly 7 times. It does not matter what rates I use - any of them will do the same thing.
Any light shed on this would be greatly appreciated.