Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

c6457 Mcbsp used as SPI doubt

$
0
0

 i configured the mcbsp0 on c6457 as spi master, after configer each register,  i meet with the problem that when i  doesn't set the GRST(in the SPCR register )as 1 for all the time, I can get the signel of  FSX, DX,CLKX on oscilloscope which seems normal, and of cause, it doesn't  division the frequency,the frequency is too high to use. but when i set the GRST as 1, the signal are all gone, i can get nothing on oscilloscope. i doubt it is because i didn't set the register right, but i follow the step of mcbsp configer as spi  grimly. now i don't konw what to do.can anyone helps? thanks very much. Here is my code:#include<stdio.h>
#include<csl.h>
#include<csl_mcbsp.h>
#include<string.h>
#include<csl_chip.h>

CSL_McbspHandle       hMcbsp;

#define WAIT_FOR_2_CLK  do {                                   \
                            volatile int delayCnt = 2;      \
                            while(delayCnt > 0) --delayCnt; \
                           }while (0)
void DSP_MCBSP_Init()
{

 CSL_McbspObj        mcbspObj;
    CSL_Status            status;
    CSL_McbspConfig MyConfig;
    CSL_BitMask16        ctrlMask;
    MyConfig.SPCR=0x02001000;//

    MyConfig.RCR=0x7f050000;//0x00040000;
    MyConfig.XCR=0x00050000;//00010000
    MyConfig.SRGR=0x20001350;//0xb0200150;
    MyConfig.MCR= 0x00000000;
    MyConfig.RCERE0=0x00000000;
    MyConfig.RCERE1=0x00000000;
    MyConfig.RCERE2=0x00000000;
    MyConfig.RCERE3=0x00000000;
    MyConfig.XCERE0=0x00000000;
    MyConfig.XCERE1=0x00000000;
    MyConfig.XCERE2=0x00000000;
    MyConfig.XCERE3=0x00000000;
    MyConfig.PCR=0x00000A0C;//0x00000a0c;

    memset (&mcbspObj, 0, sizeof(CSL_McbspObj));

 CSL_mcbspInit (NULL);
 hMcbsp = CSL_mcbspOpen (&mcbspObj, CSL_MCBSP_0, NULL, &status);
 ctrlMask=0;
 ctrlMask = CSL_MCBSP_CTRL_RX_DISABLE
                | CSL_MCBSP_CTRL_TX_DISABLE
                | CSL_MCBSP_CTRL_FSYNC_DISABLE   //GAI
                | CSL_MCBSP_CTRL_SRG_DISABLE;       //GAI(5-22 9:16)
     CSL_mcbspHwControl (hMcbsp, CSL_MCBSP_CMD_RESET_CONTROL, &ctrlMask);
     WAIT_FOR_2_CLK;
  status = CSL_mcbspHwSetupRaw (hMcbsp, &MyConfig);
  WAIT_FOR_2_CLK;

  WAIT_FOR_2_CLK;
  ctrlMask =0;
 hMcbsp->regs->SPCR =0x02E01000;//GRST=1
  WAIT_FOR_2_CLK;
 hMcbsp->regs->SPCR =0x02401000;
  WAIT_FOR_2_CLK;
 hMcbsp->regs->SPCR =0x02411001;//XRST=RRST=1
  WAIT_FOR_2_CLK;
}
void  DSP_MCBSP_Write()
{
 int a=5;
  while(1)
  {
          CSL_mcbspWrite (hMcbsp, CSL_MCBSP_WORDLEN_8, &a);

     }
}
void main()
{
 //int a;
 DSP_MCBSP_Init();
 DSP_MCBSP_Write();
}


 


Viewing all articles
Browse latest Browse all 262198

Trending Articles