"Invalid or incomplete multibyte or wide character"

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
cinek
Posts: 2
Joined: Sat May 05, 2007 7:49 pm

"Invalid or incomplete multibyte or wide character"

Post by cinek » Mon May 21, 2007 1:07 pm

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?

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Tue May 29, 2007 4:48 pm

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.

Post Reply