Hi Guys,
Playing around with StellarisWare and a USB Bulk application based off of the usb_dev_bulk example. If I send a packet out on my host of 256 bytes the RxHandler will often get called multiple times with 64 bytes worth of data. Likewise if I send out multiple smaller packets in a short amount of time, they'll often be concatenated as a single call to RxHandler. Is this correct behavior and if so is there some way to either configure things so that I only get entire packets (up to 1-2k) and/or somehow get the entire packet size?
Various bits of configuration code below in case it helps.
#define BULK_BUFFER_SIZE 512
const tUSBDBulkDevice g_sBulkDevice =
{
USB_VID_STELLARIS,
USB_PID_BULK,
500,
USB_CONF_ATTR_SELF_PWR,
USBBufferEventCallback,
(void *)&g_sRxBuffer,
NULL,
NULL,
// USBBufferEventCallback,
// (void *)&g_sTxBuffer,
g_pStringDescriptors,
NUM_STRING_DESCRIPTORS,
&g_sBulkInstance
};
unsigned char g_pucUSBRxBuffer[BULK_BUFFER_SIZE];
unsigned char g_pucRxBufferWorkspace[USB_BUFFER_WORKSPACE_SIZE];
const tUSBBuffer g_sRxBuffer =
{
false, // This is a receive buffer.
RxHandler, // pfnCallback
(void *)&g_sBulkDevice, // Callback data is our device pointer.
USBDBulkPacketRead, // pfnTransfer
USBDBulkRxPacketAvailable, // pfnAvailable
(void *)&g_sBulkDevice, // pvHandle
g_pucUSBRxBuffer, // pcBuffer
BULK_BUFFER_SIZE, // ulBufferSize
g_pucRxBufferWorkspace // pvWorkspace
};
// Enable the GPIO peripheral used for USB, and configure the USB pins.
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
ROM_GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_4 | GPIO_PIN_5);
// Initialize the receive buffers.
USBBufferInit((tUSBBuffer *)&g_sRxBuffer);
// Set the USB stack mode to Device mode with VBUS monitoring.
USBStackModeSet(0, USB_MODE_FORCE_DEVICE, 0);
// Pass our device information to the USB library and place the device on the bus.
USBDBulkInit(0, (tUSBDBulkDevice *)&g_sBulkDevice);