Hi-
I'm using LCDK board and trying to use BLED112 bluetooth usb dongle via USB OTG port.
Unfortunately, C6748_StarterWare_1.20.04.01 doesn't have USBCDC host example.
My first question is
Is there a reason why it doesn't have USBCDC host example? Is LCDK able to support usb host cdc?
I found an usb host cdc example from link below, but I was not able to read or write the usb dongle.
github.com/.../tiva-c_usb_host_cdc_driver
I used usbhcdc.c/h files and made source code like below.
(I want to attach my source code, but it seems not available here. If you need, I can send them via email.)
===============================================================
static void ConfigureIntUSB(void)
{
/* Initialize the DSP interrupt controller */
IntDSPINTCInit();
/* Register ISR to vector table */
IntRegister(C674X_MASK_INT5, USB0HostIntHandler);
/* Map system interrupt to DSP maskable interrupt */
IntEventMap(C674X_MASK_INT5, SYS_INT_USB0);
/* Enable DSP maskable interrupt */
IntEnable(C674X_MASK_INT5);
/* Enable DSP interrupts */
IntGlobalEnable();
}
int main(void)
{
............
do
{
//
//Setup the interrupt controller
//
ConfigureIntUSB();
DelayTimerSetup();
//
// Enable Clocking to the USB controller.
//
PSCModuleControl(SOC_PSC_1_REGS,1, 0, PSC_MDCTL_NEXT_ENABLE);
//USBStackModeSet(0, USB_MODE_HOST, NULL);
//
// Register the host class drivers.
//
USBHCDRegisterDrivers(USB_INSTANCE, g_ppHostClassDrivers, NUM_CLASS_DRIVERS);
g_ulCDCInstance = USBHCDCDriveOpen(USB_INSTANCE, USBCDCCallback);
USBHCDPowerConfigInit(USB_INSTANCE, USBHCD_VBUS_AUTO_HIGH);
//
// Initialize the host controller.
//
USBHCDInit(USB_INSTANCE, g_pHCDPool, HCD_MEMORY_SIZE);
SET_CONNECT_RETRY (USB_INSTANCE, USBMSC_DRIVE_RETRY);
USBHTimeOut->Value.slEP0 = USB_EP0_TIMEOUT_MILLISECS;
USBHTimeOut->Value.slNonEP0= USB_NONEP0_TIMEOUT_MILLISECS;
USBHCDTimeOutHook (USB_INSTANCE, &USBHTimeOut);
while(1)
{
if(g_eState == STATE_DEVICE_ENUM)
{
if(USBHCDCReady(g_ulCDCInstance) == 0)
{
ret_size_s = 0;
ret_size_s = USBHCDCWrite(g_ulCDCInstance, &ucChar_tx[0], 5);
memset(ucChar_rx, 0x0, sizeof(ucChar_rx));
ret_size = 0;
//if(USBHCDCReady_read(g_ulCDCInstance) == 0)
{
ret_size = USBHCDCRead(g_ulCDCInstance, &ucChar_rx[0], sizeof(ucChar_rx));
if(0 < ret_size)
ret_size = 0;
}
}
}
if((USBHTimeOut->Status.slEP0)||
(USBHTimeOut->Status.slNonEP0))
{
deviceRetryOnTimeOut--;
}
if(!deviceRetryOnTimeOut)
{
UARTprintf("%s\n", "Timedout too many times!!!");
g_eState = STATE_TIMEDOUT;
deviceRetryOnTimeOut = 4;
USBHTimeOut->Value.slEP0 = USB_EP0_TIMEOUT_MILLISECS;
USBHTimeOut->Value.slNonEP0= USB_NONEP0_TIMEOUT_MILLISECS;
USBHTimeOut->Status.slEP0 = 0;
USBHTimeOut->Status.slNonEP0= 0;
}
//
// Periodically call the main loop for the Host controller driver.
//
//USBHCDMain();
USBHCDMain (USB_INSTANCE, g_ulCDCInstance);
}
}while(1);
}
==============================================================
When I call USBHCDCWrite function, USBEndpointStatus() return USB_HOST_OUT_ERROR in USBHostIntHandlerInternal.
I'm trying to find some solution for it, but it seems very complicated.
Could you give me a hint to resolve this issue?
Any tips or help will be appreciated for me~!
Thanks~