TIVAWARE is not posting a USB_EVENT_RX_AVAILABLE event even when connected.
We have an existing Stellarisware + SYSBIOS - based product that I am porting to the TM4C1294KCPT chip. The Stellarisware version easily connects and exchanges data with a PC running a proprietary application. I am unable to get the TIVAWARE product to communicate.
Background: I am running TI-RTOS version 2.12.01.33 and the TIVAWARE version 2.1.0.12573c that came with the TI-RTOS distribution. The USB port is OTG which is not supported by the TI-RTOS driver. So, I have generated a wrapper function to handle the interrupt call differences between TIVAWARE and TI-RTOS:
void USB0OTGModeIntHandler_wrapper(UArg arg)
{
USB0OTGModeIntHandler();
}
On the device side of the OTG I am using the TIVAWARE Bulk Device Class Driver with the USB Buffer API:
tBulkInstance g_sBulkInstance;
tUSBDBulkDevice g_sBulkDevice = // TIVAWARE change: cannot be a const.
// Note that some TIVAWARE docs say this can be a const,
// but Section 3.7 of the Stellarisware -> TIVAWARE
// migration document state that USBLib makes changes
// to some of the data fields....
{
//USB_VID_STELLARIS,
//USB_PID_BULK,
USB_VID_NEWPORT,
USB_PID_OPENLOOP_IPICO,
500,
USB_CONF_ATTR_SELF_PWR,
USBBufferEventCallback,
(void *)&g_sRxBuffer,
USBBufferEventCallback,
(void *)&g_sTxBuffer,
g_ppui8StringDescriptors,
NUM_STRING_DESCRIPTORS
};
//*****************************************************************************
//
// Receive buffer (from the USB perspective).
//
//*****************************************************************************
uint8_t g_pui8USBRxBuffer[BULK_BUFFER_SIZE];
uint8_t g_pui8RxBufferWorkspace[USB_BUFFER_WORKSPACE_SIZE];
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_pui8USBRxBuffer, // pcBuffer
BULK_BUFFER_SIZE, // ulBufferSize
g_pui8RxBufferWorkspace // pvWorkspace
};
//*****************************************************************************
//
// Transmit buffer (from the USB perspective).
//
//*****************************************************************************
uint8_t g_pui8USBTxBuffer[BULK_BUFFER_SIZE];
uint8_t g_pui8TxBufferWorkspace[USB_BUFFER_WORKSPACE_SIZE];
tUSBBuffer g_sTxBuffer =
{
true, // This is a transmit buffer.
TxHandler, // pfnCallback
(void *)&g_sBulkDevice, // Callback data is our device pointer.
USBDBulkPacketWrite, // pfnTransfer
USBDBulkTxPacketAvailable, // pfnAvailable
(void *)&g_sBulkDevice, // pvHandle
g_pui8USBTxBuffer, // pcBuffer
BULK_BUFFER_SIZE, // ulBufferSize
g_pui8TxBufferWorkspace // pvWorkspace
};
The windows device manager sees the TIVAWARE-version device just fine, but the proprietary application on the host PC is unable to connect. That application sees the initial attach and sends an inquiry message to the TIVAWARE device, but the TIVAWARE never reports a USB_EVENT_RX_AVAILABLE event to my rxRxHandler function. Hence, no response is returned to the proprietary application and it ultimately times out.
More specifically, when the USB cable is attached to the PC, 3 or 4 USB_EVENT_SUSPEND events are reported to RxHandler (which my code ignores) followed by a USB_EVENT_CONNECTED event which I do handle. When the application then sends its inquiry, nothing happens on the TIVA device because no USB_EVENT_RX_AVAILABLE is posted . If the USB cable is subsequently removed, several USB_EVENT_SUSPEND are posted (which I again ignore) and then nothing. I definitely do not get a USB_EVENT_DISCONNECTED.
So there are two issues that may be related -- the failure to post USB_EVENT_RX_AVAILABLE events when data is sent and the failure to post USB_EVENT_DISCONNECTED when the USB cable is disconnected.