[Kinetis] 关于KL25内部USB模块的BDT问题

[复制链接]
2487|5
 楼主| huhaomcu 发表于 2014-1-25 09:30 | 显示全部楼层 |阅读模式
"The two BD entries allows for an EVEN BD and ODD BD entry for each endpoint direction.This allows the microprocessor to process one BD while the USB-FS is processing the other BD"这句话要如何理解咧!为什么BD提供两个entry就能做到在USB-FS同时处理两个BD呢?

 楼主| huhaomcu 发表于 2014-1-25 13:56 | 显示全部楼层
那个能形象的解释下芯片USB模块同时具有EVEN BD entry和ODD BD entry的作用?
FSL_TICS_B 发表于 2014-1-26 10:53 | 显示全部楼层
本帖最后由 FSL_TICS_B 于 2014-1-26 10:57 编辑

在RM里面,你可以在"The two BD entries allows for an EVEN BD and ODD BD entry for each endpoint direction.This allows the microprocessor to process one BD while the USB-FS is processing the other BD"前面看到“The BDT resides on a 512 byte boundary in system memory and is pointed to by the BDT Page Registers. Every endpoint direction
requires two eight-byte Buffer Descriptor entries. Therefore, a system with 16 fully bidirectional endpoints would require 512 bytes of system memory to implement the BDT.”结合起来就好理解了,一个BD占用8字节,每个endpoint(IN or OUT)占用两个BD,USB模块最多用到16个endpoint,因此整个BDT占用了16*2*16=512个字节,所以这个BDT的起始地址要放在512字节对齐的地方,因此BDT的结构可理解为:
BD0//EP0 IN
BD1//EP0 IN
BD2//EP0 OUT
BD3//EP0 OUT
...
BD30//EP15 OUT
BD31//EP15 OUT
所以EVEN BD是指BD0,BD2,...,BD30, ODD BD是指BD1.BD3,...,BD31,当应用程序要发送数据是,比方说EP0 IN方向,USB device模式,发送信息给HOST(PC),那么将用到BD0和BD1,MCU初始化BD0后,把控制权交给USB-FS引擎处理发送,然后不用等待其发送完毕,就可以直接初始化BD1,为下一次发送做好准备,从而达到“Double buffering BDs in this way allows the USB-FS to easily transfer data at the maximum throughput provided by USB.”这样的效果。

Hope that makes sense,
B.R
Kan
deebar 发表于 2014-2-10 14:08 | 显示全部楼层
我也问几个BDT相关的问题:
1,BDT里面的32bit控制位部分(CtrlReg),25:16是BC,即Byte Count,RM的说明是:
The Byte Count bits represent the 10-bit Byte Count. The USB-FS SIE changes this field upon the completion of a RX transfer with the byte count of the data received.
请问,TX操作也需要BC吗?

2,当USB SIE需要根据BDT处理TX或者RX操作的时候,它是不是自己找到相应的BD,得到两个(EVEN,ODD)的BD,然后根据OWN bit来判断是否EVEN,ODD中的哪一个BD是它所需要处理的?是不是EVEN,ODD的BD中的OWN位始终是互补的?firmware和USB SIE是不是各自处理完一个BD后,都要分别变更OWN位,以便交换处理?
huangxz 发表于 2014-12-2 16:25 | 显示全部楼层
很难理解fsl的usb
您需要登录后才可以回帖 登录 | 注册

本版积分规则

190

主题

509

帖子

3

粉丝
快速回复 在线客服 返回列表 返回顶部