Udemy
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
Development
Web Development Data Science Mobile Development Programming Languages Game Development Database Design & Development Software Testing Software Engineering Development Tools No-Code Development
Business
Entrepreneurship Communications Management Sales Business Strategy Operations Project Management Business Law Business Analytics & Intelligence Human Resources Industry E-Commerce Media Real Estate Other Business
Finance & Accounting
Accounting & Bookkeeping Compliance Cryptocurrency & Blockchain Economics Finance Finance Cert & Exam Prep Financial Modeling & Analysis Investing & Trading Money Management Tools Taxes Other Finance & Accounting
IT & Software
IT Certification Network & Security Hardware Operating Systems Other IT & Software
Office Productivity
Microsoft Apple Google SAP Oracle Other Office Productivity
Personal Development
Personal Transformation Personal Productivity Leadership Career Development Parenting & Relationships Happiness Esoteric Practices Religion & Spirituality Personal Brand Building Creativity Influence Self Esteem & Confidence Stress Management Memory & Study Skills Motivation Other Personal Development
Design
Web Design Graphic Design & Illustration Design Tools User Experience Design Game Design Design Thinking 3D & Animation Fashion Design Architectural Design Interior Design Other Design
Marketing
Digital Marketing Search Engine Optimization Social Media Marketing Branding Marketing Fundamentals Marketing Analytics & Automation Public Relations Advertising Video & Mobile Marketing Content Marketing Growth Hacking Affiliate Marketing Product Marketing Other Marketing
Lifestyle
Arts & Crafts Beauty & Makeup Esoteric Practices Food & Beverage Gaming Home Improvement Pet Care & Training Travel Other Lifestyle
Photography & Video
Digital Photography Photography Portrait Photography Photography Tools Commercial Photography Video Design Other Photography & Video
Health & Fitness
Fitness General Health Sports Nutrition Yoga Mental Health Dieting Self Defense Safety & First Aid Dance Meditation Other Health & Fitness
Music
Instruments Music Production Music Fundamentals Vocal Music Techniques Music Software Other Music
Teaching & Academics
Engineering Humanities Math Science Online Education Social Science Language Teacher Training Test Prep Other Teaching & Academics
AWS Certification Microsoft Certification AWS Certified Solutions Architect - Associate AWS Certified Cloud Practitioner CompTIA A+ Cisco CCNA Amazon AWS CompTIA Security+ AWS Certified Developer - Associate
Graphic Design Photoshop Adobe Illustrator Drawing Digital Painting InDesign Character Design Canva Figure Drawing
Life Coach Training Neuro-Linguistic Programming Personal Development Mindfulness Meditation Personal Transformation Life Purpose Emotional Intelligence Neuroscience
Web Development JavaScript React CSS Angular PHP WordPress Node.Js Python
Google Flutter Android Development iOS Development Swift React Native Dart Programming Language Mobile Development Kotlin SwiftUI
Digital Marketing Google Ads (Adwords) Social Media Marketing Google Ads (AdWords) Certification Marketing Strategy Internet Marketing YouTube Marketing Email Marketing Google Analytics
SQL Microsoft Power BI Tableau Business Analysis Business Intelligence MySQL Data Modeling Data Analysis Big Data
Business Fundamentals Entrepreneurship Fundamentals Business Strategy Online Business Business Plan Startup Blogging Freelancing Home Business
Unity Game Development Fundamentals Unreal Engine C# 3D Game Development C++ 2D Game Development Unreal Engine Blueprints Blender
30-Day Money-Back Guarantee
IT & Software Hardware Embedded Systems

USB Behind the Scenes: Hands-on HID Firmware Development

The #1 video course that explains programming bare-metal firmware for USB human interface devices (HID) step by step.
Highest Rated
Rating: 5.0 out of 55.0 (35 ratings)
332 students
Created by Mohammed Noureldin
Last updated 2/2021
English
English [Auto]
30-Day Money-Back Guarantee

What you'll learn

  • Write a bare-metal firmware for USB 2.0 human interface devices (HID) without using any third-party libraries or code generators.
  • Implement USB device driver and USB 2.0 protocol framework.
  • Program a fully functional USB mouse from zero.
  • Understand the generic USB descriptors and the descriptors specific to human interface device (HID) class.
  • Deal with native USB (WITHOUT any conversion to UART)
  • Use ARM Cortex-M4 based microcontroller (STM32F4xx), one of the most developed and famous MCU in the world.
  • Debug USB communication using Wireshark and Linux SysLog.
  • Read different parts of ARM Cortex-M4 reference manual and extract the important information efficiently.
  • Understanding how USB 2.0 protocol works in full speed mode.
  • Understand USB endpoints, pipes, transfer types, packets, transactions, frames, power supply, topology, and many more.
  • Learn the basic mechanical and electrical specifications of the USB (connectors, cables, speed enumeration resistors, and many more).
  • Know the history and motivation behind developing the universal serial bus (USB).
  • Learn using Single Wire Output (SWO) to send logs to the debugging host.
  • Increase your productivity and code portability by using ARM CMSIS.
  • Document your code using Doxygen syntax.

Requirements

  • Basic knowledge of C programming language (recommended).
  • Basic knowledge of designing embedded systems.
  • Any STM32F4 Microcontroller (ARM Coretx-M4 based) on Discovery or Nucleo board to apply the knowledge.

Description

Have you ever wanted to develop your own device that can be connected to a computer using USB? Are you familiar with using USB <-> UART adapters but want to take your USB knowledge and understanding to the next ultimate level? If yes, then this course is absolutely for you!

I made the whole content of slides and code by myself after a lot of preparation and fine-tuning to give you the best experience you can find today online to learn and understand USB protocol and framework in theory and in practice.

Your journey with me in this course should save you from any frustration that could happen when you try to learn or understand USB from any other online source. USB is for most a mystery and a very complex protocol, and most engineers try to avoid it or at least try to convert it to other simpler protocols. However, after taking this course, you will be able to be a confident native USB engineer, and you will be able to develop your first bare-metal USB device with me without using any library, which will give you full control over the powers of USB. Even if you want in your career to use a USB library, taking this course will give you a full understanding of what is going on behind the scenes, and will allow you to be able to develop and fine-tune and USB device you want, because, after the end of this course, I would expect from you to have a full understanding of the concept of USB and how it works.

In this course, we will:

- Start with some theoretical information about USB.

- Understand the essential details of USB protocol.

- Take our time to understand how to configure the clock of any embedded system correctly.

- Implement a bare-metal USB firmware for ARM Cortex M4 based microcontroller (STM32F4xx family).

- Implement a bare-metal USB framework.

- Develop our own USB HID mouse from zero to fully functional!

Of course, the source code of the project we are going to develop together in this course will be available for you to download. You may use it as a template (fully or partially) for your projects in the future.

This course is in its early stages and some new additional content will be added or enhanced if necessary frequently. Nevertheless, the current content is full and sufficient to get a fully functional USB human interface device.

Happy engineering! See you inside the course!

Who this course is for:

  • Anyone who wants to understand how the complex USB systems work behind the scenes.
  • Embedded engineers who want to develop USB devices.
  • Engineers who want to enrich their knowledge in embedded systems in general.
  • Engineers who want to write modular and maintainable firmware.

Course content

11 sections • 166 lectures • 14h 29m total length

  • Preview04:38
  • How to Get the Most of This Course?
    00:37
  • Discord Server for Student Communication
    00:09
  • Why STM32F429ZI (ARM Cortex-M4 Based) Microcontroller?
    00:09
  • Udemy Review
    01:37

  • Preview05:37
  • History
    05:48
  • Cables and Connectors
    02:55
  • USB 2.0 Cable Structure
    01:23
  • Main Features
    05:58
  • Bus Topology and Functions
    09:10
  • VBUS
    00:29
  • Power Delivery Specification
    10:18
  • Smart Charger
    01:40

  • Differential States
    05:27
  • Bus States
    10:09
  • Timing Tolerance
    01:21
  • USB 2.0 Speed Identification
    02:33
  • Bit Stuffing
    01:21
  • Preview04:24
  • Host Controllers
    05:11
  • Frames
    01:52
  • Endpoints
    11:57
  • (PDF) Packet and Transaction Types
    00:11
  • Packets
    03:59
  • Packet Types and Packet Fields
    12:12
  • Transaction
    02:27
  • Packet Identifiers
    01:56
  • Token Packets
    06:03
  • Data Packets
    01:47
  • Handshake Packets
    02:58
  • Device Address
    01:56
  • Preview03:20
  • USB is Host Driver
    05:54
  • USB is Host Driver Demonstration
    05:47
  • Endpoint Types (Transfer Types)
    02:58
  • Interrupt Transfer
    07:40
  • Preview02:59
  • Isochronous Transfer
    03:34
  • Control Transfer
    06:42
  • Control Transfer Stages
    11:19
  • Bus Bandwidth Allocation
    03:23

  • Installing STM32CubeIDE
    03:35
  • Creating a New Project
    04:01
  • Including ARM CMSIS
    19:48
  • Removing Sysmem and Syscalls
    00:47
  • Log to Debugger Using SWO
    06:54
  • Logging Helper
    08:16
  • Preview06:30
  • Project source code
    00:10

  • NO CODE GENERATION IN STM32CubeMX
    00:17
  • My Method to Explain Clocking
    03:44
  • Creating Temporary STM32CubeMX Project
    08:33
  • USB Module Requires 48 MHz Signal
    00:07
  • Understanding Clock Frequency Requirements
    04:49
  • Understanding PLL, Prescalers, SYSCLK, and HCLK
    04:26
  • Understanding MCO Divider
    02:17
  • Initial Steps to Configure the Clock
    05:10
  • CMSIS Bit Operations
    01:54
  • Configuring Flash Latency
    10:22
  • CMSIS Fld2Val and Val2Fld Macros
    01:21
  • Enabling HSE
    02:56
  • Enabling and Configuring PLL
    06:38
  • Configuring APB-Prescaler
    02:45
  • Disabling HSI
    00:31
  • Correction of PLL Configuration Trap
    04:38
  • Testing Clock Configuration
    02:59
  • Configuring MCO
    04:02
  • Preview03:29
  • Reconfiguring SWO Clock Frequency
    00:09

  • Installing Wireshark on Linux
    00:47
  • Viewing Linux System Log
    00:12

  • Firmware Architecture We Will Be Using
    07:04
  • Creating Driver Source and Header Files and Accessing USB Regions
    07:48
  • Configuring GPIOs as USB Pins
    05:56
  • Tips to Get the Most Benefits
    04:53
  • Skimming Core and Device Configuration
    07:37
  • USB Core Initialization
    06:49
  • Initializing USB Core Interrupts
    02:20
  • Connecting the USB Device to the Bus (Using Firmware)
    01:57
  • Preview04:42

  • USB Core Global Interrupts
    00:44
  • USB Global Interrupt Handler
    05:25
  • Steps of Handling USB Reset Signal
    03:46
  • USB Reset Handler
    03:10
  • Configuring Endpoint 0
    12:13
  • Configuring IN Endpoints
    06:52
  • NOTICE about "Deconfiguring Endpoint" lecture
    00:09
  • Deconfiguring Endpoint
    03:54
  • NOTE: Parameters Validation and Code Documentation
    01:33
  • Understanding FIFO Dedicated Memory
    11:16
  • Configuring FIFO Size
    06:01
  • Configuring FIFO Offset
    04:41
  • Configuring FIFOs While Configuring Endpoints
    05:25
  • Flushing FIFOs
    03:09
  • Accessing the FIFOs
    04:45
  • Transfer Completed Interrupts
    04:32
  • USB Speed Enumeration Done Handler
    02:48
  • Implementing RxFIFO Not Empty Interrupt Handler
    10:27
  • SETUP and OUT Transfer Completed Status Data
    09:50
  • Popping Data from the RxFIFO (From an OUT endpoint)
    13:50
  • Pushing Data into a TxFIFO (To an IN endpoint)
    05:53
  • Fixing Compilaiton Error (Reorder Some Functions)
    02:29
  • Defining USB Driver Type
    07:18

  • Polling on Interrupt Level
    06:55
  • Defining USB Events Type
    08:12
  • Defining USB Device States
    01:52
  • Defining USB Control Transfer Stages
    04:41
  • Defining USB Device Instance Structure
    04:47
  • Starting to Configure the USB Device Instance
    04:53
  • Implementing USB Reset Handler
    03:03
  • [DRIVER] Implementing USB Set Address
    01:54
  • Triggering USB Reset Event (Calling the Handler)
    03:58
  • Preview10:59
  • Understanding USB Request Structure
    09:16
  • Understanding USB Standard Device Requests
    14:38
  • Defining the Structure of USB Requests
    07:21
  • Starting Processing the Requests
    07:43
  • Investigating the First Request
    15:27
  • Defining Descriptor Structure
    05:10
  • Writing the Device Descriptor
    13:16
  • Defining the Standard Request Macros (wValue)
    06:05
  • Defining a Variable after a Switch Case Error
    03:02
  • Write a Packet ONLY when the Endpoint is Empty
    04:08
  • Starting Implementing Control Stage Processor
    08:09
  • Handling GET DEVICE Descriptor Request
    05:27
  • Processing IN-DATA Stage
    12:13
  • Handling IN and OUT Endpoint Interrupts
    15:08
  • Handling IN and OUT Transfer Completed
    07:53
  • Sending the Last Packet of Transactions
    12:13
  • Processing OUT-STATUS Stage
    01:58
  • Processing IN-DATA Zero Sub-Stage
    05:35
  • Call the Implemented Functions Before Testing
    03:29
  • Viewing the First Successful Communication in SysLog
    03:35
  • Viewing the First Successful Communication in Wireshark
    08:34
  • Processing SET ADDRESS Request
    03:57
  • Setting Device Address after transaction completion
    00:21
  • Processing IN-STATUS Stage
    02:10
  • Preview01:38
  • Preview01:35
  • Viewing full GET DEVICE DESCRIPTOR response in Wireshark
    01:24
  • Viewing GET CONFIGURATION request in Wireshark
    01:55
  • Understanding the idea of combining descriptors
    03:20
  • Defining CONFIGURATION descriptor placeholder
    05:43
  • Merging the CONFIG-Combination into one definition
    01:36
  • Handling GET CONFIGURATION DESCRIPTOR request
    05:50
  • Understanding the size of CONFIG-Combination
    05:59
  • Processing SET CONFIGURATION request
    04:39
  • Defining use-case-specific configuration function
    06:10

  • Simple USB Mouse specifications
    01:45
  • Preview07:26
  • Writing INTERFACE descriptor
    06:16
  • Writing ENDPOINT descriptor
    07:13
  • Writing HID descriptor
    07:59
  • Introducing HID Report descriptor / HID report structure
    06:48
  • Describing HID buttons
    06:56
  • Describing HID axes
    05:48
  • Compacting HID report descriptor
    10:16
  • Packing data encapsulations (no word alignment)
    13:27
  • Introducing Set Idle and Get HID Report descriptor requests
    06:20
  • Handling SET IDLE request
    05:15
  • Handling GET HID REPORT descriptor request
    07:10
  • Responding to INTERRUPT IN tokens
    12:54
  • Testing the USB HID Mouse
    02:31
  • Changing descriptors order (Windows compatibility)
    09:42

Instructor

Mohammed Noureldin
SW, HW & DevOps Engineer | AI Enthusiastic | Pharmacologist
Mohammed Noureldin
  • 5.0 Instructor Rating
  • 35 Reviews
  • 333 Students
  • 1 Course

Austrian software engineer with a focus not only on coding, but also on every single detail of software engineering, equipped with a diversity of promising and useful skills, like deep knowledge in different programming languages and frameworks, hands-on embedded systems, and a thorough DevOps experience. Always interested in the latest cutting-edge technologies, and recently started gaining deep knowledge and experience in the field of machine learning and artificial intelligence. My huge passion for technology motivated me to self-educate myself in these different technical fields, and the vision to the future keeps pulling me to develop myself continuously.

Additionally, a pharmacist holds a doctoral degree (Ph.D.) in pharmacology from the University of Graz in Austria. Besides being a husband to a beautiful doctor, but not a father yet.

To keep myself fit (though in the being time I am not really committed), swimming, table tennis, and cycling are my favorites. Occasionally I like to play some computer or board games.

  • Udemy for Business
  • Teach on Udemy
  • Get the app
  • About us
  • Contact us
  • Careers
  • Blog
  • Help and Support
  • Affiliate
  • Impressum Kontakt
  • Terms
  • Privacy policy
  • Cookie settings
  • Sitemap
  • Featured courses
Udemy
© 2021 Udemy, Inc.