Post Go back to editing

Understanding adi_spdif_Rx_EnableAutoAudioRestart

Thread Summary

The user asks if the adi_spdif_Rx_EnableAutoAudioRestart() function in CCES 3.0.2 handles PLL re-lock after stream interruptions. The final answer clarifies that this function only restarts the audio data path and does not reset the NCO; an ISR must be implemented to toggle SPDIF_RX_CTL.RST for reliable PLL re-lock. The accompanying answer suggests monitoring SPDIF_RX_STAT.LOCKLOSS and SPDIF_RX_STAT.LOCK bits to detect reconnection and ensure proper lock.
AI Generated Content
Category: Software
Product Number: ADSP21565

The hardware reference manual on p. 1257 states the following:

Interrupted Data Streams on the Receiver
When using the S/PDIF receiver with data streams that are likely to be interrupted, (in other words unplugged and
reconnected), it is necessary to take some extra steps to ensure that the S/PDIF receiver’s digital PLL will relock to
the stream. The steps to accomplish this are described below.
1. Set up interrupts within the DAI so that the S/PDIF receiver can generate an interrupt when the stream is
reconnected.
2. Within the interrupt service routine (ISR), stop and restart the NCO. This is accomplished by setting and then
clearing the SPDIF_RX_CTL.RST bit.
3. Return from the ISR and continue normal operation.
This method of resetting the NCO has been shown to provide extremely reliable performance when the S/PDIF
inputs are interrupted or unplugged momentarily

I'm using the SPDIF Rx driver provided in CCES 3.0.2, which includes the following function: adi_spdif_Rx_EnableAutoAudioRestart.

My question is, does that function perform the steps mentioned in the reference manual, or do I still need to manually implement the ISR myself?

Parents
  • On closer reading of the manual, I think there is a difference between them. 

    To expand my question then, is there an example of how to generate interrupts upon stream reconnection? Is it just a case of setting up an interrupt on SPDIF_RX_STAT.LOCKLOSS, or is there more to it? SPDIF_RX_STAT.LOCKLOSS looks like it is more general than simply detecting re-connection events.

  • Hi Michael,

    Regarding "Q1"
    >>>The adi_spdif_Rx_EnableAutoAudioRestart() restarts only the audio data path and does not reset the NCO. To ensure proper PLL re-lock after an interrupted stream, you still need to implement an ISR that toggles SPDIF_RX_CTL.RST.

    Regarding "Q2"
    >>> The SPDIF_RX_STAT.LOCKLOSS bit in the Receive Status Register indicates that the receiver has lost locking of the audio stream. During reconnection, you need to monitor the SPDIF_RX_STAT.LOCK (or SPDIF_RX_STAT.VALID) bit and detect a rising edge (0 → 1) and check if an interrupt is set and SPDIF_RX_STAT.LOCKLOSS bit status has changed. Upon detecting reconnection, you may need to reset the SPDIF NCO/PLL (SPDIF_RX_CTL.RST) to properly relock the audio stream — as you mentioned, SPDIF_RX_STAT.LOCKLOSS goes high immediately when the SPDIF receiver detects an error or loss of the incoming stream. Once this is set, the bit remains high until the SPDIF_RX_CTL.RSTRTAUDIO bit is toggled, to ensure the lock is set and audio stream continues without any issue.

    Regards,
    Nandini C

Reply
  • Hi Michael,

    Regarding "Q1"
    >>>The adi_spdif_Rx_EnableAutoAudioRestart() restarts only the audio data path and does not reset the NCO. To ensure proper PLL re-lock after an interrupted stream, you still need to implement an ISR that toggles SPDIF_RX_CTL.RST.

    Regarding "Q2"
    >>> The SPDIF_RX_STAT.LOCKLOSS bit in the Receive Status Register indicates that the receiver has lost locking of the audio stream. During reconnection, you need to monitor the SPDIF_RX_STAT.LOCK (or SPDIF_RX_STAT.VALID) bit and detect a rising edge (0 → 1) and check if an interrupt is set and SPDIF_RX_STAT.LOCKLOSS bit status has changed. Upon detecting reconnection, you may need to reset the SPDIF NCO/PLL (SPDIF_RX_CTL.RST) to properly relock the audio stream — as you mentioned, SPDIF_RX_STAT.LOCKLOSS goes high immediately when the SPDIF receiver detects an error or loss of the incoming stream. Once this is set, the bit remains high until the SPDIF_RX_CTL.RSTRTAUDIO bit is toggled, to ensure the lock is set and audio stream continues without any issue.

    Regards,
    Nandini C

Children
No Data