pin_detect_hid_mouse#
Overview#
This pin detect HID example supports the mouse device.
The application prints the operation information when the mouse device is attached or plugged in to the PC host.
System Requirement#
Hardware requirements#
Mini/micro USB cable
USB A to micro AB cable
Hardware (Tower module/base board, and so on) for a specific device
Personal Computer
Software requirements#
The project files are in:
<MCUXpresso_SDK_Install>/boards//usb_examples/usb_pin_detect_hid_mouse/ / .
The
is Bare Metal or FreeRTOS OS.
Getting Started#
Hardware Settings#
For detailed instructions, see the appropriate board User’s Guide.
The jumpers of the hardware (Tower system/base module) needs to be set to default setting at first.
Prepare the example#
Download the program to the target board.
Power off the target board and power on again, or press the reset button on your board.
For detailed instructions, see the appropriate board User’s Guide. Host hid example doesn’t support HID report descriptor analysis, this example assume that the device data are sent by specific order.
For more detail, please refer to the code. For the device list we tested,
please refer to chapter “Peripheral devices tested with the USB Host stack” in “SDK Release Notes xxxx(board name)”.
Run the example#
Connect the board UART to the PC and open the COM port in a terminal tool.
Run the pin_detect_hid_mouse example. The board now acts as an USB device mouse and a USB switch-to-device mode information is displayed.
Plug in a mouse to the test board. The board acts as an USB host. The stack switches to host mode and some device attached information is printed out.
When the mouse is moved, the relevant information is output to the screen, such as: When the mouse moved up, “UP” is displayed on the screen. When the mouse moved down, “DOWN” is displayed on the screen.
Unplug the mouse with the cable. The board now acts as a USB device mouse. The mouse is detached and the USB switches to the device mode information.
Plug in the mouse device into the PC. An HID-compliant mouse is enumerated in the Device Manager.
The mouse arrow is moving on the PC screen in a rectangular rotation.
The following figures show a pin detect HID mouse information for the pin detect HID mouse demo.

Supported Boards#
MCX-N5XX-EVK
Getting Started
Hardware Settings
Since FRDM-K66 have no USB Vbus control gpio, need user switch the jump setting to control USB Vbus manually, otherwise the USB pin detect example can’t detect some low speed device if an adapter cable with a low speed mouse connected.
The Jumper settings:\n J21 1-2 OFF and J16 1-2 OFF when swith to device mode. \n J21 1-2 ON or J16 1-2 ON after swith to host mode.
MCX-N9XX-EVK
Getting Started
Hardware Settings
Since FRDM-K66 have no USB Vbus control gpio, need user switch the jump setting to control USB Vbus manually, otherwise the USB pin detect example can’t detect some low speed device if an adapter cable with a low speed mouse connected.
The Jumper settings:\n J21 1-2 OFF and J16 1-2 OFF when swith to device mode. \n J21 1-2 ON or J16 1-2 ON after swith to host mode.
FRDM-MCXN947
Getting Started
Hardware Settings
Since FRDM-K66 have no USB Vbus control gpio, need user switch the jump setting to control USB Vbus manually, otherwise the USB pin detect example can’t detect some low speed device if an adapter cable with a low speed mouse connected.
FRDM-MCXN947T
Getting Started
Hardware Settings
Since FRDM-K66 have no USB Vbus control gpio, need user switch the jump setting to control USB Vbus manually, otherwise the USB pin detect example can’t detect some low speed device if an adapter cable with a low speed mouse connected.
FRDM-MCXN236
Getting Started
Hardware Settings
Since FRDM-K66 have no USB Vbus control gpio, need user switch the jump setting to control USB Vbus manually, otherwise the USB pin detect example can’t detect some low speed device if an adapter cable with a low speed mouse connected.
FRDM-MCXA577
Getting Started
Hardware Settings
Since FRDM-K66 have no USB Vbus control gpio, need user switch the jump setting to control USB Vbus manually, otherwise the USB pin detect example can’t detect some low speed device if an adapter cable with a low speed mouse connected.
FRDM-MCXA287
Getting Started
Hardware Settings
Since FRDM-K66 have no USB Vbus control gpio, need user switch the jump setting to control USB Vbus manually, otherwise the USB pin detect example can’t detect some low speed device if an adapter cable with a low speed mouse connected.