Page 1 of 1

"Invalid or incomplete multibyte or wide character"

Posted: Mon May 21, 2007 1:07 pm
by cinek
hi. i've built a USB device on Atmega8 which counts seconds, measures temperature in fixed intervals and stores data in EEPROM. when connected via USB it is polled every second to give current time and temperature. it works fine, but from time to time I get errors like those:

commandline:

Code: Select all

USB error: error sending control message: Invalid or incomplete multibyte or wide character
only -84 bytes status received
dmesg:

Code: Select all

[17182281.564000] usb 2-2: new low speed USB device using uhci_hcd and address 3
[17182281.736000] usb 2-2: configuration #1 chosen from 1 choice
[17183069.944000] usb 2-2: usbfs: USBDEVFS_CONTROL failed cmd USBterm rqt 192 rq 2 len 8 ret -84

there is no rule whether it happens after 10 minutes or 10 hours of work, it appears to be random. i use 16bit timer and interrupt (to count seconds and measure fixed intervals for polling sensors), is it possible that it interferes with communication? any ideas, please?

Posted: Tue May 29, 2007 4:48 pm
by christian
My first guess would be that this is a timeout issue. If you disable interrupts for too long (more than ~ 20 CPU cycles), the driver may fail to respond (correctly) to a request from the host.

If you have your own interrupt handlers, make sure that the first instruction emitted by the compiler is a SEI to allow USB interrupts. Compile your source files down to assembler code (with gcc option "-S") to see what the compiler makes out of your code.

Another possibility: If you write to the EEPROM, your write function might disable interrupts until the data has been written.