请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
tm4c129x 以及批量传输和设备
我有 RTOS CDCHost (由 TI、Ralph 提供) 和 CDC 器件、它们工作良好、只不过有一个限制设置、设置为64。 只要我传输65个字节、器件就无法获取该字节或主机未发送该字节。 我在库文件中看不到任何限制发送/接收的内容、我是否错过了它?
Rob
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
我有 RTOS CDCHost (由 TI、Ralph 提供) 和 CDC 器件、它们工作良好、只不过有一个限制设置、设置为64。 只要我传输65个字节、器件就无法获取该字节或主机未发送该字节。 我在库文件中看不到任何限制发送/接收的内容、我是否错过了它?
Rob
在 TivaWare usblib/device/usbdcdc.c 内有以下定义:
//***************************************************************************** // // Maximum packet size for the bulk endpoints used for serial data // transmission and reception and the associated FIFO sizes to set aside // for each endpoint. // //***************************************************************************** #define DATA_IN_EP_MAX_SIZE USBFIFOSizeToBytes(USB_FIFO_SZ_64) #define DATA_OUT_EP_MAX_SIZE USBFIFOSizeToBytes(USB_FIFO_SZ_64) #define DATA_IN_EP_MAX_SIZE_HS USBFIFOSizeToBytes(USB_FIFO_SZ_512) #define DATA_OUT_EP_MAX_SIZE_HS USBFIFOSizeToBytes(USB_FIFO_SZ_512) #define CTL_IN_EP_MAX_SIZE USBFIFOSizeToBytes(USB_FIFO_SZ_16)
USBDCDCCompositeInit() 函数具有以下特性:
//
// Get the Feature set for ULPI
//
USBDCDFeatureGet(0, USBLIB_FEATURE_USBULPI, &ui32ulpiFeature);
g_ui16MaxPacketSize = USBFIFOSizeToBytes(USB_FIFO_SZ_64);
//
// The CDC serial configuration is different for composite devices and
// stand alone devices.
//
if(psCompEntry == 0)
{
psInst->sDevInfo.ppsConfigDescriptors = g_ppCDCSerConfigDescriptors;
if(USBLIB_FEATURE_ULPI_HS == ui32ulpiFeature)
{
psInst->sDevInfo.ppsConfigDescriptors = g_ppCDCSerConfigDescriptorsHS;
g_ui16MaxPacketSize = USBFIFOSizeToBytes(USB_FIFO_SZ_512);
}
}
else
{
psInst->sDevInfo.ppsConfigDescriptors = g_pCDCCompSerConfigDescriptors;
if(USBLIB_FEATURE_ULPI_HS == ui32ulpiFeature)
{
psInst->sDevInfo.ppsConfigDescriptors = g_pCDCCompSerConfigDescriptorsHS;
g_ui16MaxPacketSize = USBFIFOSizeToBytes(USB_FIFO_SZ_512);
}
}
psInst->sDevInfo.ppui8StringDescriptors = 0;
psInst->sDevInfo.ui32NumStringDescriptors = 0;
USBDCDCPacketWrite() 函数具有以下检查功能:
//
// Can we send the data provided?
//
if((ui32Length > g_ui16MaxPacketSize) ||
(psInst->iCDCTxState != eCDCStateIdle))
{
//
// Either the packet was too big or we are in the middle of sending
// another packet. Return 0 to indicate that we can't send this data.
//
return(0);
}
如果 TM4C129 USB 控制器正在使用内部 phy、则它是一个 USB 全速(12Mbit/s)、上面的代码将为 CDC 选择一个64字节的最大数据包大小。
要获得512字节的最大数据包大小、需要通过 ULPI 接口使用外部 PHY 来获得 USB 高速连接(480 Mbit/s)。