felHR85 / UsbSerial

Usb serial controller for Android
MIT License
1.8k stars 585 forks source link

How to convert UART to USB? #267

Open goodlman opened 5 years ago

goodlman commented 5 years ago

Hello all,

I am new to HW programming and I am working on converting UART to USB when the host is communicating with Device(FPGA). The current system is communicating through UART. I'd like to change it to USB.

*Current UART System

SEND_CMD(H_BOOT_START);
cout << "(HOST -> FPGA) * BOOT START command sent \n";

UART_TX(hComm, (char*)cnn_coeff, COEF_SPACE*sizeof(coeff_type));

WAIT_RESPONSE(F_MODULE_BOOT);
cout << "(FPGA -> HOST) * MODULE BOOT DONE response arrived\n";

UART_TX is the function to transfer the data/cmd to FPGA

It seems like there's no direct function in USB lib. Looks like usb_bulk_write() is the one it can be used, but don't know how.

Can anyone help to me figure out how to convert UART to USB? Any reply will be appreciated.