Post Go back to editing

Synch PCG A and B outputs

Category: Software
Product Number: ADSP-21569
Software Version: CCES 2.11.1

Hello,

I use an external oscillator to supply a 24.576 MHz clock as an input for PCG A and B. See the code below:

	//BCLK config TDM16
	ADI_PCG_CLK_INFO PCG_CLK_Inf_TDM16 =
	{
		ADI_PCG_CLK_EXT,              	//Clock Source
		1u,          					//Clock Divisor for 24.576 MHz
		false                           //External Trigger
	};

	//BCLK config TDM8
	ADI_PCG_CLK_INFO PCG_CLK_Inf_TDM8 =
	{
		ADI_PCG_CLK_EXT,              	//Clock Source
		2u,          					//Clock Divisor for 12.288 MHz
		false                           //External Trigger
	};

	//FS config for 48 kHz
	ADI_PCG_FS_INFO PCG_FS_Inf =
	{
		ADI_PCG_FS_EXT,                	//Clock Source
		512u,     					   	//Frame Sync Divisor 48 KHz
		256u,                           //Pulse Width
		0u,                            	//Phase
		false,                         	//External Trigger
		ADI_PCG_FSBYPASS_MODE_NORMAL   	//Bypass Mode normal
	};

	//Init
	adi_pcg_Init(ADI_PCG_DEV_A, &PCG_CLK_Inf_TDM8, &PCG_FS_Inf);
	adi_pcg_Init(ADI_PCG_DEV_B, &PCG_CLK_Inf_TDM16, &PCG_FS_Inf);

Clocks are working (checked with the scope). Both clocks are divided from the same input and therefore are working on the same timebase by default.

The question is, because the init functions of the clocks are called one after the other, could there be a time difference between the edges of the resulting clock signals?
Are the clocks sychronized internally?
How to ensure that the edges of both clocks are always (!) 100% synched? Is there an option to start the clocks with a trigger source like it is possible with SPORTS?
I just found the option to use an external trigger source clock, but that is not what I am searching for. I just want to start the clocks at the same time.

Kind regards,
Markus

Parents
  • Hi Markus,

    There is no Global Enable API for PCG for Sync operation in 2156x, it can be done by External trigger.

    The trigger with the external clock is enabled by setting bits 0 and 16 of the PCG_SYNC1/PCG_SYNC2 registers. The PCG_SYNC1 & 2 register allows programs to synchronize the clock frame sync units with external frame syncs. For instance, if PCG_SYNC1.FSA and PCG_SYNC1.FSB bits of the PCG_SYNC1 register is set, then the Frame Sync A and B will be synchronized with the External Frame Sync signal given to CLKB_CLKINSEL and CLKA_CLKINSEL via SRU.


    For better assistance, let us know if you're facing any issue in synchronization, if you use external trigger to sync.

    Regards,
    Divya.P

  • Hi Divya,

    is there no solution to synchronize two PCGs in an easy way? I think that should be a normal basic function... It does me no good if it is possible to sync the SPORTs when the clocks aren't running synchronized.

    In my use case I don't have an external LRCLK to sync to. To generate the clocks I use a 24.576 MHz oscillator. Is there any workaround to sync the outputs of PCG A and B?
    Is a continous clock signal needed to use the sync function of PCG? Or is it possible to use a GPIO pin and generate a zero to one transition as a sync impulse?

    Regards,
    Markus

  • Hi Markus

    Unfortunately, there is no "adi_pcg_Global_Enable" API available in 2156x products. It only supports latest SC59x products.

    You can sync both LRClk by configuring another PCG device as a trigger source. Also, you can simply configure a DAI pin in a high state and give as external trigger using PCG0_SYNC_CLKx_I API.
     
    Regards,
    Divya.P

  • Hi Divya,

    how do I use a DAI pin to do the sync of two PCGs? Do I set both PCGs to external trigger, and then set a DAI pin high with the SRU() macro?

    Please give me a short code example.

    Regards,
    Markus

  • Hi Markus,

    Please refer the simple project. In that PCGA and PCGB Framesync is triggered by DAI0 pin8.PCG_Trigger_21569.zip

    Regards,
    Divya.P

  • Hi Divya;

    TRM says

    3. SRU is the input source. If the input clock and trigger signal are synchronous, the delay is exactly 3 input clock periods. If asynchronous, it varies between 2.5 to 3.5 input clock periods depending on the phase difference between the input clock and trigger signal.

    If  both PCG A and B are sourcing clock from CLKIIN, DAI0 pin8 is asynchronous to CLKIN, does the tigger delay vary between PCG A and B?

    I.e. would it be possible that PCG A triggers output after 2.5 CLKIN period and PCG B triggers output after 3.5 CLKIN period?

    Best Regards,

    Totoro

  • Hi Totoro,

    Here PCG FS Synchronization depends on trigger only that means DAI0_Pin8. So, both FS occur in same time.

    Regards,

    Nandini C

  • Hi Nandini,

    If both FSA and FSB occur in same time, then DAI0_PIN8 trigger to PCG A and PCG B delay is same right?

    I.e both are 2.5 CLKIN or 3.5 CLKIN.

    Best Regards,

    Totoro

  • Hi Totoro,

    Yes, your understanding is correct. PCG A and PCG B have same delay.

    Regards,

    Nandini C

Reply Children
No Data