2016年7月6日 星期三

STM32F429 USB-Host HID Mouse Test

1. 本範例是利用stm32f429 discovery board來實做出usb-host mouse, 並把mouse cursor和Button顯示在內建的LCM上.




2.  程式完整範例下載連結: (使用IAR EWARM v7.7)
     stm32f429_usb_host_hid_mouse

3. main flow:

  • 初始化Host HID

  • LCD/GPIO/Button的初始化放在 USBH_USR_Init() function 


  • mouse callback function主要有2個, 分別為Init和Decode.

4. Test Flow:
  • 程式燒錄上電後, 若是在未插入滑鼠的情況下, 則會看到如下的訊息, 代表USB Host Library開始運作.


  • 接著將mouse插入usb port, 則會看到基本的vid/pid等滑鼠相關的資訊.



  • 此時按下User Button後, 就可以看到滑鼠的滑動範圍和cursor, 還有left/middle/right button的顯示區.

5. Test Mouse model name:  Logitech M105


6. Test Video:

15 則留言:

  1. i am using this product Smart Cat PRO MOUSE(GP415U-5321), i am attached to my STM32 USB HHID evaluation board. Normal operation are working like Right,Left and center click but the external feature are not working(A,B,C,D,ZOOM,SCROLL,BACK and FWD). How the protocol format are working in touch-pad. How to enable the MOUSE feature.. The data length is 13 Bytes but only receive 4 bytes, not the full 13. How can the remaining Bytes be received? just give me some suggestion.

    回覆刪除
    回覆
    1. Hi:
      1. I think you need to know the output format of Smart cat pro mouse first, e.g. 13bytes data format.

      2. I suggest you can use bus hound to check the output data format and then you can fetch the data you want. e.g. mouse dx/dy & scroll...

      3. If we done the 1 & 2, we can check the code and implement the USB-Host function.

      刪除
    2. 作者已經移除這則留言。

      刪除
    3. 作者已經移除這則留言。

      刪除
    4. Thank you for Reply,Everything Ok But i have only receive mouse data alone,
      0x05, 0x01, // USAGE_PAGE (at The the Generic Desktop)
      0x09, 0x02, // USAGE (Mouse)
      and etc ...
      How to enable Touch-PAD Command..! and they have any command send to host to device to enable Touch-pad ..?
      and Also i have receive 4byte alone DX, DY and verital Scroll ..
      please help me i could been struggle in more the two week..

      刪除
    5. How to enable the USB HID additional feature of Touch-pad...?

      刪除
    6. Hi:

      so you want to run touch-pad on your STM32 USB Host?

      刪除
    7. Hi:
      I think it's possible, I will use Logitech k830 to test, thanks.

      刪除
    8. 作者已經移除這則留言。

      刪除
  2. Thanks for you reply.
    Do you have any idea about, how to enable USB HID mouse additional feature in STM32 evaluation board..?
    And then one more question,do u worked in USB HID SpaceNavigation 3D mouse...?
    My next task is interface USB 3D mouse to stm32 evaluation board...
    Please give me some suggestion..

    回覆刪除
  3. i am trying to do this with Stm32H7...can you please do a short tutorial how you developed this application.

    回覆刪除
    回覆
    1. Hi Asim:

      OK, I will try it if I am free these days.

      Have a nice day,
      JustinWang

      刪除