McBSP接收设置与例程--5502

一、接收的配置流程

1.       Global behavior:

设置管脚和工作模式

          Set the receiver pins to operate as McBSP pins

          Enable/disable the digital loopback mode   回环模式

          Enable/disable the clock stop mode 时钟停止模式

          Enable/disable the receive multichannel selection mode 多通道

2.       Data behavior:

          Choose one or two phases for the receive frame 接受帧单段还是双段

          Set the receive word length(s)  接收字长

          Set the receive frame length 

          Enable/disable the receive frame-sync ignore function

          Set the receive companding mode

          Set the receive data delay

          Set the receive sign-extension and justification mode 数据符号扩展和校验

          Set the receive interrupt mode

3.       Frame-sync behavior:

          Set the receive frame-sync mode

          Set the receive frame-sync polarity

          Set the SRG frame-sync period and pulse width

4.       Clock behavior:

          Set the receive clock mode

          Set the receive clock polarity

          Set the SRG clock divide-down value

          Set the SRG clock synchronization mode

          Set the SRG clock mode [choose an input clock]

          Set the SRG input clock polarity

 

 

二、寄存器配置

        接收时需要配置的寄存器: SPCR1, SPCR2, PCR, RCR1, RCR2SRGR1, SRGR2 ,其他的可以设为default

        下面是一个我的调试配置参数,所有时钟和帧同步都由外部提供

 

注意的几点:

1.  configure RRST XRST 一定要设置为Disable,才可以正确的配置他的各个寄存器

2. 5502 不支持 CLKG的同步  SRGR2中的 GSYNC bit 始终写为 0

使用时如下步骤:

 

IRQ_globalDisable();

hMcbsp = MCBSP_open(MCBSP_PORT1, MCBSP_OPEN_RESET);

rcvEventID = MCBSP_getRcvEventId(hMcbsp);

IRQ_setVecs((Uint32)(&VECSTART));

IRQ_clear(rcvEventID);

IRQ_plug(rcvEventID, &readISR);

MCBSP_config(hMcbsp, &MCBSP_READONLY_Config_ _test);

IRQ_enable(rcvEventID);

/* Start Sample Rate Generator and Frame Sync */

MCBSP_start(hMcbsp,MCBSP_SRGR_START | MCBSP_SRGR_FRAMESYNC,0x300);  //如果需要

/* Enable MCBSP transmit and receive */

MCBSP_start(hMcbsp,  MCBSP_RCV_START ,  0);

IRQ_globalEnable();

 

 

 

三、测试例程

 

下面是我的一个测试程序,可以正确接受数据:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  • 2
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值