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.

Tiva Launchpad USB device-to-host-transmit problem

Hello,

the USB example of the Tiva launchpad is working in kind of "echo" mode. Tiva gets data and then sends data. Is it possible to simply rewrite the example to only transmit data from device to host in bulk mode? I can rewrite programs to receive dummy data from host and then send important data back to the host, but this method is wasting USB bandwidth and CPU cycles. I tried simply writing to Tx buffer and calling USBBufferDataWritten, but this doesn't work and i get nothing at host side. I think I'm missing something... I'm using CCS and TivaWare to write for Tiva and libusb-1.0 to write code for host.

My code at Tiva:


void sendsomedata (void)
{
    uint32_t ui32Loop, ui32Count;
    uint32_t ui32WriteIndex;
    tUSBRingBufObject sTxRing;

    USBBufferInfoGet(&g_sTxBuffer, &sTxRing);
    ui32Count = ui32Loop = 64;

    ui32WriteIndex = sTxRing.ui32WriteIndex;

    while(ui32Loop)
    	{
        g_pui8USBTxBuffer[ui32WriteIndex] = 'h';
        ui32WriteIndex++;
        ui32WriteIndex = (ui32WriteIndex == BULK_BUFFER_SIZE) ?
                         0 : ui32WriteIndex;
        ui32Loop--;
    	}
    USBBufferDataWritten(&g_sTxBuffer, ui32Count);
}

My code at host :

r = libusb_bulk_transfer(dev_handle, (1 | LIBUSB_ENDPOINT_IN), data, 64, &actual, 0);
	if(r == 0 && actual == 64)
		cout<<"Reading Successful: "<<data<<endl;
	else
		cout<<"Reading Error"<<endl;