Post Go back to editing

SPORT Global Interrupt/Trigger Feature for ADSP21569

Category: Software

HI

I have some question about 

1)how to enable the Global Group Interrupts/triggers are supported on ADSP-2156x ?

I refer to the following  SPORT Global feature examples  in

- "(ADSP-2156x_EZ-KIT Software install path)\ADSP-2156x_EZ-KIT\Examples\drivers\sport\SPORT_Global_Enable_I2S_Mode"

- "(ADSP-2156x_EZ-KIT Software install path)\ADSP-2156x_EZ-KIT\Examples\\drivers\adc\SPT_GBL_Audio_Passthrough_TDM"

- "(ADSP-2156x_EZ-KIT Software install path)\ADSP-2156x_EZ-KIT\Examples\\drivers\adc\SPT_GBL_Audio_Passthrough_I2S"。

When I enable the SPORT Global Interrupt/Trigger Feature,but cannot enter interrupts while the program is running。

The code is as follows:

/* SPORT return code */
    ADI_SPORT_RESULT    eResult;

	/* Open the SPORT Device 1A */
	eResult = adi_sport_Open(SPORT_DEVICE_1A,ADI_HALF_SPORT_A,ADI_SPORT_DIR_RX, ADI_SPORT_MC_MODE, SPORTMemory1A, ADI_SPORT_MEMORY_SIZE, &hSPORTDev1ARx);
	CHECK_RESULT(eResult);

	/* Configure the data,clock,frame sync and MCTL of SPORT Device 1A*/
	eResult = adi_sport_ConfigData(hSPORTDev1ARx, ADI_SPORT_DTYPE_ZERO_FILL,31,false,false,false);
	CHECK_RESULT(eResult);
	eResult = adi_sport_ConfigClock(hSPORTDev1ARx,0,false,false,false);
	CHECK_RESULT(eResult);
	eResult = adi_sport_ConfigFrameSync(hSPORTDev1ARx,0,false,false,false,true,false,false);
	CHECK_RESULT(eResult);
	eResult = adi_sport_ConfigMC(hSPORTDev1ARx, 1u, 8-1, 0u, false);
	CHECK_RESULT(eResult);
	eResult = adi_sport_SelectChannel(hSPORTDev1ARx,0u,8-1);
	CHECK_RESULT(eResult);

	/* Open the SPORT Device 1B */
	eResult = adi_sport_Open(SPORT_DEVICE_1B,ADI_HALF_SPORT_B,ADI_SPORT_DIR_RX, ADI_SPORT_MC_MODE, SPORTMemory1B, ADI_SPORT_MEMORY_SIZE, &hSPORTDev1BRx);
	CHECK_RESULT(eResult);
	/* Configure the data,clock,frame sync and MCTL of SPORT Device 1B*/
	eResult = adi_sport_ConfigData(hSPORTDev1BRx, ADI_SPORT_DTYPE_ZERO_FILL,15,false,false,false);
	CHECK_RESULT(eResult);
	eResult = adi_sport_ConfigClock(hSPORTDev1BRx,0,false,false,false);
	CHECK_RESULT(eResult);
	eResult = adi_sport_ConfigFrameSync(hSPORTDev1BRx,0,false,false,false,true,false,false);
	CHECK_RESULT(eResult);
	eResult = adi_sport_ConfigMC(hSPORTDev1BRx, 1u, 16-1, 0u, false);
	CHECK_RESULT(eResult);
	eResult = adi_sport_SelectChannel(hSPORTDev1BRx,0u,16-1);
	CHECK_RESULT(eResult);

	/* Open the SPORT Device 4A */
	eResult = adi_sport_Open(SPORT_DEVICE_4A,ADI_HALF_SPORT_A,ADI_SPORT_DIR_TX, ADI_SPORT_MC_MODE, SPORTMemory4A,ADI_SPORT_MEMORY_SIZE,&hSPORTDev4ATx);
	CHECK_RESULT(eResult);

	/* Configure the data,clock,frame sync and MCTL of SPORT Device 4A*/
	eResult = adi_sport_ConfigData(hSPORTDev4ATx,ADI_SPORT_DTYPE_SIGN_FILL,31,false,false,false);
	CHECK_RESULT(eResult);
	eResult = adi_sport_ConfigClock(hSPORTDev4ATx,0,false,false,false); /** 选用外部时钟,该指令无效 **/
	CHECK_RESULT(eResult);
	eResult = adi_sport_ConfigFrameSync(hSPORTDev4ATx,0,false,false,false,true,false,false);
	CHECK_RESULT(eResult);
	eResult = adi_sport_ConfigMC(hSPORTDev4ATx,1u,7u,0u,false);
	CHECK_RESULT(eResult);
	eResult = adi_sport_SelectChannel(hSPORTDev4ATx,0u,7u);
	CHECK_RESULT(eResult);


    /******************************* Prepare data buffers and Prepare descriptors***********************************************/

	/* Buffer initialization*/
	mic_buffer_init( );
	spk_buffer_init();
	VOLUME =0x3FFF;
	RX_buf_idle = 1;
	/* Prepare descriptors */
	PrepareDescriptors_Dest( );
	PrepareDescriptors_Src();
//	spk_prepare_descriptors();

    /**************************************************Sport Global Group Array Handle***********************************************************/
	SportTxDai1Array[0]= hSPORTDev4ATx;
//	SportTxDai1Array[1]= hSPORTDev1ATx;

    SportRxDai0Array[0]= hSPORTDev1ARx;
    SportRxDai0Array[1]= hSPORTDev1BRx;

    eResult = adi_sport_DMATransfer(hSPORTDev1ARx,&iDESC_LIST_1_SP1A[0],(RNC_DMA_NUM_DESC),ADI_PDMA_DESCRIPTOR_LIST, ADI_SPORT_CHANNEL_PRIM);
	CHECK_RESULT(eResult);
	eResult = adi_sport_DMATransfer (hSPORTDev1BRx, &iDESC_LIST_1_SP1B[0], RNC_DMA_NUM_DESC, ADI_PDMA_DESCRIPTOR_LIST, ADI_SPORT_CHANNEL_PRIM );
	CHECK_RESULT(eResult);
	/* Submit the first buffer for Tx.  */
	eResult = adi_sport_DMATransfer(hSPORTDev4ATx,&iSRC_LIST_1_SP4A[0],(RNC_DMA_NUM_DESC),ADI_PDMA_DESCRIPTOR_LIST, ADI_SPORT_CHANNEL_PRIM);
	CHECK_RESULT(eResult);

	/**************************************************Create Global Groups*****************************************************/
	eResult = adi_sport_CreateGlobalGroup(SportTxDai1Array,1u,&hDai1Group0Tx,false,true);
	CHECK_RESULT(eResult);

	eResult = adi_sport_CreateGlobalGroup(SportRxDai0Array,2u,&hDai0Group1Rx,false,true);
	CHECK_RESULT(eResult);

	/* Register Global callback for RX group*/
	eResult = adi_sport_GlobalRegisterCallback(hDai0Group1Rx,SPORTCallbackRx,NULL);
	CHECK_RESULT(eResult);
	/* Register Global callback for TX group*/
	eResult = adi_sport_GlobalRegisterCallback(hDai1Group0Tx,SPORTCallbackTx,NULL);
	CHECK_RESULT(eResult);

	/* Global sport enable */
	eResult = adi_sport_GlobalEnable(true);
	CHECK_RESULT(eResult);

	/* wait for Codec to up */
	int delay11=0xffff;
	delay11=0xffff;
	while(delay11--)
	{
		asm("nop;");
	}

	return eResult;

2)If 32 channels in each SPORTs could be group together, I need to make two groups, one group is SPORT4A,SPORT4B as TX, another group is SPORT1A,SPORT1B,SPORT2A,SPORT2B as RX, this group cross both DAI0 and DAI1,  is it possible to enable the two groups together.or how to enable sports at the same time?

  • Hi,

    Regarding 1: From the code you have shared, we see that ‘bGblTrigEnable’ option is disabled in adi_sport_CreateGlobalGroup api. Did you try with bGblTrigEnable as true?
    We recommend to run SPORT_Global_Enable_I2S_Mode example from BSP package then set breakpoint inside SPORTCallbackTx function and run it. You can see that SPORTCallbackTx is hitting.

    Regarding 2, DAI0 includes SPORT0 to SPORT3 instances while DAI1 includes SPORT4 to SPORT7 instances. If SPORT device instance's grouping is done across DAIs, then Maximum of two global groups can be created. In such scenarios, create two global groups using adi_sport_CreateGlobalGroup() api twice and then call "adi_sport_GlobalEnable()" api. This will ensure that the all the sport instances across DAIs are enabled at the same time. adi_sport_CreateGlobalGroup() api should be called to created a group of sports within a single DAI.

    Regards,
    Divya.P

  • HI Divya.P

    Can you explain the difference between interrupt and trigger  for the DMA transfer。

    I know that an interrupt will be generated when data transmission or reception is completed。

    Regards

  • Hi,

    In embedded processor systems, synchronization of operation between events is of paramount importance. Interrupts are a common way of synchronizing operation between events. These can be timed by enabling the first event as an interrupt, which gets detected by the core. On detection of the interrupt, the core can start or stop a new process or event. Interrupts provide a reliable synchronization medium as they are serviced through the processor core.

    However, interrupts can add latency due to the time needed for core detection, context saving, and event servicing. The event processing latency depends on many conditions, such as priority levels or handling of simultaneous interrupts.  The TRU is particularly well suited for system events synchronization, helping reduce the delays involved in the synchronization process, as it removes the core processing of the event and increases determinism. Therefore, the TRU provides an efficient alternative to core interrupts for event synchronization in embedded systems.


    Regards,
    Divya.P