Hi again everyone, I'm currently writing a driver to interface between the McBsps on my c6711DSK and the AIC23EVM Codec. Currently I am at the stage where I can do all the Control (via mcbsp1) and I can also read from the ADCs on the Codec via McBSP0. My problem though is that I cant write to the DACs, despite the fact that the the timing diagram for reading and writing to the codec via McBsp0 is the same. Control is via McBSP1, and McBSP1 acts as master. Data transfer is via McBSP0 and this time the Codec acts as master and supplies the Clk and frame sync for transer of data to the dacs, and from the adc. I initialize my McBSPs as follws - Note: I initalize SPCR further in my code. // CONTROL MCBSP_Config DSS_mcbspCfg1 = { 0x02301000, /* Serial Port Control Reg. (SPCR) */ 0x00000040, /* Receiver Control Reg. (RCR) */ 0x00000040, /* Transmitter Control Reg. (XCR) */ 0x20030F03, /* Sample-Rate Generator Reg. (SRGR) */ 0x00000000, /* Multichannel Control Reg. (MCR) */ 0x00000000, /* Receiver Channel Enable(RCER) */ 0x00000000, /* Transmitter Channel Enable(XCER) */ 0x00000A0F /* Pin Control Reg. (PCR) */ }; // DATA TRANSFER MCBSP_Config DSS_mcbspCfg0 = { 0x02000000, /* Serial Port Control Reg. (SPCR) */ 0x000100A0, /* Receiver Control Reg. (RCR) */ 0x000000A0, /* Transmitter Control Reg. (XCR) */ 0x30000000, /* Sample-Rate Generator Reg. (SRGR) */ 0x00000000, /* Multichannel Control Reg. (MCR) */ 0x00000000, /* Receiver Channel Enable(RCER) */ 0x00000000, /* Transmitter Channel Enable(XCER) */ 0x0000000E /* Pin Control Reg. (PCR) */ }; My Code simply involves polling until the mcbsps are ready to transmit or recieve audio data. The data I'm recieving is exactly right - I'm getting the correct number of samples per period for the sin wave inputing to the Codec. I'm interested in knowing what McBSP values I should play around with. I'm not getting any sound what so ever from the headphones when I attempt to write to the DACS. I have Sidetone (Bypass - Mic to headphones) enabled, so I can hear sounds if I connect a microphone to the Mic input. I've tried reading the Din and Dout values as they are transmitted to and from the Codec, but they are too fast for my scope to pickup correctly. Hope you can help. DSS_init is called from main. Regards, Barry. Void DSS_init(Void) { Uns t1; Uns t2; Uns src; Int i; Float f1; Float f2; Float div = (float)(0x7fff); // Enable Transmit and Recieve /////////////////////////////////////////////////////////////// MCBSP_RSETH(DSS_hMcbsp1, SPCR, 0x02F11001); MCBSP_RSETH(DSS_hMcbsp0, SPCR, 0x02010001); ////////////////////////////////////////////////////////////// initRegs(); // poll forever for(;;) for (i=0;i<100000;i++) { // sin for output, both left and right channels f1 = f2 = 0.1*cos( ( 2.0 * 3.14 * 300.0 ) * i/44100.0 ); t1 = f1 * div; t1 &= 0xffff; t2 = f2 * div; t2 &= 0xffff; t2 <<= 16; t1 = t1 | t2; // write to DACs spWrite(DSS_hMcbsp0, t1); // read from ADCs src = spRead(DSS_hMcbsp0); // convert input data to right and left values in floating point form t1 = src &0xffff; t2 = (src>>16) & 0xffff; if(t1 & 0x8000) t1 |= 0xFFFF0000; if(t2 & 0x8000) t2 |= 0xFFFF0000; f1 = (((Float)((Int)(t1)))/div); f2 = (((Float)((Int)(t2)))/div); LOG_printf(&trace,"0"); LOG_printf(&trace,"%lf",f1); } } // Read McBsp Uns spRead(MCBSP_Handle hMcBsp) { // Poll until new value ready to read while ((MCBSP_RGETH(DSS_hMcbsp0, SPCR) & 0x2) == 0); return MCBSP_read(hMcBsp); } // Write from McBsp to AIC23 Void spWrite(MCBSP_Handle hMcBsp, Uns data) { // Poll until ready to transmit while ((MCBSP_RGETH(hMcBsp, SPCR) & 0x20000) == 0); MCBSP_write(hMcBsp,data); } // Write to a Control Reg on AIC23 Void aic23_write_reg(Uns uiAddress, Uns uiData) { spWrite(DSS_hMcbsp1, ((uiAddress << 9) | uiData) ); } //Init AIC23 - CONTROL static Void initRegs() { aic23_write_reg(0x0F, 0x01); // reset aic23_write_reg(0x0F, 0x00); aic23_write_reg(0x06, 0x00); /* power up */ aic23_write_reg(0x04, 0xf4); /* aapc */ aic23_write_reg(0x07, 0x53); /* daif */ aic23_write_reg(0x08, (0x8<<2)); /* src */ aic23_write_reg(0x09, 0x01); /* dia */ } |