rampadc 29 Posted March 7, 2014 Share Posted March 7, 2014 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. Quote Link to post Share on other sites
rampadc 29 Posted March 10, 2014 Author Share Posted March 10, 2014 Any help? You can compile for the MSP430F5529 LP and there shouldn't be a problem. Quote Link to post Share on other sites
rampadc 29 Posted March 10, 2014 Author Share Posted March 10, 2014 Still not sure what the problem is but I moved the mouse reading + USB report to a 7ms timer interrupt block (about the time it takes for the PS/2 to communicate with the mouse via Remote Mode). And it just works, pretty well. I'm going to update the code vault. Quote Link to post Share on other sites
bluehash 1,581 Posted March 13, 2014 Share Posted March 13, 2014 @@jazz knows about USB here. Thanks for the update though and sharing your code. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.