Post Go back to editing

Multiple Interrupts + Signal Routing on ADSP-21489

Category: Hardware
Product Number: ADSP-21489

Hi,

 I have an audio processing chain running on the board. Works fine with adi_int_InstallHandler(..).

To this I'm adding another interrupt to receive data on UART0_RX_I. UART is routed via DPI PinBuffer. I am still getting familiar with signal routing + interrupt handling on the board. How should I program such that both interrupts get triggered as needed?

...............

void main()
{
	int count=0;

	adi_initComponents();
	initPLL(); 
	initExternalMemory();
  init1939viaSPI(); /* configure AD1939 codec on the 21489 EZ-KIT */
	enable_SPORT01_MCM_mode(); /* Turn on SPORT0 TX and SPORT1 RX for Multichannel Operation */

	
  InitDAI(); /* Initialize DAI because the SPORT and SPI signals need to be routed */
  initDPI();

	 /* Initialize all the FX blocks used in signal chain */
	init_fx_blocks();

	/* Install and enable a handler for the SPORT1 Receiver interrupt.*/
	adi_int_InstallHandler(ADI_CID_P3I,(ADI_INT_HANDLER_PTR)process_AD1939_samples,NULL,true);

	*pPICR0 = 0x9DA95;

	adi_int_InstallHandler(ADI_CID_P3I, (ADI_INT_HANDLER_PTR)UARTisr, 0, true); // Install UART receiver interrupt

	*pUART0LCR = 0;

	*pUART0IER = UARTRBFIE;    // enables UART0 receive interrupt

	initUART();

	/* Enable multichannel operation (SPORT mode and DMA in standby and ready) */
	*pSPMCTL0 |= MCEA;
	*pSPMCTL1 |= MCEA;

	for (;;)
	  {
		if(count==10)
			puts("Talkthrough is running successfully");
		count++;
    	asm("idle;");
       }
}


void initDPI()
{
	SRU(UART0_TX_O, DPI_PB09_I);
	SRU(DPI_PB10_O, UART0_RX_I);
}

void initUART()
{
	/* Sets the Baud rate for UART0 */
	*pUART0LCR = UARTDLAB;  //enables access to Divisor register to set bauda rate
	*pUART0DLL = 0x8B;      //0x28b = 651 for divisor value and gives a baud rate of 19200 for peripheral clock of 200MHz
	*pUART0DLH = 0x02;

	/* Configures UART0 LCR */
	*pUART0LCR = UARTWLS8 | 				// word length 8
		UARTPEN | 				// parity enable ODD parity
		UARTSTB; 				// One stop bit


	*pUART0RXCTL = UARTEN;       //enables UART0 in receive mode

	*pUART0TXCTL = UARTEN;       //enables UART0 in core driven mode

}


void UARTisr()
{

	value[count] = *pUART0RBR;
	if (count >= N) {
		count = 0;
	}

}

Where InitDAI() is:

void InitDAI()
{
    clearDAIpins();


/*  Connect the AD1939 ADCs: The AD1939 drives a BCLK output to DAI pin 7,
 *  a frame sync to DAI pin 8 and TDM rx data to DAI pins 5
 *
 *  Connect the TDM ADC stream to SPORT1, using data input A
 *  All four lines are always inputs to the SHARC so tie the pin
 *  buffer inputs and pin buffer enable inputs all low.
 */

    SRU(DAI_PB07_O, SPORT1_CLK_I);   /* DAIP17 (RSCLK1) to SPORT1 CLK (CLK) */
    SRU(DAI_PB07_O, SPORT0_CLK_I);   /* DAIP7 (RSCLK1) to SPORT0 CLK (CLK)*/

    SRU(DAI_PB08_O, SPORT1_FS_I);    /* DAIP8 (RFS1) to SPORT1 FS (FS)*/
    SRU(DAI_PB08_O, SPORT0_FS_I);    /* DAIP8 (RFS1) to SPORT0 FS (FS)*/

    SRU(DAI_PB05_O, SPORT1_DA_I);    /* DAIP5 (DR1PRI) to SPORT1 DA (RX) */

    

/*  Connect the AD1939 DACs in TDM mode to SPORT0:
 *  The clock and frame sync inputs are provided by the ADCs
 *
 *  All DAC connections are always outputs from the SHARC
 *  so tie the pin buffer enable inputs all high.
 *  Connect the TDM DAC stream to SPORT0 A via DAI pin 12
 */

    SRU(HIGH, PBEN12_I);
    SRU(SPORT0_DA_O, DAI_PB12_I);    // DAIP 13 (DT1PRI)to SPORT0 DA (TX)
    


/* Route SPI signals to AD1939 Control Port. */

    SRU(SPI_MOSI_O, DPI_PB01_I);     /*Connect MOSI to DPI PB1. */
    SRU(DPI_PB02_O, SPI_MISO_I);     /*Connect DPI PB2 to MISO. */
    SRU(SPI_CLK_O, DPI_PB03_I);      /*Connect SPI CLK to DPI PB3.*/
    SRU(SPI_FLG0_O, DPI_PB04_I);     /*Connect SPI FLAG0 to DPI PB4.*/
    
    

/* Tie pin buffer enable from SPI peipheral to determine whether they are
 *  inputs or outputs
 */
    SRU(SPI_MOSI_PBEN_O, DPI_PBEN01_I);
    SRU(SPI_MISO_PBEN_O, DPI_PBEN02_I);
    SRU(SPI_CLK_PBEN_O, DPI_PBEN03_I);
    SRU(SPI_FLG0_PBEN_O, DPI_PBEN04_I);

}

  • Hi Rithesh,

    We understood that you are trying to set up one interrupt for audio processing and another for UART_RX. You've successfully installed handlers for these interrupts using the adi_int_InstallHandler() function, and you mentioned that the audio processing is working well. However, you're experiencing issues with the UART_RX interrupt.


    Please confirm whether our understanding is correct? If not, could you please provide more details about the problem? This information will help us assist you more effectively.

    Regards,
    Nandini C

  • Hi Nandini,

     You've understood it perfectly! I'm using SPORT1 interrupt [ADI_CID_P3I], but for both audio processing & UART_RX. Should I be using different interrupts?

    If so, how should I route the UART0_RX_I signal to raise an interrupt with a higher priority than audio processing? This is the current routing for UART:

    void initDPI()
    {
    	SRU(UART0_TX_O, DPI_PB09_I);
    	SRU(DPI_PB10_O, UART0_RX_I);
    }

  • Hi Rithesh,

    The processor core supports 19 programmable prioritized interrupts (P0I–P18I). Any peripheral interrupt output may be connected to any programmable priority interrupt input. You can change interrupt priority by using Programmable Interrupt Priority Control Registers (PICRx).

    For more information regarding this please refer the "Programmable Interrupt Priority Control" and "Programmable Interrupt Priority Control Registers" topics in ADSP-214xx SHARC ® Processor Hardware Reference manual which is available in below link:
    https://www.analog.com/media/en/dsp-documentation/processor-manuals/ADSP-214xx_hwr_rev1.1.pdf

    In default routing, the SPORT1 interrupt is connected to the destination interrupt P3I. To raise a UART0_RX interrupt with higher priority than SPORT1, you can use destination interrupt P1I. This can be accomplished by programming the PICR0 register. The code snippet below will help you route the UART0_RX interrupt with a higher priority than the audio processing interrupt.

    *pPICR0 = 0x1D276;

    /* Install and enable a handler for the SPORT1 Receiver interrupt.*/
    adi_int_InstallHandler(ADI_CID_P3I,(ADI_INT_HANDLER_PTR)process_AD1939_samples, NULL, true);

    /* Install UART receiver interrupt  */
    adi_int_InstallHandler(ADI_CID_P1I, (ADI_INT_HANDLER_PTR)UARTisr, 0, true);

    Regards,
    Nandini C

  • Thank you Nandini! It was the PICR programming that I missed. It works & makes sense now.