AnsweredAssumed Answered

SPORT interrupt never fired

Question asked by harders@khtronik.de on Feb 7, 2013
Latest reply on Feb 25, 2013 by MaheshN

Hello,

in the below posted code i try to setup SPORT1 on a ADSP-21262 to send data to a DAC. The framesync and bitclock signals are generated correctly and appear on the routed pins. But the interrupt for SPORT1 which should be triggered by the empty transmit buffer is never fired.

 

Code:

 

Main program

 

void main(void) {

 

    int ctlTmp;

 

    SRU_init();

    Timer_init();

    SPORT_init();

 

    adi_int_InstallHandler(ADI_CID_TMZHI, (ADI_INT_HANDLER_PTR)Timer_handleInterrupt, NULL, true);

 

    SPORT_initSPORT1();

    adi_int_InstallHandler(ADI_CID_SP1I, (ADI_INT_HANDLER_PTR)SPORT_handleSPORT1Interrupt, NULL, true);

 

    for(;;) {

    }

}

 

 

SRU init

 

void SRU_init(void)

{

    // PCG connections

    SRU(LOW, PBEN20_I);

    SRU(DAI_PB20_O, PCG_EXTA_I);

 

    // SPORT1 to DAC

    SRU(PCG_CLKA_O, SPORT1_CLK_I);

    SRU (HIGH, PBEN18_I);

    SRU (PCG_CLKA_O, DAI_PB18_I);

 

    SRU(PCG_FSA_O, SPORT1_FS_I);

    SRU (HIGH, PBEN16_I);

    SRU (PCG_FSA_O, DAI_PB16_I);

 

    // DAC data from SPORT1

    SRU (HIGH, PBEN15_I);

    SRU (SPORT1_DB_O, DAI_PB15_I);

}

 

 

SPORT setup and interrupt

 

#define CLK_DIVISOR 4

#define WORD_LENGTH (32 * CLK_DIVISOR)

#define FS_DIVISOR (2 * WORD_LENGTH)

 

void SPORT_init(void) {

    *pPCG_CTLA0 = 0;

    *pPCG_CTLB0 = 0;

    *pSPMCTL01 = 0;

    *pSPMCTL23 = 0;

    *pSPMCTL45 = 0;

    *pSPCTL0 = 0 ;

    *pSPCTL1 = 0 ;

    *pSPCTL2 = 0 ;

    *pSPCTL3 = 0 ;

    *pSPCTL4 = 0 ;

    *pSPCTL5 = 0 ;

 

    *pPCG_CTLA1 = CLKASOURCE | FSASOURCE | CLK_DIVISOR;

    *pPCG_PW = WORD_LENGTH;

    *pPCG_CTLA0 = ENCLKA | ENFSA | FS_DIVISOR;

}

 

void SPORT_initSPORT1() {

    // Configure SPORT1 for output to DAC (codec) as master

    *pSPCTL1 = SPTRAN | BHD | LAFS | OPMODE | SLEN24 | SPEN_B;

    *pDIV1 = 0;

    LED_toggle(1);

}

 

void SPORT_handleSPORT1Interrupt(int sig, void *pCBParam)

{

    LED_toggle(2);

    *pTXSP1B = 0x0055aa55;

}

Outcomes