[long] IR mouse problem
Posted: Mon Jan 29, 2007 8:55 pm
Hi
I'm trying to build an IR remote controlled mouse (as HID of course)..
For test I've build buttons controlled mouse, it works fine..
On the same hardware (of course with IR receiver connected), and only
makeReport fuction changed in firmware it's not working.
It is programmed with two interrupts to receive IR data:
input capture and output compare.. Input capture interrupt saves times between
edges changes for later decode, and output compare is timeot of avery ir packet
transmition (it is similar to the Usbtiny's IR example project)..
In output compare interrupt the makeReport() is called..
In makeReport(), after decode the ir data, when code:
is used, only one report is debugged (but corsor don't moves)..
It's not ready any more after first report..
In makeReport() the reportBuffer is build as for standard mouse with no wheel:
so it's size is three.
Additional info:
I) I'm using three leds to show what is done:
1 - power
2 - IR data receiving
3 - IR code matching, making report
II) As in usbtiny's ir, there is some protection for no conflicts:
1 - when USB transferring, IR data isn't changed in IR interrupts
III) I'm using constant value for cursor's move, by default it's three..
==============================================
==============================================
Debug (makeReport()'s prefix is 0x02):
-------------------------------------------
Buttons controlled device's output:
The corsor is moving, left/right MB works, everything is OK.
-------------------------------------------
IR control, with no usb functions (no usb functions calls, just debug of reportBuffer):
Here it receive's few codes, makes some communication with host, and
disapears from system (e.g not present in usbview).. But codes receiving still
works after that (both ir receive and code match leds blinking)..
Dmesg's output:
-------------------------------------------
Debug with usb fuctions called:
Here it reports one time to host, after that like before: some comunication
with host, disapear from usbview and no ir decode any more (code match
LED not blinking)..
Dmesg's output:
==============================================
==============================================
Is it possible, that there are no uC's resources for usb's int0, and ir's
interrupts? Is this a source of my problems? Or what?
Please, if any one could help, I'm 'fighting' with it two days, and have
no ideas now...
PS. Sorry for my english (-;
EDIT: and even with code:
(usb send commented out) it's not working.. After first packet receive/decode problem is the same:
Debug output OK, but after some communication to host device disapears from usbview with the same dmesg's output..[/b]
I'm trying to build an IR remote controlled mouse (as HID of course)..
For test I've build buttons controlled mouse, it works fine..
On the same hardware (of course with IR receiver connected), and only
makeReport fuction changed in firmware it's not working.
It is programmed with two interrupts to receive IR data:
input capture and output compare.. Input capture interrupt saves times between
edges changes for later decode, and output compare is timeot of avery ir packet
transmition (it is similar to the Usbtiny's IR example project)..
In output compare interrupt the makeReport() is called..
In makeReport(), after decode the ir data, when code:
Code: Select all
if ( usbInterruptIsReady() ) {
usbSetInterrupt(reportBuffer, sizeof(reportBuffer));
DBG1 (0x02, (void*)&reportBuffer, sizeof(reportBuffer));
}
is used, only one report is debugged (but corsor don't moves)..
It's not ready any more after first report..
In makeReport() the reportBuffer is build as for standard mouse with no wheel:
Code: Select all
/* 0xXX 0xXX 0xXX 0xXX
* ^ ^ ^ ^
* | | | |
* | | | +-- Fourth byte, for mouse's wheel (not used)
* | | | 0x01 - wheel UP
* | | | 0xFF - wheel DOWN
* | | |
* | | +------- Y axis (values depends on mouse's speed)
* | | 0x81 .. 0x00 : -127 .. 0 : UP
* | | 0x00 .. 0x7f : 0 .. 127 : DOWN
* | |
* | +------------ X axis (values depends on mouse's speed)
* | 0x81 .. 0x00 : -127 .. 0 : LEFT
* | 0x00 .. 0x7f : 0 .. 127 : RIGHT
* |
* +----------------- mouse buttons states
* r r r r r W R L, where:
* r - reserved (depends on device type?)
* W - wheel pressed (my mouse's wheel is a button too)
* R - right button
* L - left button
*/
so it's size is three.
Additional info:
I) I'm using three leds to show what is done:
1 - power
2 - IR data receiving
3 - IR code matching, making report
II) As in usbtiny's ir, there is some protection for no conflicts:
1 - when USB transferring, IR data isn't changed in IR interrupts
III) I'm using constant value for cursor's move, by default it's three..
==============================================
==============================================
Debug (makeReport()'s prefix is 0x02):
-------------------------------------------
Buttons controlled device's output:
Code: Select all
(cut device's identification...)
02: 00 fd 00
21: 4b 00 fd 00 ce af
02: 00 fd 00
02: 00 fd 00
21: c3 00 fd 00 ce af
02: 00 fd 00
02: 00 fd 00
21: 4b 00 fd 00 ce af
02: 00 fd 00
02: 00 fd 00
21: c3 00 fd 00 ce af
02: 00 fd 00
02: 00 fd 00
21: 4b 00 fd 00 ce af
02: 00 fd 00
02: 00 fd 00
21: c3 00 fd 00 ce af
...
The corsor is moving, left/right MB works, everything is OK.
-------------------------------------------
IR control, with no usb functions (no usb functions calls, just debug of reportBuffer):
Code: Select all
(cut device's identification...)
02: 00 00 fd
02: 00 00 fd
02: 00 00 fd
02: 00 00 fd
02: 00 00 fd
02: 00 00 fd
02: 00 00 fd
02: 00 00 fd
02: 00 00 fd
ff:
02: 00 00 fd
02: 00 00 fd
ff:
02: 00 00 fd
02: 00 00 fd
02: 00 00 fd
ff:
ff:
10: 69 00 10 01 00 00 40 00
20: 4b 00 00
10: 10 06 00 01 00 00 00 00
20: 4b 12 01 01 01 00 00 00 08 12 36
20: c3 42 42 31 e1 40 00 01 02 75 bf
20: 4b 00 01 3f 8f
ff:
10: 69 00 10 00 00 00 00 00
20: 4b 00 00
ff:
10: 10 05 6d 00 00 00 00 00
20: 4b 00 00
10: 69 6d 70 01 00 00 08 00
20: 4b 00 00
10: 70 06 00 01 00 00 00 00
20: 4b 00 00
10: 69 6d 70 01 00 00 08 00
20: 4b 00 00
10: 70 06 00 01 00 00 00 00
20: 4b 00 00
10: 69 6d 70 01 00 00 08 00
20: 4b 00 00
10: 70 06 00 01 00 00 00 00
20: 4b 00 00
ff:
10: 69 00 10 00 00 00 00 00
20: 4b 00 00
ff:
10: 10 06 00 01 00 00 00 00
20: 4b 12 01 01 01 00 00 00 08 12 36
20: c3 42 42 31 e1 40 00 01 02 75 bf
20: 4b 00 01 3f 8f
ff:
10: 69 00 10 00 00 00 00 00
20: 4b 00 00
ff:
10: 10 06 00 01 00 00 00 00
20: 4b 12 01 01 01 00 00 00 08 12 36
20: c3 42 42 31 e1 40 00 01 02 75 bf
20: 4b 00 01 3f 8f
ff:
10: 69 00 10 00 00 00 00 00
20: 4b 00 00
ff:
10: 10 05 70 00 00 00 00 00
20: 4b 00 00
10: 69 70 20 01 00 00 08 00
20: 4b 00 00
10: 20 06 00 01 00 00 00 00
20: 4b 00 00
10: 69 70 20 01 00 00 08 00
20: 4b 00 00
10: 20 06 00 01 00 00 00 00
20: 4b 00 00
10: 69 70 20 01 00 00 08 00
20: 4b 00 00
10: 20 06 00 01 00 00 00 00
20: 4b 00 00
ff:
10: 69 00 10 00 00 00 00 00
20: 4b 00 00
02: 00 00 fd
02: 00 00 fd
02: 00 00 fd
02: 00 00 fd
...
Here it receive's few codes, makes some communication with host, and
disapears from system (e.g not present in usbview).. But codes receiving still
works after that (both ir receive and code match leds blinking)..
Dmesg's output:
Code: Select all
[17198963.364000] ppdev0: registered pardevice
[17198966.564000] ppdev0: unregistered pardevice
[17198966.860000] usb 1-1.1: new low speed USB device using uhci_hcd and address 99
[17198967.468000] usb 1-1.1: configuration #1 chosen from 1 choice
[17198967.680000] input: Krzysiek Szczuka ksz's USB IR Mouse as /class/input/input10
[17198967.680000] input: USB HID v1.01 Mouse [Krzysiek Szczuka ksz's USB IR Mouse] on usb-0000:00:07.2-1.1
[17198970.828000] usb 1-1.1: reset low speed USB device using uhci_hcd and address 99
[17198971.100000] usb 1-1.1: device descriptor read/64, error -71
[17198971.476000] usb 1-1.1: device descriptor read/64, error -71
[17198971.840000] usb 1-1.1: reset low speed USB device using uhci_hcd and address 99
[17198972.164000] usb 1-1.1: device descriptor read/64, error -71
[17198972.588000] usb 1-1.1: device descriptor read/64, error -71
[17198972.952000] usb 1-1.1: reset low speed USB device using uhci_hcd and address 99
[17198972.984000] usb 1-1.1: device descriptor read/8, error -71
[17198973.104000] usb 1-1.1: device descriptor read/8, error -71
[17198973.468000] usb 1-1.1: reset low speed USB device using uhci_hcd and address 99
[17198973.500000] usb 1-1.1: device descriptor read/8, error -71
[17198973.624000] usb 1-1.1: device descriptor read/8, error -71
[17198973.732000] usb 1-1.1: USB disconnect, address 99
[17198973.804000] usb 1-1.1: new low speed USB device using uhci_hcd and address 100
[17198973.940000] usb 1-1.1: device descriptor read/64, error -71
[17198974.176000] usb 1-1.1: device descriptor read/64, error -71
[17198974.352000] usb 1-1.1: new low speed USB device using uhci_hcd and address 101
[17198974.488000] usb 1-1.1: device descriptor read/64, error -71
[17198974.724000] usb 1-1.1: device descriptor read/64, error -71
[17198974.900000] usb 1-1.1: new low speed USB device using uhci_hcd and address 102
[17198974.932000] usb 1-1.1: device descriptor read/8, error -71
[17198975.052000] usb 1-1.1: device descriptor read/8, error -71
[17198975.228000] usb 1-1.1: new low speed USB device using uhci_hcd and address 103
[17198975.260000] usb 1-1.1: device descriptor read/8, error -71
[17198975.380000] usb 1-1.1: device descriptor read/8, error -71
-------------------------------------------
Debug with usb fuctions called:
Code: Select all
(cut device's identification...)
02: 00 00 fd
21: c3 00 00 fd 4f be
ff:
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
ff:
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
ff:
ff:
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
ff:
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
ff:
ff:
ff:
ff:
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
ff:
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
ff:
ff:
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
ff:
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
10: 00 10 00 01 00 00 40 00
20: 4b 00 00
ff:
ff:
10: 00 10 75 00 00 00 00 00
20: 4b 00 00
ff:
10: 00 10 76 00 00 00 00 00
20: 4b 00 00
Here it reports one time to host, after that like before: some comunication
with host, disapear from usbview and no ir decode any more (code match
LED not blinking)..
Dmesg's output:
Code: Select all
[17200845.124000] ppdev0: registered pardevice
[17200848.500000] ppdev0: unregistered pardevice
[17200848.804000] usb 1-1.1: new low speed USB device using uhci_hcd and address 119
[17200849.412000] usb 1-1.1: configuration #1 chosen from 1 choice
[17200849.624000] input: Krzysiek Szczuka ksz's USB IR Mouse as /class/input/input24
[17200849.624000] input: USB HID v1.01 Mouse [Krzysiek Szczuka ksz's USB IR Mouse] on usb-0000:00:07.2-1.1
[17200862.484000] usb 1-1.1: reset low speed USB device using uhci_hcd and address 119
[17200862.808000] usb 1-1.1: device descriptor read/64, error -71
[17200863.232000] usb 1-1.1: device descriptor read/64, error -71
[17200863.596000] usb 1-1.1: reset low speed USB device using uhci_hcd and address 119
[17200863.920000] usb 1-1.1: device descriptor read/64, error -71
[17200864.344000] usb 1-1.1: device descriptor read/64, error -71
[17200864.708000] usb 1-1.1: reset low speed USB device using uhci_hcd and address 119
[17200864.740000] usb 1-1.1: device descriptor read/8, error -71
[17200864.860000] usb 1-1.1: device descriptor read/8, error -71
[17200865.224000] usb 1-1.1: reset low speed USB device using uhci_hcd and address 119
[17200865.256000] usb 1-1.1: device descriptor read/8, error -71
[17200865.376000] usb 1-1.1: device descriptor read/8, error -71
[17200865.480000] usb 1-1.1: USB disconnect, address 119
[17200865.556000] usb 1-1.1: new low speed USB device using uhci_hcd and address 120
[17200865.688000] usb 1-1.1: device descriptor read/64, error -71
[17200865.924000] usb 1-1.1: device descriptor read/64, error -71
[17200866.100000] usb 1-1.1: new low speed USB device using uhci_hcd and address 121
[17200866.232000] usb 1-1.1: device descriptor read/64, error -71
[17200866.468000] usb 1-1.1: device descriptor read/64, error -71
[17200866.644000] usb 1-1.1: new low speed USB device using uhci_hcd and address 122
[17200866.676000] usb 1-1.1: device descriptor read/8, error -71
[17200866.796000] usb 1-1.1: device descriptor read/8, error -71
[17200866.972000] usb 1-1.1: new low speed USB device using uhci_hcd and address 123
[17200867.004000] usb 1-1.1: device descriptor read/8, error -71
[17200867.124000] usb 1-1.1: device descriptor read/8, error -71
==============================================
==============================================
Is it possible, that there are no uC's resources for usb's int0, and ir's
interrupts? Is this a source of my problems? Or what?
Please, if any one could help, I'm 'fighting' with it two days, and have
no ideas now...
PS. Sorry for my english (-;
EDIT: and even with code:
Code: Select all
if ( usbInterruptIsReady() ) {
DBG1 (0x02, (void*)&reportBuffer, sizeof(reportBuffer));
//usbSetInterrupt(reportBuffer, sizeof(reportBuffer));
}
(usb send commented out) it's not working.. After first packet receive/decode problem is the same:
Debug output OK, but after some communication to host device disapears from usbview with the same dmesg's output..[/b]