This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM620-Q1: Synchronization of McASP instances

Part Number: AM620-Q1

Tool/software:

We are working with a system based on the AM62X, designed for audio applications. It uses three TDM lines:

  • McASP0 – receives all clocks externally, including FSync, BitClk, and MClk
  • McASP1 – generates FSync and BitClk from an external MClk
  • McASP2 – also generates FSync and BitClk from the same external MClk

Since all TDM lines share a common external MClk, they are effectively driven by a single clock source.

I would like to understand how to ensure proper synchronization at startup—specifically, how to align all FSync signals to avoid jitter or phase misalignment.

  • Hi Wojciech,

    There was a similar frame sync alignment implementation that was made for AM273 board and 2 McASP instances. The theoretical process will look somewhat like - 

    Step 1: Peripheral Configuration
    The system is initialized by configuring the necessary hardware modules:

    • McASP1 (Reference): Configured to transmit a TDM stream with a 48kHz FSYNC rate. This serves as the timing reference.

    • McASP2 (Target): Configured to transmit a TDM stream with a 48kHz FSYNC rate. This is the output to be adjusted.

    • eCAP1 (Reference Monitor): Set to capture the timestamp of each rising edge of the McASP1 FSYNC and to trigger an ISR upon this event.

    • eCAP2 (Target Monitor): Set to capture the timestamp of each rising edge of the McASP2 FSYNC.

      [eCAP (Enhanced Capture Module) is a A high-precision timer peripheral used for capturing event timestamps, such as the rising edge of an FSYNC signal.]

    Step 2: Event Capture and Measurement
    Upon the arrival of the 48kHz FSYNC from McASP1, the following occurs autonomously:

    1. eCAP1 captures the McASP1 FSYNC timestamp.

    2. The configured interrupt is asserted, triggering the execution of the ISR.

    3. eCAP2 captures the McASP2 FSYNC timestamp.

    Step 3: Phase Error Calculation and Evaluation
    Inside the ISR, the processor performs the following calculations:

    1. Read Timestamps: The timestamp values from eCAP1 and eCAP2 registers are read.

    2. Calculate Phase Error (Δt): The phase deviation is calculated as Δt = timestamp(eCAP2) - timestamp(eCAP1).

    3. Evaluate Tolerance: The absolute value of the phase error, |Δt|, is compared against a pre-defined tolerance threshold.

    Step 4: Phase Correction
    Based on the evaluation, a decision is made:

    • If Within Tolerance: The system is considered synchronized. The ISR exits with no corrective action.

    • If Outside Tolerance: A phase correction is required. The ISR initiates a "clock nudge" on the BCLK of McASP2. This controlled, single-cycle delay realigns the McASP2 FSYNC pulse with the McASP1 reference, reducing the phase error in the next cycle.

    The below image shows how this is done. [ This is just for reference. But can be used for understanding purpose ]

    Regards,
    Ritapravo

  • Hello Ritapravo,

    I have a question regarding the use of eCAP. I couldn't find any information in the AM62 documentation about the possibility of internal routing between eCAP and McASP. Is it only possible to connect them by physically wiring the pins together on the PCB?

    Regards,
    Sebastian

  • Hi Sebastian,

    I couldn't find any information in the AM62 documentation about the possibility of internal routing between eCAP and McASP.

    Yes, the McAP pins have to be physically routed to the eCAP module. 

    Regards,
    Ritapravo

  • Hi Ritapravo,

    Can you provide more information on how to implement the “clock nudge” feature in McASP? I see the logic for a one-time adjustment in the AHCLKXCTL register, but I don't see any changes in clock synchronization after writing a value to HCLKXADJ. Is this the correct part of the McASP register logic, or is there something else?

    Regards,

    Patryk

  • Hi Patryk,

    I haven't checked this feature for AM62x devices. I will check into AM62x details and then get back to you.

    Regards,
    Ritapravo