Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

Code stops working with USBHID_sendReport()

$
0
0

Hi, I'm having a problem that the source may come from TI's USB HID API. Need USB experts.

 

I'm trying to interface my TrackPoint (PS/2 mouse) with the MSP430F5510. Without calling USBHID_sendReport(), PS/2 communication between the MSP430 and the mouse works well. When called, the communication stops. The PS/2 code is posted in the code vault: http://forum.43oh.com/topic/5124-ps2-mouse-for-any-msp430/#entry45187.

case ST_ENUM_ACTIVE:
	PS2_setMode(RESET_MODE);
	PS2_setMode(REMOTE_MODE);
	Trackpoint_setSensitivity(0xC0);

	while(1) {
		ps2Data = PS2_getData(); //ps2Data with type PS2DATA_t
		usbData.x = ps2Data.x;   //usbData with type USB_MOUSE_REPORT_t
		usbData.y = -ps2Data.y; //by default, ps/2 mouse y-value is opposite to direction moving to
		usbData.state = ps2Data.state & 0x07; //only least significant three bits are transferred

		//use middle button to scroll
		if(ps2Data.state & BIT2) {
			usbData.z = ps2Data.y;
		}

		//Problem: USBHID_sendReport() stops PS/2 connection for no reason
		//Mouse communication with MSP430 works fine with all of these delays in between....
		//				__delay_cycles(100000);
		//				__delay_cycles(100000);
		//				__delay_cycles(100000);
		//				__delay_cycles(100000);
		//				__delay_cycles(100000);
		//				__delay_cycles(100000);
		//				__delay_cycles(100000);
		//				__delay_cycles(100000);


		//.... but not with USB report line
		//USBHID_sendReport((void *) &usbData, HID_MOUSE);
	}

This problem probably explains why all the PS/2 code will work without USB connectivity. Can you debug USB without using UART? If I put send some text via UART in the PS2.c file and in the ST_ENUM_ACTIVE case, the code starts to work magically and USB works fine too. However, that creates a lot of delays between the reports and the mouse's movement is very slow.

Attached Thumbnails

  • PS2_without_USBHID_sendReport().png
  • PS2_with_USBHID_sendReport().png

Viewing all articles
Browse latest Browse all 2077

Trending Articles