Driver on

USB Composite Device

An USB Composite Gadget is a peripheral machine that helps a couple of machine class. Many alternative units are applied as composite units. For instance they include a sure machine class, but in addition an USB disk that has all the required drivers saved in order that the machine may be put in mechanically, with out the necessity to have entry to a sure driver software program.
On this instance, we’ll implement a composite machine that’s made up of two units which were used within the earlier tutorials. We can have entry to the event board’s buttons (from the HID instance) and the SC card (from the MSC instance).

Open the MSC instance mission in MDK. From the HID instance mission, copy HID.c and USBD_User_HID.c and add them to the mission. Open the Handle Run-Time Surroundings window. Add one USB:Gadget:HID part to the mission. After clicking OK, you will note that the USB Element within the Mission window can have a further entry: USBD_Config_HID_0.h. Because the HID instance makes use of LEDs and push-buttons, you would possibly want so as to add these Board Help associated gadgets as nicely. Test the RTE Element number of the HID instance for additional element. In complete, it ought to show now the same mission construction:

USB Composite Gadget Mission Construction

Supply Information

Now now we have two foremost features within the mission. We have to delete considered one of them. Open the MassStorage.c file. Copy the strains

finit (“M0:”);


to the HID.c file proper earlier than the strains


to the #contains firstly of the HID.c file. Afterwards, take away the MassStorage.c out of your mission. Now you might have just one foremost perform left.

USB Gadget Configuration

Earlier than operating this system on the goal {hardware}, it is advisable to edit the USBD_Config_HID_0.h file. Open the file, change to the Configuration Wizard and go to the Bulk Endpoint Settings. Because the file is generic and has no details about different courses accessible within the mission, the Endpoint 1 is configured for IN and OUT. This endpoint is already used within the USBD_Config_MSC_0.h file. So change the quantity for IN and for OUT to ‘2’. This can make the HID Element use the Endpoint 2 for knowledge trade with the USB Host and no conflicts will happen with the MSC class.

In case you are utilizing RTOS apart from CMSIS-RTOS2 RTX5 in your mission please be sure that to fulfill USB Gadget Useful resource Necessities.

You could now construct and obtain the instance mission to the analysis board utilizing the µVision instructions:

  • Mission –> Construct goal (F7)
  • Flash   –> Obtain (F8)

After these steps, the mission ought to begin executing in your analysis equipment. In case of errors, discuss with the Analysis Board Person’s Information for configuration info.

{Hardware} Setup

The setup of the Analysis Board {hardware} is described within the Summary.txt file.

  • Confirm all jumper settings on the goal {hardware}.
  • Insert a SD card into the socket.
  • Use an USB cable to attach your growth board to the Host PC and energy up your board.
  • Look forward to the driving force set up on the PC to finish. First you will note “Putting in machine driver software program” and after a profitable set up “USB Enter Gadget” and “Keil Disk zero USB Gadget”.
Be aware
If units don’t set up appropriately then most likely machine is utilizing similar Vendor ID and Product ID as some machine that was beforehand already put in. There are two potential options: both change Product ID in USBD_Config_0.c file or uninstall beforehand put in machine that makes use of similar Vendor ID and Product ID.

PC Software program

The HID a part of this instance may be examined on a Home windows PC utilizing the HIDClient.exe utility (situated in “C:KeilARMUtilitiesHID_ClientRelease”). This system runs stand-alone with out set up.
Steps to test the USB communication utilizing the shopper utility:

  • Run “C:KeilARMUtilitiesHID_ClientReleaseHIDClient.exe”.
  • Choose the Keil USB Gadget to ascertain the communication channel.
  • Press buttons on the goal {hardware} and/or use the test bins within the HID Shopper to work together with the appliance. The Mass Storage a part of this instance may be examined on a Home windows PC utilizing the Home windows Explorer.
  • After a profitable driver set up, the AutoPlay window seems.
  • Should you click on on Open folder to view information Home windows Explorer mechanically begins with the drive opened.

Leave a Reply

Your email address will not be published. Required fields are marked *