Dear community,
I’m struggling with the USB OTG module on a Nucleo STM32F767ZI,
I’m using this library : USBHOST | Mbed
the given examples work with success. (keyboard, mouse, msd)
In my application I need to use the Host Serial functionality. there is no example with it., so I’m writing my own. it doesn’t work…
I’m using this kind of approach with the given methods
USBHostSerial - Handbook | Mbed
the usb device simply sends data over usb-serial.
what should I check to make it work properly?!
I can:
- detect a serial device when connected/disconnected
I can’t communicate properly:
as I fill the send buffer i get:
[USB_WARNING: /src/USBHOST/USBHost/USBHost.cpp:1080][ep: 200033d4 - dev: 20003854 - Serial] NOT IDLE: USB_TYPE_ERROR
any help would be appreciated,
this is the thread Preformatted text
void serial_device(void const *){
float sensVal[6];
while(1){
printf("wait for ATI sensor\n"); //store TF values
while(!dev.connect()) { // try to connect a MSD device
Thread::wait(500);
}
printf("ATI sensor found\n");
dev.baud(19200); //set serial baud
dev.format(); //default 8n1
// dev.attach(ATIread, USBHostSerialPort::RxIrq); //callbacks
// dev.attach(ATIwrite, USBHostSerialPort::TxIrq);
char cmd[1] ={ 0x70}; //start reading
while(dev.connected()){ //main loop : read request until connected
Thread::wait(500);
dev.writeBuf(cmd,strlen(cmd));
printf("ci sono\n");
}
printf("ATI disconnected\n");
// dev.disconnect();
} //fine while(1)
} //fine serial_device
indent preformatted text by 4 spaces