第十三章 McBSP设计.ppt
文本预览下载声明
DSP McBSP设计 SPI 模式 SPI模式 SPI模式 SPI模式 SPI模式 SPI模式-master SPI模式-slave 一、McBSP串口的复位 1、McBSP串口的复位方式 设备复位(/RS=0):即整个串口复位,此时,/RRST和/XRST为零,DR、CLKR/X、FSR/X为输入信号,DX为输出信号,输出高祖态。同时/GRST也为零,CLKG=CPU时钟/2,不产生FSG信号。/RS放开后,/RRST、/XRST、/GRST、/FRST仍为零,此时,McBSP配置寄存器赋值和变成,复位进入McBSP复位。 McBSP复位:McBSP串口发送器和接收器可以分别复位(/RRST=0、/XRST=0、/FRST=0)。不论是接收还是发送的复位,相应部分都将停止串口操作,而相应引脚当作I/O脚使用,由PCR的XIOEN、RIOEN决定。 特殊说明 采样率发生器复位:设备复位或置/GRST为零可以复位采样率发生器。采样率发生器复位时,CLKG等于CPU-CLK/2,而FSG驱动为低。当/RS放开(延迟)/GRST放开后,CLKG按SRGR1编程产生;如果,/FRST也放开,则经过FPER个CLKG,FSG驱动为高。 2、下面给出串口初始化的处理过程 1) Set XRST = RRST = FRST = 0 in SPCR[1,2]. If coming out of device re-set, this step is not required. 2) Program only the McBSP configuration registers (and not the data regis-ters) listed in Table-1 McBSP Registers, as required when the serial port is in reset state (XRST = RRST = FRST = 0). 3) Wait for two bit clocks. This is to ensure proper synchronization internally. 4) Set up data acquisition as required such as writing to DXR. 5) Set XRST = RRST= 1 to enable the serial port. Note that the value written to SPCR[1,2] at this time should have only the reset bits changed to 1, and the remaining bit-fields should have the same value as in step 2 above. 6) Set FRST = 1, if internally generated frame sync is required. 7) Wait two bit clocks for the receiver and transmitter to become active. Alternatively, on either write (steps 1 and 5), the transmitter and receiver may be placed in or taken out of reset individually by modifying the desired bit. Note that the necessary duration of the active-low period of XRST or RRST is at least two bit-clocks (CLKR/CLKX) wide. 二、McBSP串口产生的中断与事件 1、串口与CPU之中断 (R/X)INTM=00:每传送一个字,(R/X)RDY 响应一次,就产生响应串口中断一次。(此时,同时产生DMA事件) (R/X)INTM=01:在多通道模式中,一个帧内出现16通道的块(PARTITION)边界就产生中断。此时CPU可以检测是哪个PARTITION。 (R/X)INTM=10:检测到帧同步脉冲就产生(R/X)INT。 (R/X)INTM = 11:当出现帧同步错误时产生中断。 2、McBSP的准备好之状态 接收准备好(RRDY、REVT、RINT):串口复位时RRDY清为0,当RBR[1,2]内容拷贝到DRR[1,2]时,RRDY有效,该数据可以被CPU or DMA读,一旦CPU or DMA读走数据RRDY又
显示全部