Reply
Posts: 3
Registered: ‎09-10-2017

CP210x Plug-and-Play Mouse Enumeration

I'm working with an Avnet LX9 Microboard, which uses a CP2102 USB-UART Bridge and a Spartan-6 FPGA. I'm using a simple UART interface inside the FPGA for sending/receiving characters from the CP2102. I installed the "VCP with Serial Enumeration" driver for Windows 7 x64 and successfully sent and received characters to/from the FPGA using RealTerm (serial capture program). 

 

My goal is to have the FPGA send data to the PC which mimics that of a serial mouse (HID). My very basic understanding so far is that if the VCP receives an ASCII 'M' character (0x4D) then it will consider the input as mouse data. I tried researching the Plug-and-Play specification (link below), but I'm not sure under what conditions to send the data: when the device is first enumerated, every time I send a mouse movement packet, etc?

 

I'm also not sure if the SiLabs VCP driver is expecting a certain packet format for the mouse data. I've seen basic info online that typical serial mouse packets consists of 3 bytes, where bit 6 is the "first byte" flag and contains button, x and y movement data.

 

So far I've just tried (unsuccessfully) sending data packets which I thought might work, for example, from the FPGA's UART TX port:

PnP Mouse ID: 0x4D

Mouse data byte 1: 0x4F

Mouse data byte 2: 0x3F

Mouse data byte 3: 0x3F

 

I'd like to make it so the FPGA transmits a series of characters over UART to the CP2102 bridge, which then goes over USB to the VCP on my PC and results in moving the mouse.

 

Does anyone know more about how to format the mouse data packet, and about the Plug-and-Play headers? Any helpful reference material would be appreciated too.

 

Serial Mouse Protocol:

http://paulbourke.net/dataformats/serialmouse/

 

Plug-and-Play Spec:

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjtoar7rZvW...

Posts: 2,326
Registered: ‎10-14-2014

Re: CP210x Plug-and-Play Mouse Enumeration

Which driver you are using? I suggest you tried the driver with serial enumeration feature on.

http://community.silabs.com/t5/Interface-Knowledge-Base/What-is-the-serial-enumeration-driver-and-wh...

 

WeiguoLu
Posts: 3
Registered: ‎09-10-2017

Re: CP210x Plug-and-Play Mouse Enumeration

Yes, that's the driver I installed.

 

Download link for reference:

https://www.silabs.com/documents/public/software/CP210x_Windows_Drivers_with_Serial_Enumeration.zip

Posts: 3
Registered: ‎09-10-2017

Re: CP210x Plug-and-Play Mouse Enumeration

I have some updates on my progress, and some new questions.

 

I noticed that when I plug the LX9 Microboard into my PC, it looks like Windows enumerates the CP2102 USB-UART Bridge on the USB Host Controller and sends a single Null character (0x00).

 

I modified the VHDL on my board to just spam the CP2102 UART TX line with ASCII 'M' characters upon configuration. Once the FPGA receives a single Null character, it stops sending M's. This way, I power on the board, plug it into my computer, and it successfully enumerates as a Microsoft Serial Mouse. Windows installs the drivers for it too.

 

Note that I had to modify my VHDL to operate at 1200 baud, 1 bit start, 7 bits data, 1 bit stop on the UART side.

 

So now I've got my LX9 Microboard appearing as a mouse to Windows, and in my Device Manager I see this:

LX9_Mouse_Drivers.PNG

 

I'd like to still be able to transmit characters to the CP2102, while still receiving mouse data. Does anyone know if this is possible? It seems tricky because there appears to be conflicting drivers now...

Posts: 3,100
Registered: ‎02-07-2002

Re: CP210x Plug-and-Play Mouse Enumeration

Your device is now treated as a serial mouse. Have you ever seen a mouse you can send data to? I think what you want is not possible. I'd even say I'm surprised that windows still supports a serial mouse.