DSPRelated.com
Forums

need help on mcbsp configuration

Started by jeev...@yahoo.co.in June 6, 2007
hi alll,

im trying to interface an EEPROM(AT93c56) with my 6713 by using MCBSP. i have tried by many ways but i couldnt get any output. that is , when i check the FSX0/1, CLKX0/1, DX0/1 on peripheral expansion connector, i didnt get any signal on my CRO, and i have given my code here. can any one plz help me on this,

/* followed by spra488c.pdf polling method */

#include "test2cfg.h"
#include
#include
#include

#include
#include
#include

MCBSP_Handle hMcbsp0;

static MCBSP_Config Mcbsp_Config = {
MCBSP_RCR_RMK(
MCBSP_RCR_RPHASE_SINGLE,
MCBSP_RCR_RFRLEN2_OF(0),
MCBSP_RCR_RWDLEN2_8BIT,
MCBSP_RCR_RCOMPAND_MSB,
MCBSP_RCR_RFIG_NO,
MCBSP_RCR_RDATDLY_1BIT,
MCBSP_RCR_RFRLEN1_OF(0),
MCBSP_RCR_RWDLEN1_8BIT,
MCBSP_RCR_RWDREVRS_DISABLE
),
MCBSP_XCR_RMK(
MCBSP_XCR_XPHASE_SINGLE,
MCBSP_XCR_XFRLEN2_OF(0),
MCBSP_XCR_XWDLEN2_8BIT,
MCBSP_XCR_XCOMPAND_MSB,
MCBSP_XCR_XFIG_NO,
MCBSP_XCR_XDATDLY_1BIT,
MCBSP_XCR_XFRLEN1_OF(0),
MCBSP_XCR_XWDLEN1_8BIT,
MCBSP_XCR_XWDREVRS_DISABLE
),
MCBSP_SRGR_RMK(
MCBSP_SRGR_GSYNC_FREE,
MCBSP_SRGR_CLKSP_RISING,
MCBSP_SRGR_CLKSM_INTERNAL,
MCBSP_SRGR_FSGM_DXR2XSR,
MCBSP_SRGR_FPER_OF(0),
MCBSP_SRGR_FWID_OF(0),
MCBSP_SRGR_CLKGDV_OF(0x5F)
),
MCBSP_MCR_DEFAULT,
MCBSP_RCER_RCEA_OF(0),
MCBSP_XCER_XCEA_OF(0),
MCBSP_PCR_RMK(
MCBSP_PCR_XIOEN_SP,
MCBSP_PCR_RIOEN_SP,
MCBSP_PCR_FSXM_INTERNAL,
MCBSP_PCR_FSRM_EXTERNAL,
MCBSP_PCR_CLKXM_OUTPUT,
MCBSP_PCR_CLKRM_INPUT,
MCBSP_PCR_CLKSSTAT_0,
MCBSP_PCR_DXSTAT_0,
MCBSP_PCR_DXSTAT_0,
MCBSP_PCR_FSRP_ACTIVEHIGH,
MCBSP_PCR_CLKXP_RISING,
MCBSP_PCR_CLKRP_FALLING
),
MCBSP_SPCR_RMK(
MCBSP_SPCR_FREE_NO,
MCBSP_SPCR_SOFT_NO,
MCBSP_SPCR_FRST_NO,
MCBSP_SPCR_GRST_NO,
MCBSP_SPCR_XINTM_XRDY,
MCBSP_SPCR_XSYNCERR_NO,
MCBSP_SPCR_XRST_NO,
MCBSP_SPCR_DLB_OFF,
MCBSP_SPCR_RJUST_RZF,
MCBSP_SPCR_CLKSTP_DELAY,
MCBSP_SPCR_DXENA_OFF,
MCBSP_SPCR_RINTM_RRDY,
MCBSP_SPCR_RSYNCERR_NO,
MCBSP_SPCR_RRST_NO
)
};

main()
{

volatile Uint32 x,y,Addr=0x0098,Data,XmtEventId;

CSL_init();
DSK6713_init();

IRQ_globalEnable();

hMcbsp0 = MCBSP_open(MCBSP_DEV0,MCBSP_OPEN_RESET);

MCBSP_FSETH(hMcbsp0,SPCR,GRST,1);
MCBSP_FSETH(hMcbsp0,SPCR,FRST,1);
MCBSP_FSETH(hMcbsp0,SPCR,XRST,1);
MCBSP_FSETH(hMcbsp0,SPCR,RRST,1);

MCBSP_config(hMcbsp0,&Mcbsp_Config);

DSK6713_waitusec(200);

MCBSP_FSETH(hMcbsp0,SPCR,XRST,0);
MCBSP_FSETH(hMcbsp0,SPCR,RRST,0);
MCBSP_FSETH(hMcbsp0,SPCR,RINTM,2);
MCBSP_FSETH(hMcbsp0,SPCR,XINTM,2);
DSK6713_waitusec(200);
MCBSP_FSETH(hMcbsp0,SPCR,GRST,0);
DSK6713_waitusec(200);

MCBSP_enableSrgr(hMcbsp0);
DSK6713_waitusec(200);
MCBSP_enableRcv(hMcbsp0);
DSK6713_waitusec(200);
MCBSP_enableXmt(hMcbsp0);
MCBSP_enableFsync(hMcbsp0);

/* Change the IC from EWDS mode to EWEN mode*/
Addr=0x98;
/* Wait until the transmitter is ready for a sample then write to it */
while (!MCBSP_xrdy(hMcbsp0));
MCBSP_write(hMcbsp0,Addr);

Addr=0xB0;
/* Wait until the transmitter is ready for a sample then write to it */
// while (!MCBSP_xrdy(hMcbsp0));
MCBSP_write(hMcbsp0,Addr);
while(1){
/* Wait until the transmitter is ready for a sample then write to it */
if (!MCBSP_xrdy(hMcbsp0));
MCBSP_write(hMcbsp0,Addr);

/* Now wait until the value is received then read it */
if(!MCBSP_rrdy(hMcbsp0));
x = MCBSP_read(hMcbsp0);

if(x>=1)
{ LOG_printf(&LogMain,"data written success");}
else
LOG_printf(&LogMain,"data written unsuccess");
}
Addr=0xC0;
/* Wait until the transmitter is ready for a sample then write to it */
while (!MCBSP_xrdy(hMcbsp0));
MCBSP_write(hMcbsp0,Addr);
MCBSP_close(hMcbsp0);
}

thank and regards,

-jeeva