首页 > 代码库 > (比较WXS师兄的)USB 同步传输和异步传输固件的区别

(比较WXS师兄的)USB 同步传输和异步传输固件的区别

比较WXS师兄同步传输固件和异步传输固件的区别,发现dscr.a51、fw.c文件完全一致,tcxmaster.c有一行存在区别,位于初始化函数TD_Init(void)中:

  1. 在同步固件中:IFCONFG=0x03;//0000 0011
  2. 在异步固件中:IFCONFG=0xCB;//1100 1011

同步0x03,FIFO CLK来自外部,Slave FIFO工作在同步模式之下,Slave FIFO Interface;

异步0xCB,FIFO CLK来自内部,IFCLK频率选为48MHz,Slave FIFO工作在异步模式之下,Slave FIFO Interface;

?

下面是IFCONFG寄存器中bit 3的注释:

Bit3 ASYNC: Slave FIFO Asynchronous Mode.

0 The Slave FIFOs operate synchronously. A clock is supplied either internally or externally on the IFCLK pin; the FIFO control signals function as read and write enable signals for the clock signal.

1 The Slave FIFOs operate asynchronously. No clock signal input to IFCLK is required; the FIFO control signals function directly as read and write strobes.

下面是IFCONFG寄存器中bit 7\6的解释:

Bit7 IFCLKSRC: FIFO/GPIF Clock Source.

This bit selects the clock source for both the FIFOS and GPIF.

0 The external clock on the IFCLK pin is selected.

1 An internal 30 or 48 MHz (default) clock is used (default).

Bit6 3048MHZ: Internal FIFO/GPIF Clock Frequency

This bit selects the internal FIFO and GPIF clock frequency.

0 30 MHz (default)

  1. 48 MHz

?

总结:由于Bit3=1时,FIFO工作在异步模式下,根据注释,IFCLK并不需要时钟信号输入,所以异步模式中IFCONFG(7,6)=11没有什么实际意义,为什么WSX师兄要写成0xCB而不是直接写成0x0B呢?