Other Parts Discussed in Thread: OMAP-L138
hi,
I am using Omap-l138 the ARM side. I want to use the Mcasp port in CPU interrupt mode to output audio signal through the codec.
what I got is no out put at AXR11 pin. I did some debuging through serial port and found that the ISR is called three times only.
here is the code I used to setup the ARM INTC and Mcasp and the ISR.
hope you help me with it.
regards.
uint32_t MCASP_init(void)
{
// enable the psc and config pinmux for mcasp.
EVMAM1808_lpscTransition(PSC1, DOMAIN0, LPSC_MCASP0, PSC_ENABLE);
EVMAM1808_pinmuxConfig(PINMUX_MCASP_REG_0, PINMUX_MCASP_MASK_0, PINMUX_MCASP_VAL_0);
EVMAM1808_pinmuxConfig(PINMUX_MCASP_REG_1, PINMUX_MCASP_MASK_1, PINMUX_MCASP_VAL_1);
// reset mcasp.
MCASP->GBLCTL = 0;
// configure receive registers.
MCASP->RMASK = 0xFFFFFFFF;
MCASP->RFMT = 0x00008078;
MCASP->AFSRCTL = 0x00000112;
MCASP->ACLKRCTL = 0x000000B3;
MCASP->AHCLKRCTL = 0x00000000;
MCASP->RTDM = 0x00000003;
MCASP->RINTCTL = 0x00000000;
MCASP->RCLKCHK = 0x00FF0008;
MCASP->XMASK = 0x0000FFFF;
MCASP->XFMT = 0x0001807c;
MCASP->AFSXCTL = 0x00000112;
MCASP->ACLKXCTL = 0x000000B3;
MCASP->AHCLKXCTL = 0x00008004;
MCASP->XTDM = 0x00000003;
MCASP->XINTCTL = 0x00000000;
MCASP->XCLKCHK = 0x00FF0008;
// config serializers (11 = xmit, 12 = rcv).
MCASP->SRCTL11 = 0x000D;
MCASP->SRCTL12 = 0x000E;
// config pin function and direction.
MCASP->PFUNC = 0;
MCASP->PDIR = 0x14000800;
//
MCASP->DITCTL = 0x00000000;
MCASP->DLBCTL = 0x00000000;
MCASP->AMUTE = 0x00000000;
MCASP->XSTAT = 0x0000FFFF; // Clear all
MCASP->RSTAT = 0x0000FFFF; // Clear all
return (ERR_NO_ERROR);
}
void McASP_Start_TTO(void){
SETBIT(MCASP->XGBLCTL, XHCLKRST);
while (!CHKBIT(MCASP->XGBLCTL, XHCLKRST)) {}
SETBIT(MCASP->RGBLCTL, RHCLKRST);
while (!CHKBIT(MCASP->RGBLCTL, RHCLKRST)) {}
SETBIT(MCASP->XGBLCTL, XCLKRST);
while (!CHKBIT(MCASP->XGBLCTL, XCLKRST)) {}
SETBIT(MCASP->RGBLCTL, RCLKRST);
while (!CHKBIT(MCASP->RGBLCTL, RCLKRST)) {}
SETBIT(MCASP->XINTCTL, XDATA);
while (!CHKBIT(MCASP->XINTCTL, XDATA)) {}
SETBIT(MCASP->XGBLCTL, XSRCLR);
while (!CHKBIT(MCASP->XGBLCTL, XSRCLR)) {}
SETBIT(MCASP->RGBLCTL, RSRCLR);
while (!CHKBIT(MCASP->RGBLCTL, RSRCLR)) {}
/* Write a 0, so that no underrun occurs after releasing the state machine */
MCASP->XBUF11 = 0;
//MCASP->RBUF12 = 0;
SETBIT(MCASP->XGBLCTL, XSMRST);
while (!CHKBIT(MCASP->XGBLCTL, XSMRST)) {}
SETBIT(MCASP->RGBLCTL, RSMRST);
while (!CHKBIT(MCASP->RGBLCTL, RSMRST)) {}
SETBIT(MCASP->XGBLCTL, XFRST);
while (!CHKBIT(MCASP->XGBLCTL, XFRST)) {}
SETBIT(MCASP->RGBLCTL, RFRST);
while (!CHKBIT(MCASP->RGBLCTL, RFRST)) {}
// wait for transmit ready and send a dummy byte.
while(!CHKBIT(MCASP->SRCTL11, XRDY)) {}
MCASP->XBUF11 = 0;
}
void mcasp_isr(){
if(CHKBIT(MCASP->SRCTL11, XRDY))
{ //if ISR triggered by XRDY...
dataOut32 = cos_table[sample];
sample++;
MCASP->XBUF0=dataOut32;
UART_txByte(DEBUG_PORT,'0');
}
CLRBIT(aintcRegs->SICR,0x3ff);
SETBIT(aintcRegs->SICR,54);
}
void setup_ARM_INTC (void)
{
// Reset AINTC
aintcRegs->ECR1 = AINTC_SYSINT_0_31_ALL;
aintcRegs->ECR2 = AINTC_SYSINT_32_63_ALL;
aintcRegs->ECR3 = AINTC_SYSINT_64_95_ALL;
aintcRegs->SECR1 = AINTC_SYSINT_0_31_ALL;
aintcRegs->SECR2 = AINTC_SYSINT_32_63_ALL;
aintcRegs->SECR3 = AINTC_SYSINT_64_95_ALL;
sysISRtbl[AINTC_EVENTID_MCASP_INT] = mcasp_isr;
aintcRegs->VBR = (unsigned int) sysISRtbl; // Assign the ISR Table Address to VBR
aintcRegs->VSR = 0;
CLRBIT(aintcRegs->CMR13, AINTC_CMR13_CHNL_NPLUS2_MASK); // Map MCASP Interrupts to Channel 2
SETBIT(aintcRegs->CMR13, 0x00020000);
CLRBIT(aintcRegs->EISR,AINTC_EISR_INDEX_MASK); // Enable MCASP Interrupts
SETBIT(aintcRegs->EISR,AINTC_EVENTID_MCASP_INT);
SETBIT(aintcRegs->HIEISR,ENABLE_IRQ_INTERRUPT); /* Enable IRQ Interrupts */
SETBIT(aintcRegs->GER,AINTC_GER_ENABLE_MASK); /*enable global INT*/
}