如何用C6748中的MCBSP外设读取ADS1271的数据,采样频率要求50HZ*1024,接线如何,程序的大致流程图是怎样的?
我现在接线如下,始终没有读出来数据,请高手指点!
Shine:
量过时序吗?先看一下ADC往c6748 McBSP口送的数据是否正确?
zhu eric:
回复 Shine:
程序如下:
void McBSPInit(void){ configureMcbsp();
HWREG(SOC_MCBSP_0_CTRL_REGS + MCBSP_SPCR) = 0; //发送和接受复位
HWREG(SOC_MCBSP_0_CTRL_REGS + MCBSP_PCR) = HWREG(SOC_MCBSP_0_CTRL_REGS + MCBSP_PCR) | MCBSP_PCR_CLKRM //CLKR is an output pin and is driven by the internal sample-rate generator. | MCBSP_PCR_CLKRP; //Receive data sampled on rising edge of CLKR.
unsigned int FramePeriod; unsigned char FrameWidth,SampleRate;
FramePeriod = 200; FrameWidth = 1; SampleRate = 200;
HWREG(SOC_MCBSP_0_CTRL_REGS + MCBSP_SRGR) = HWREG(SOC_MCBSP_0_CTRL_REGS + MCBSP_SRGR) | MCBSP_SRGR_CLKSM //CLKSM=1,SCLKME=0,McBSP internal input clock. | ( FramePeriod << MCBSP_SRGR_FPER_SHIFT ) //Range is 1 to 4096 sample-rate generator clock (CLKG) periods. | ( FrameWidth << MCBSP_SRGR_FWID_SHIFT ) | ( SampleRate << MCBSP_SRGR_CLKGDV_SHIFT ); //Frame width value plus 1 specifies the width of the frame-sync pulse (FSG) during its active period.
unsigned char RevWordLength1;
RevWordLength1 = MCBSP_RCR_RWDLEN1_24BIT; //RevWordLength2 = MCBSP_RCR_RWDLEN2_24BIT;
HWREG(SOC_MCBSP_0_CTRL_REGS + MCBSP_RCR) = ( 0 << MCBSP_RCR_RPHASE_SHIFT ) //Single-phase frame | ( MCBSP_RCR_RCOMPAND_MSB << MCBSP_RCR_RCOMPAND_SHIFT ) //No companding, data transfer starts with MSB first. | ( MCBSP_RCR_RDATDLY_0BIT << MCBSP_RCR_RDATDLY_SHIFT ) //0-bit data delay | ( 0 << MCBSP_RCR_RFRLEN1_SHIFT ) //1 word in phase 1 | ( RevWordLength1 << MCBSP_RCR_RWDLEN1_SHIFT ); //Receive word length1 is 24 bits.
Delay(100);
HWREG(SOC_MCBSP_0_CTRL_REGS + MCBSP_SPCR) = MCBSP_SPCR_RRST //接受使能 | MCBSP_SPCR_GRST;}
FSR都没有收到信号.
Shine:
回复 zhu eric:
只是FSR没有信号?CLKR上有信号吗?
zhu eric:
回复 Shine:
CLKR有1.129MHZ的方波
Shine:
回复 zhu eric:
PCR. FSRM位设成1了吗?由Sample rate generator产生。
zhu eric:
回复 Shine:
ADS1271 我用的是SPI模式,FSR是作为输入信号的,接受ADS1271发送过来的同步信号的,所以我这里设置的是0。
Shine:
回复 zhu eric:
c6748 mcbsp不支持spi模式。下面的文档有说明。
24.2.10 SPI Operation Using the Clock Stop ModeThe McBSP on this device does not support the SPI protocol.http://www.ti.com/lit/ug/spruh79b/spruh79b.pdf
zhu eric:
回复 Shine:
那可以用ADS1271的FRAME-SYNC模式吗?
Shine:
回复 zhu eric:
不清楚ADS1271 frame-sync模式具体是什么。
就DSP这边而言,MCBSP口是个同步口,时序上两者能匹配就可以收发。
另外,如果要用ADS1271 SPI模式的话,可以考虑和C6748的SPI口接。
Tony Tang:
回复 zhu eric:
zhu eric那可以用ADS1271的FRAME-SYNC模式吗?
可以,完全符合时序要求。