Thursday 13 July 2017

USB HID demo with STM32 and emWin and FreeRTOS





This is a demonstration of the HID communication. The computer program reads the LED status via the USB and shows it on screen with 3 big indicators. In the mean while the scroll bar on the computer is used to control the flashing speed of the LED on board.



The board is using a STM32F103 MCU which has a USB 2.0 device full speed port. I didn't use the ST peripheral library or the ST's USB stack, all the USB code was built from scratch and is completely interrupt driven. So the code is compact and efficient, the USB core code is less than 400 lines.



FreeRTOS is used as the operating system to provide support of the GUI and multi-tasking. 3 software timers were used to control the LED flashing speed, the GUI refreshing, and the USB idle time. The benefit of using the software timer of the RTOS is there is no additional hardware and software cost to the system.



The whole tool chain I used is free except the Keil compiler. It is possible to use a free GNU compiler, anyway I bought the Keil several years ago and I can't see any reason not using it by now. The emWin is free to use if you are using the STM32 chips thanks for a deal made between ST and Segger. FreeRTOS is free of charge, even for commercial purpose. The compiler for the Windows program is Embarcadero's C++ builder, which is free to build Win32 applications now, for both personal and commercial use.

I would like to provide the source codes for this demo, but haven't found a way to upload files in Blogger, which is this site based on, I'll update this blog when the download is available. Before that, maybe you can contact me to send you an email.

5 comments:

  1. hi
    please send code of this demo for me.
    fazel459@yahoo.com
    thank.

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. The more you move your capacity around the better the shot for information misfortune and harm; facilitate your mind simply get one of these and anticipate USB Flash Drive Repair issues. see more

    ReplyDelete
  4. Hello is that possible to send demo code to atlantix.xp@gmail.com
    Thank you.

    ReplyDelete
  5. Hello is that possible to send demo code to atlantix.xp@gmail.com
    Thank you.

    ReplyDelete