#tinyusb

1 messages ยท Page 9 of 1

fallow birchBOT
fallow birchBOT
#

Okay I am sorry for that. I reviewed the code with a friend and he pointed out the xss vulnerability. I tried to fix it but I don't have access to a mcu at the moment. You can test it again now or I will ping you again some time next week after I have tested it myself.

Now it's much better, the sending works :)

I've some issues with auto-reconnect, it didn't reconnect when I replug the device, instead it reconnects when I manually click disconnect. To keep it simple I think you can re...

#

Pull Request Overview

Add support for USBTMC vendor-specific command messages by treating them similarly to standard device-dependent messages, with an internal flag to switch the response MsgID.

  • Handle VENDOR_SPECIFIC_MSG_OUT and VENDOR_SPECIFIC_IN in the transfer callback
  • Introduce usbtmcVendorSpecificRequested flag to track vendor-specific requests
  • Update tud_usbtmc_transmit_dev_msg_data to choose the correct MsgID for vendor-specific responses

Comments suppressed due...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Pull Request Overview

Adds handling for vendor-specific USBTMC messages by tracking when they occur and adjusting the message IDs in both transmit and transfer callbacks.

  • Introduce a new flag to mark vendor-specific command transfers
  • Update tud_usbtmc_transmit_dev_msg_data to set the correct MsgID based on the new flag
  • Extend the transfer callback (usbtmcd_xfer_cb) to process VENDOR_SPECIFIC_MSG_OUT and VENDOR_SPECIFIC_IN messages

Comments suppressed due to low confi...

fallow birchBOT
fallow birchBOT
#

Operating System

MacOS

Commit SHA

8a78804ff91271fb32008288777fad9fe73f5735

Board

Raspberry Pi Pico

Firmware

examples/device/uac2_headset/src/main.c

What happened ?

Running the uac2_headset example on a Raspberryโ€ฏPiโ€ฏPico crashes when built from commits dated after Julyโ€ฏ8.
The last commit that worked correctly is 1a41445b17e11db9ab58a39488e4b0d9d85f0fd1; failures start from commit a56f55c10bea2ce0d38de6a04edae41e6c814b9f onward.

How to reproduce ?

1a41445b17...

fallow birchBOT
halcyon mulch
#

Hi all,

I can't get a Pico 2 W to work with any of the Adafruit_TinyUSB examples on Arduino

I can them to work with other MCUs i.e. QT Py 2040, XIAO 2040

My Pico W 2 works fine - it can print to Serial normally

It's just the Dual-Role examples don't have anything printed to Serial

Are there any pitfalls I'm not aware of? Starting to tear my hair out
I've double checked I'm using the right D+ D- Pins!

Thanks for any help

fallow birchBOT
#

Related area

Avoids memcpy with calling write functions

Hardware specification

Probably applicable to all hardware

Is your feature request related to a problem?

Streaming on webusb vendor endpoint as fast as possible

The speed jumped from 10MB/s to 26.5MB/s with the modification below.
Hardware details: CH32V305, USBHS, CFG_TUD_VENDOR_EPSIZE=512

Describe the solution you'd like

Within this piece of code:
https://github.com/hathach/tinyusb/blob/8a78804ff91271fb32008288...

fallow birchBOT
#

Fix #3177
This PR contains small but critical fixes for the RP2040, and theโ€ฏuac2_headset example.

  1. src/portable/raspberrypi/rp2040/dcd_rp2040.c โ€“ suppress unnecessary resets on ISO endpoints
    Skipsโ€ฏhw_endpoint_reset_transfer() when the endpoint is isochronous. Prevents redundant EP resets that could stall ISO streams and trigger the Can't continue xfer on inactive ep 81 panic.
  2. examples/device/uac2_headset/src/main.c โ€“ always transmit a silent frame when no OUT data arr...
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

In RFC 2131, the destination of DHCP OFFER/ACK is defined in Section 4.1. Fix the destination error by following the rule of RFC 2131. TODO: We implement all rule but the last one. ARP table is required to associate client's macaddr. Currently, fallback to broadcast.

Describe the PR
A clear and concise description of what this PR solve.

Additional context
If applicable, add any other context about the PR and/or screenshots here.

fallow birchBOT
#

Operating System

Others

Commit SHA

e1509ba0bb5d4aa64c6ec471ea408c2ab43a027a

Board

Pico 2 W

Firmware

See https://github.com/pekkanikander/pico-tinyusb-msc-panic
for a minimal reliable reproduction, with a proper README explaining the root cause.

This seems to be related to https://github.com/hathach/tinyusb/issues/2322 and https://github.com/hathach/tinyusb/issues/1232.

However, this is a reliable way to reproduce the bug always and explains the root cause.

What h...

#

Base explanation from the README in https://github.com/pekkanikander/pico-tinyusb-msc-panic/tree/main:

The specific bug occurs with TinyUSB's MSC implementation when handling MSC SCSI READ10 commands on the RP2040 or RP2350. The root cause appears to be how the SCSI layer handles so-called short reads (which the device should not do) and that the RP2040 port does not support packet queueing.

TinyUSB schedules the next IN transfer optimistically before the previous one has a chance to comple...

fallow birchBOT
#

Pull Request Overview

This PR fixes handling of complex audio/MIDI devices where a MIDI interface appears after an audio streaming interface, specifically addressing issue #3159. The changes enable proper parsing of device descriptors for guitar effects processors and similar devices that have audio control, audio streaming, and MIDI interfaces in sequence.

  • Adds logic to skip over audio streaming interfaces when searching for MIDI interfaces
  • Updates comments to explain the expected i...
#

The while loop condition is overly complex and difficult to read. Consider breaking this into multiple conditions or extracting helper functions for better readability.

    bool within_bounds = (p_desc < p_end) && (tu_desc_next(p_desc) <= p_end);
    bool not_midi_streaming = (desc_itf->bDescriptorType != TUSB_DESC_INTERFACE || 
                               (desc_itf->bInterfaceClass == TUSB_CLASS_AUDIO && 
                                desc_itf->bInterfaceSubClass != AUDIO_...
#

The condition tu_desc_next(p_desc) <= p_end could cause buffer overread. If p_desc is at the boundary, tu_desc_next(p_desc) may read beyond the buffer to determine the next descriptor position.

    while ((p_desc < p_end) &&
           ((p_desc + ((tusb_desc_interface_t const *)p_desc)->bLength) <= p_end) && // Ensure descriptor length is within bounds
           (tu_desc_next(p_desc) <= p_end) &&
           (desc_itf->bDescriptorType != TUSB_DESC_INTERFACE || 
           ...
fallow birchBOT
fallow birchBOT
#

Pull Request Overview

This PR adds support for the nanoCH32V305 board to the TinyUSB library. The changes involve creating a new board configuration and consolidating the CH32V30x family under a unified directory structure.

  • Creates board configuration files for the nanoCH32V305 development board
  • Updates family code to handle optional button configurations
  • Consolidates CH32V307 into the broader CH32V30x family structure

Reviewed Changes

Copilot reviewed 6 out of 20 changed fil...

fallow birchBOT
#

Pull Request Overview

This PR implements RFC 2131 Section 4.1 compliant destination address selection for DHCP OFFER and DHCP ACK messages. The change fixes incorrect destination addressing in the DHCP server implementation by replacing hardcoded broadcast addresses with proper destination selection logic.

  • Adds get_dhcp_destination() function that implements RFC 2131 destination selection rules
  • Updates DHCP OFFER and DHCP ACK message handling to use RFC-compliant destination addres...
fallow birchBOT
#

Describe the PR
Adding support for CH58x chips, currently tested on CH585.
Additional context

A new USB device driver has been introduced for CH58x, rather than reusing the ch32_usbfs driver.
While the core USB controller logic remains mostly similar to CH32, several key differences prevented a easy and clean reuse of the ch32_usbfs driver:
1.Register address layout and bitfield definitions differ significantly.
2.Endpoint control logic has been revised, now RX...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: at32
#

Pull Request Overview

This PR adds support for AT32 microcontrollers (MCUs) from ArteryTek to the TinyUSB stack. This appears to be a continuation of a previous effort due to access restrictions on a previous PR.

Key changes include:

  • Addition of 7 new AT32 MCU variants (AT32F403A_407, AT32F413, AT32F415, AT32F423, AT32F425, AT32F435_437, AT32F402_405)
  • MCU-specific configuration files, drivers, and board support packages (BSP)
  • Hardware abstraction layer implementations for USB inter...
#

Magic numbers are used for register addresses and bit operations. Consider defining named constants or using the proper register definitions from the AT32 HAL to improve code readability and maintainability.

            *(int*)(USB_OTGFS1_GCCFG) |= VBUS_SENSING_ENABLE_BIT;
        #elif BOARD_TUD_RHPORT == 1
            *(int*)(USB_OTGFS2_GCCFG) |= VBUS_SENSING_ENABLE_BIT;
        #endif
    #endif
    #ifdef BOARD_TUH_RHPORT
        #if BOARD_TUH_RHPORT == 0
            *(int*)...
fallow birchBOT
#

We are skipping all descriptors that are not interface class, and we are skipping all audio interface class descriptors that are not MIDI streaming. If we encounter a different interface class, we break out of the loop and give up. The proposed change will not break out of the loop if, for example, the audio streaming descriptors are followed by a Mass Storage Class interface descriptor.

fallow birchBOT
#

Pull Request Overview

This PR provides a complete rewrite of the web serial example website, implementing a modern web interface for debugging serial communications through WebUSB and WebSerial APIs. The new implementation significantly enhances the user experience with professional styling, improved functionality, and better user interaction patterns.

Key changes include:

  • Complete UI redesign with modern styling, dark mode support, and responsive layout
  • Enhanced serial communication...
#

The CSV generation is vulnerable to CSV injection and doesn't properly escape quotes within the text. The entry.text could contain double quotes that would break the CSV format. Consider using a proper CSV library or escaping quotes by doubling them: entry.text.replace(/"/g, '""').

        let sanitizedText = entry.text.replace(/"/g, '""').replace(/[\r\n]+$/, '');
        let line = new Date(entry.time).toISOString() + ',"' + sanitizedText + '"';
fallow birchBOT
#

thank you @Yveaux ! I did add TinyUSB not as library as it should allow to use its hardware abstraction. Using it as an external library now i run into exactly this issue bsp/* not been build as it is neither part of my project nor part of TinyUSB/src.

#include "bsp/board_api.h" // can not be found from within my project, therefor board_init() not available which means board is not set up. 
#include "tusb.h"

//------------- prototypes -------------//
static void...
fallow birchBOT
#

Related area

USB Host detection

Hardware specification

RP2040

Is your feature request related to a problem?

I am trying to enumerate the device using the arduino Dual Role device_info example. Here is the descriptor info that I pulled off using a computer:

Information for device FT232R USB UART (VID=0x0403 PID=0x6001):

------------------------------
Connection Information:
------------------------------
Device current bus speed: FullSpeed
Device supports USB 1.1 specifi...
fallow birchBOT
#

@makermelissa what is your setup, I think this should be already supported. If you are using Arduino IDE, please try DualRole/CDC/serial_host_bridge, you can jumper wire tx <-> rx on the ftdi and that would echo back anything you type in arduino monitor. Let me know if it does not work for you, I will pull out a similar hw to test with and/or update tinyusb (core/arduino lib) if needed.

fallow birchBOT
#

awesome, thank you for making PR for full at32 support. There are quite a bit of changes needed to get pass ci build as well as adding cmake build support, however I couldn't push to your fork's branch to update the PR. I have make my own PR based on this PR here https://github.com/hathach/tinyusb/pull/3191 .

PS: I am only able to test and confirm tinyusb work with an f403a (purple), however, the f423 (black) board does not work/start at all. Though it is probably clock/hw issue I guess. ...

fallow birchBOT
#
[hathach/tinyusb] New branch created: at32-doc
#

Pull Request Overview

This PR updates documentation and metadata for AT32 microcontroller support in TinyUSB, adding manufacturer information and board details for Artery chips.

  • Adds metadata comments with manufacturer and board information to AT32 family and board header files
  • Updates documentation files to include AT32 boards in reference tables
  • Corrects formatting and organization in the boards documentation

Reviewed Changes

Copilot reviewed 18 out of 33 changed files in t...

fallow birchBOT
#
[hathach/tinyusb] New branch created: update-inquiry2
#

Pull Request Overview

This pull request adds a bufsize parameter to the tud_msc_inquiry2_cb() function throughout the codebase. The parameter appears to indicate the available buffer size for the inquiry response, allowing implementations to respect buffer boundaries when constructing responses.

  • Added bufsize parameter to tud_msc_inquiry2_cb() function signature
  • Updated function declaration in header file and all implementations across examples and tests
  • Modified the functi...
fallow birchBOT
#

perfect, thank you. It look much nicer. I will update my gh-pages and landing page to use this as follow up PR. To be honest, I was always want to make the webusb more visual than serial bridge e.g adding items to control the on-board LED (on/off or blinky time) and displaying the button state. Is there any chance that you have the time to do that, for command we can simple do led=on/off/200 (for blinking interval), and button state can be reported from device with button=0/1 (need a bit of...

#

Mhh. I actually want to update the design a bit first. I will leave the core logic as is.
I will work on it during the next two-three weeks.

About webusb extra features:
Depending on how quickly you want this done I can work on it for sure. It would probably take a few months. I have to try to really tell if I find it interesting enough.

Ps:
Maybe you could help me out with one of my tinyusb issues. Maybe we can hop on a call together if you are comfortable with that. We can exchange...

fallow birchBOT
#
[hathach/tinyusb] New branch created: fix-audio-typo
fallow birchBOT
fallow birchBOT
#

Operating System

Linux

Commit SHA

87d9e05efa951d6e1b1c63cbb7f4261be96741e1

Board

nanoCH32V305

Firmware

CH32V305RBT6_pure_vendor_specific.zip

What happened ?

Summary
When connecting a CH32V305-based USB device using TinyUSB to an Android host, the enumeration process:
Takes abnormally long (โ‰ˆ8โ€“10 seconds)
Fails to show Manufacturer and Product Name in system...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Pull request submitted. As for the dwc2 register, since I don't have UART to get the debug log, I printed out manually using my own printf function. Hopefully, I got it correctly:

guid, gsnpsid, ghwcfg1, ghwcfg2, ghwcfg3, ghwcfg4
0x00000000, 0x4F54400A, 0x00000000, 0x229FDDD0, 0x03F006E8, 0x1FF0A020

I ran the following code after tusb_init to print them out:

volatile uint32_t const *p =
    (volatile uint32_t const *)&DWC2_REG(BOARD_TUD_RHPORT)->guid;
log_printf("guid, gsnps...
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: fix-rp2-audio-iso-transfer
fallow birchBOT
fallow birchBOT
#

Operating System

MacOS

Commit SHA

f6bec1073ea56ae4ab8a6cb3b313a92a5c37f745

Board

Custom IMXRT1176

Firmware

Config and descriptor files: https://gist.github.com/bear24rw/6b1f76b6c22043c945f154244fd6e8c6

CFG_TUSB_MCU=OPT_MCU_MIMXRT1XXX
BOARD_TUD_RHPORT=1

What happened ?

Trying to integrate tinyusb into a custom board but I'm getting what looks to be an underflow (reported value equals UINT16 - 512). My config and descriptors are basically stock. The only ...

fallow birchBOT
fallow birchBOT
#

I recently had an issue where I couldn't store large files when I was using RP2040 to test mtp docking with littlefs, I saved the file handle via the LFS_TYPE_USERATTR attribute of the littlefs file. At the moment it is normal when reading and writing small files. But when I write to a relatively large file (368k), I have the problem that the transfer timeout cannot be completed. Can you help with that? Thank you. Here are the logs I scraped.

Hi @diancity025, thank you for reporting....

fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: update-at32f405-phywidth-sel
#

Pull Request Overview

This PR updates the DWC2 USB driver to add support for the AT32F405 microcontroller variants (both FS and HS configurations) and refactors the PHY width selection logic for better maintainability.

Key changes:

  • Adds AT32F405 FS and HS register configurations to the device database
  • Consolidates PHY width determination logic into a single variable-based approach
  • Updates documentation table to include the new AT32F405 variants

Reviewed Changes

Copilot review...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Related area

ohci, cache

Hardware specification

ohci, TI AM1808

Is your feature request related to a problem?

Hi, I am currently contributing to the Pybricks project to port MicroPython to the Lego Mindstorms EV3. This is built around a TI Sitara AM1808 SoC. We run our own bare-metal code without Linux on this chip.

As part of this effort, we need a USB host stack for the OHCI controller, and we were hoping to use TinyUSB. However, the exist...

fallow birchBOT
#

Operating System

Linux

Commit SHA

Latest TinyUSB main branch (issue affects all versions using STM32 CMSIS dependencies)

Board

STM32L432KC (custom board) - affects all STM32L4 boards using HSI16 clock

Firmware

USB Audio Class 2.0 (UAC2.0) interface. 48kHz sample rate audio capture from ADC with real-time USB streaming. Uses HSI16 internal oscillator as system clock source.

What happened ?

Outdated STM32 CMSIS device headers (`6ca7312fa6a5a460b5a5a63d66da527fdd8359...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Pull Request Overview

This PR adds support for the WeAct Studio BlackPill AT32F403ACGx board to the TinyUSB library, porting the board configuration from a previous pull request (#2839).

  • Adds new board configuration files for the WeAct BlackPill
  • Refactors button handling to support board-specific pull resistor configurations
  • Updates existing AT_START_F403A board configuration to use the new button abstraction

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this ...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Operating System

Windows 11

Commit SHA

version 0.18.0 bundled by pico

Board

RP2040 custom board

Firmware

full code example is available here: https://github.com/mdhosale/tinyUSBv18bugRP2040
this code is from a larger project but was tested and verified before uploading.

I am using a custom descriptor to get 2-channel out from USB - but from what I can tell it aligns with the format of the 1 and 4 channel descriptor embedded in the API

What happened ?

UAC2 and CD...

fallow birchBOT
#

Thank you for your reply...

What is adportaudio_start ? It doesn't like an error emit by Windows.

apologes - I am testing the audio in Max by Cyling74 - this is the error it provided when thw audio froze.

Your log is hard to read, please use usbtreeview and look error from device manager.
device manager reports the device is working properly

Device USB\VID_CAFE&PID_4011&MI_00\7&332144be&1&0000 was configured.

Driver Name: usbaudio2.inf
Driver Package ID: usbaudio2.inf_amd64_2390f0bffa...

fallow birchBOT
fallow birchBOT
#

Thank you for you quick responses. - I think that's where I am struggling - I noticed the updated doc that added the

void USB0_IRQHandler(void) {
  tusb_int_handler(0, true);
}

but I haven't found an example that describes how to implement this on a rp2040. In the example files, as far as I can tell, there isn't any indication of that being implemented. Sorry if I am missing something and thank you again for your help...

fallow birchBOT
#

Thank you for you quick responses. - I think that's where I am struggling - I noticed the updated doc that added the

void USB0_IRQHandler(void) {
  tusb_int_handler(0, true);
}

but I haven't found an example that describes how to implement this on a rp2040. In the example files, as far as I can tell, there isn't any indication of that being implemented. Sorry if I am missing something and thank you again for your help...

Personally I only use industrially proven M...

fallow birchBOT
#

Operating System

Windows 11

Commit SHA

None

Board

ESp32-S3

Firmware

I'm using: "espressif/esp_tinyusb^1.7.6~1"
From: https://components.espressif.com/components/espressif/esp_tinyusb/versions/1.7.6~1/changelog?language=en

What happened ?

Hello friends,
I'm using VSCode + ESP-IDF v5.5.
I want to create a USB device that functions as USB CDC and USB HID.

I have a function that looks like this:
`CommunicationUSBClass.Initialize("CompanyName", "ProductName", SerialN...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Pull Request Overview

This PR adds support for two new Espressif MCU variants (ESP32-C5 and ESP32-C61) to the TinyUSB library to enable future MAX USB host support. The changes define new MCU option constants and include them in the existing MCU compatibility check.

  • Added MCU option definitions for ESP32-C5 (908) and ESP32-C61 (909)
  • Updated MCU compatibility check to include the new ESP32 variants

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request a...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Operating System

Others

Commit SHA

esp-idf v5.5

Board

esp32-p4

Firmware

examples/host/cdc_msc_hid

What happened ?

After updating ESP-IDF from 5.4.0 to 5.5, an error occure after TinyUSB initialization: assertion of check_dwc2 failed.
Before the update, the USB works fine.

How to reproduce ?

Here is my usb_init():

bool usb_init(void)
{
  // Configure USB PHY
  usb_phy_config_t phy_conf = {
      .controller = USB_PHY_CTRL_OTG,
      .target = USB_PHY...
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Here is the tusb_config.h file:

/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2019 Ha Thach (tinyusb.org)
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Sof...
fallow birchBOT
#

This PR solves the compatibility issues with USB device/class in WCH CH32V20x USBFS Host function.

Patch 522a34ee28bcee6674ccd91973cb87869be98909
Inserting a small delay for LowSpeed devices before executing transfer. Communication problems were occurred in some LowSpeed devices behind USB Hub.

Patch a3bb7a90b3478f43d448443140b68c3473331f93
Improve retry strategy on NAK response. Without this patch, MassStorage class device works but CDC class device doesn't. In this patch, re...

fallow birchBOT
#

The STM32N6570-DK board specific files are added, and the "Supported Boards" list is updated.

"examples/device/cdc_dual_ports" example was running on the board successfully with the limitation described below.

There is a feature/bug:
The example should be built with DEBUG=1 and without logs strongly (make BOARD=stm32n6570dk DEBUG=1 all), otherwise it does not work.

make BOARD=stm32n6570dk DEBUG=1 LOG=2 all
or
make BOARD=stm32n6570dk LOG=2 all
leads to the following log and the b...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

@liamfraser Sorry about the much delayed reply - due to circumstances out of my control I currently have no way of further analyzing this issue or whether it is still applicable with the latest upstreams (from what I recall of where I left it off it was potentially related to a lack of certain data validation on both sides, but don't quote me on that). Will therefore close as not reproducible, possibly to be resubmitted if/when I return to this space; thank you for your prior attention to thi...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Pull Request Overview

This PR improves USB Host Controller Driver (HCD) compatibility for WCH CH32V20x USBFS host function by addressing timing issues with low-speed devices and implementing a better NAK retry strategy. The changes enhance device compatibility, particularly for CDC class devices and low-speed devices behind USB hubs.

  • Adds delay for low-speed USB devices to prevent communication issues
  • Implements event-driven NAK retry mechanism instead of immediate retry
  • Replaces P...
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: copilot/fix-3218
#

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original issue description:

Operating System

Others

Commit SHA

5fb3c09963bca362e535788e289d4b3518da5973

Board

n/a

Firmware

n/a

What happened ?

Checking with a static analysis tool, I noticed that _tu_fifo_peek() in [src/common/tusb_fifo.c](https://github.com/hathach/tinyusb/bl...

#

@hathach ๐Ÿ‘‹ This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click [here](https://github.com/hathach/tinyusb/issues/new?title=โœจ+Set+up+Copilot+instructions&body=Configure%...

#

Pull Request Overview

This pull request adds support for the STM32L496ZG Nucleo board to the existing STM32L4 board support package. It includes complete board configuration files and improves USB GPIO pin speed settings for the entire STM32L4 family.

  • Added complete board support files for the STM32L496 Nucleo board
  • Updated GPIO pin speed configuration for USB pins from HIGH to VERY_HIGH speed
  • Created linker script, build configuration, and board header files

Reviewed Changes

...

fallow birchBOT
#

Pull Request Overview

This PR adds comprehensive HID Consumer Usage Page codes based on the official USB HID specification. The changes expand the existing limited set of consumer control codes to include the complete list of official usage codes for better HID device support.

Key changes:

  • Expanded consumer control codes from ~20 entries to over 400 entries
  • Added usage codes for media control, application launchers, and GUI applications
  • Organized codes by functional categories ...
#

These duplicate constant definitions with the same hex values create potential confusion. Consider using #define aliases or comments to clarify the relationship between the full and abbreviated names.

  // Alias for HID_USAGE_CONSUMER_SCAN_NEXT_TRACK
  #define HID_USAGE_CONSUMER_SCAN_NEXT HID_USAGE_CONSUMER_SCAN_NEXT_TRACK
  HID_USAGE_CONSUMER_SCAN_PREVIOUS_TRACK               = 0x00B6,
  // Alias for HID_USAGE_CONSUMER_SCAN_PREVIOUS_TRACK
  #define HID_USAGE_CONSUMER_SCAN_PREVI...
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: copilot/fix-3233
#

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original issue description:

Configure instructions for this repository as documented in Best practices for Copilot coding agent in your repository.

Fixes #3233.


๐Ÿ’ก You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Mod...

fallow birchBOT
#
[hathach/tinyusb] New branch created: copilot/fix-3209
#

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original issue description:

Operating System

Linux

Commit SHA

Latest TinyUSB main branch (issue affects all versions using STM32 CMSIS dependencies)

Board

STM32L432KC (custom board) - affects all STM32L4 boards using HSI16 clock

Firmware

USB Audio Class 2.0 (UAC2.0) interface. 48kHz sample ra...

#

@copilot retry to fetch address that is blocked by firewall in previous attempt

I have successfully validated all the STM32 CMSIS dependency commit hashes by directly testing the get_deps.py script. All dependencies fetch correctly:

โœ… STM32L4: a2530753e86dd326a75467d28feb92e2ba7d0df2 - fetches successfully
โœ… STM32F4: 0fa0e489e053fa1ca7790bb40b4d76458f64c55d - fetches successfully
โœ… STM32H7: 45b818cab6ee2806e3a27c80e330957223424392 - fetches successfully
โœ… **STM3...

fallow birchBOT
#

@copilot also update all dependencies under hw/mcu/st

All STM32 dependencies under hw/mcu/st have been updated to their latest versions, including all HAL driver libraries. This brings years of bug fixes and improvements from STMicroelectronics' official releases.

Updated 19 HAL drivers:

  • STM32C0/F0/F1/F2/F3/F4/F7/G0/G4/H5/H7/H7RS/L0/L1/L4/L5/N6/U5/WB HAL drivers

All dependencies validated and can be fetched successfully with the get_deps.py script.

Commit: 7625b86

fallow birchBOT
#

Pull Request Overview

This PR updates all STM32 CMSIS device headers and HAL driver libraries to fix a critical bug in the STM32L432's HSITRIM register definition, where outdated headers were causing incorrect HSI16 clock calibration values.

  • Updates CMSIS device headers for all STM32 families to latest stable releases (2023-2025)
  • Updates all 19 STM32 HAL driver libraries to current versions
  • Includes modernized STM32H7 configuration files and linker scripts with updated copyright n...
#

This configuration change disables the uSD Transceiver (changed from 1U to 0U). This could be a breaking change for boards that rely on SD card functionality. Consider documenting this change or verifying it's intentional for all STM32H7 boards.

#define  USE_SD_TRANSCEIVER           1U       /*!< use uSD Transceiver: Set to 1U to enable SD card functionality. Change to 0U only if SD card is not required. */
#

@copilot don't add README_processed.rst to commit list, revert change to [test/unit-test/ceedling](https://github.com/hathach/tinyusb/pull/3234/files#diff-9fb7c55dd8d79433f171899b4a54521ce223cd2804a34...

Removed README_processed.rst from repository and reverted test/unit-test/ceedling file permissions to original non-executable state in commit e791a17.

#

Pull Request Overview

This PR creates comprehensive GitHub Copilot instructions for TinyUSB development workflow to help developers work more effectively with the embedded USB stack project.

Key changes:

  • Adds detailed development workflow instructions with verified timing estimates
  • Provides step-by-step guidance for setup, build system, testing, and validation
  • Includes project structure reference and debugging tips for common issues

Tip: Customize your code reviews wi...

#

There's an inconsistency between reported execution times (1-4 seconds) and recommended timeouts (5-30 minutes). The timeout recommendations seem excessive for operations that complete in seconds. Consider more reasonable timeouts like 30-60 seconds for quick operations.

-- takes 1-2 seconds. NEVER CANCEL. Set timeout to 30-60 seconds.

**Option 2: Individual Example with Make**
```bash
cd examples/device/cdc_msc
make BOARD=stm32f407disco all

-- takes 2-3 seconds. NEVER CANC...

#

There's an inconsistency between reported execution times (1-4 seconds) and recommended timeouts (5-30 minutes). The timeout recommendations seem excessive for operations that complete in seconds. Consider more reasonable timeouts like 30-60 seconds for quick operations.

-- takes 1-2 seconds. NEVER CANCEL. Set timeout to 30-60 seconds.

**Option 2: Individual Example with Make**
```bash
cd examples/device/cdc_msc
make BOARD=stm32f407disco all

-- takes 2-3 seconds. NEVER CANC...

#

There's an inconsistency between reported execution times (1-4 seconds) and recommended timeouts (5-30 minutes). The timeout recommendations seem excessive for operations that complete in seconds. Consider more reasonable timeouts like 30-60 seconds for quick operations.

-- takes 1-2 seconds. NEVER CANCEL. Set timeout to 30-60 seconds.

**Option 2: Individual Example with Make**
```bash
cd examples/device/cdc_msc
make BOARD=stm32f407disco all

-- takes 2-3 seconds. NEVER CANC...

#

There's an inconsistency between reported execution times (1-4 seconds) and recommended timeouts (5-30 minutes). The timeout recommendations seem excessive for operations that complete in seconds. Consider more reasonable timeouts like 30-60 seconds for quick operations.

-- takes 1-2 seconds. NEVER CANCEL. Set timeout to 60 seconds.

**Option 2: Individual Example with Make**
```bash
cd examples/device/cdc_msc
make BOARD=stm32f407disco all

-- takes 2-3 seconds. NEVER CANCEL....

#

Pull Request Overview

This PR improves the Board Support Package (BSP) files for AT32 microcontrollers, with a focus on better dual OTG USB module support and fixing configuration errors across multiple board variants.

  • Standardizes dual USB OTG configuration for chips with two OTG modules (F435/F437 and F402/F405 families)
  • Fixes button state configuration across multiple boards (F413, F415, F423, F425, F403a, F405)
  • Adds complete board support for previously missing variants (at_sta...
#

@copilot update all hw/mcu/st/cmsis_device-**

Updated all STM32 CMSIS device dependencies to their latest versions. The following 10 CMSIS device libraries have been updated to the latest commits from their respective STMicroelectronics repositories:

  • STM32C0, F4, H5, H7RS, L0, L1, L5, N6, U5, WB

All updates verified and dependencies fetch successfully with the get_deps.py script.

Commit: 78ab527

#

@copilot pre-commit is failing, fix it

Fixed pre-commit failures in commit 3fdff36. The issue was network timeouts when trying to install pre-commit hooks from remote repositories (PyPI). I converted the configuration to use local tools (system-installed codespell, ceedling, etc.) instead of remote dependencies, maintaining the same functionality while avoiding network connectivity issues.

fallow birchBOT
fallow birchBOT
#

Well, I'm not going to stop you. Just please be wary of using an AI Agent for anything more complex than hard-to-script sed replacements and copy-paste (and double check that it did they copy-paste correctly). Already I see in #3235 that it updated some of the device headers to... December 2025 :P.

I can't remember which org adopts this policy, but generally I agree w/ their paraphrased stance:

sed replacements and other small updates and lint fixes are generally going to be indisting...

fallow birchBOT
fallow birchBOT
#

Operating System

Linux

Commit SHA

8304587d7774526a03c6881d11e6d6208fe759be

Board

mimxrt1020_evk

Firmware

examples/host/msc_file_explorer

What happened ?

TinyUSB dues not detect the detatch event of a pen drive

How to reproduce ?

  1. Compile msc_file_explorer example for mimxrt1020_evk
  2. Executed on mimxrt1020_evk board
  3. using OTG cable, I connect an usb pen drive, it is detected and works well
  4. Remove the usb pen drive and it does not detect the ev...
fallow birchBOT
fallow birchBOT
#

Operating System

Linux

Commit SHA

8304587d7774526a03c6881d11e6d6208fe759be

Board

Raspberry Pi Pico

Firmware

https://github.com/rppicomidi/usb_midi_host/tree/main/examples/C-code/usb_midi_host_example with the MIDI OUT send code commented out

What happened ?

I plugged an Akai Professional LPD8 MIDI controller to the USB host port and operated the LPD8's controls. I expected the example application to display the incoming MIDI messages. Instead, there was no output....

fallow birchBOT
#

Well, I'm not going to stop you (not that I think I could :)). Just please be wary of using an AI Agent for anything more complex than hard-to-script sed replacements and copy-paste (and double check that it did they copy-paste correctly). Already I see in #3235 that it updated some of the device headers to... December 2025 :P.

I can't remember which org adopts this policy, but generally I agree w/ their paraphrased stance:

sed replacements and other small updates and lint f...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

I did some more tests in the past days, comparing TinyUSB with the NXP SDK example host_msd_fatfs_bm where detach detection works as expected.
In the SDK example, device removal is detected using the USB->PORTSC1.CCS (Current Connect Status) bit, together with USB->PORTSC1.CSC (Connect Status Change). Printing those bits in the main loop shows the expected sequence:

  • Initially both 0
  • After plugging in: CSC=1, CCS=1, then CSC is cleared and only CCS=1 remains
  • After unplugging...
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Pull Request Overview

This PR fixes an initialization issue on STM32F723E-DISCOVERY boards where the USB HS port would get stuck in reset_core by adding a 2ms delay after enabling the PHYC PLL. The fix addresses the lack of a ready bit in the USB_HS_PHYC peripheral by implementing a fixed delay, consistent with STM32 CubeHAL behavior.

Key changes:

  • Added 2ms delay after PLL enablement in STM32 DWC2 PHY initialization
  • Moved timing API declarations from tusb.h to tusb_common.h for...
fallow birchBOT
fallow birchBOT
#

Operating System

Others

Commit SHA

8304587d7774526a03c6881d11e6d6208fe759be

Board

mimxrt1020_evk

Firmware

examples/host/cdc_msc_hid

What happened ?

TinyUSB does not detect the detach event af an hub

How to reproduce ?

  1. Compile cdc_msc_hid host example for mimxrt1020_evk
  2. Executed on mimxrt1020_evk board
  3. using OTG cable, I connect an usb hub, it is detected
  4. Remove the usb hub and it it seems that the event is not detected

Debug Log as txt fi...

fallow birchBOT
#

Hi Max,

I did a little reading, it seems ENHOSTDISCONDETECT needs to be enabled once a high-speed device is connected. Once the device is disconnected this bit needs to be reset to 0.

https://github.com/nxp-mcuxpresso/sfw/blob/d7e76dbe1bf481bd7d4a7fbb167005bbfec8db6e/component/usb/host/usb_host_ehci.c#L3949

USB HS uses differential signaling and the disconnection detection mechanism is different, leaving the high-speed disconnect detector enabled will interfere FS device operation.

I quic...

fallow birchBOT
fallow birchBOT
#

Wrong flag, should be USBPHY_CTRL_ENHOSTDISCONDETECT_MASK...

Wow, the behavior is almost what we want.
I am attaching a new trace log.

minicom_tinyusb_patch000.txt

I'll describe it:

  • up to line 211 is the first insertion of the USB drive
  • between 212 and 216 is the removal of the USB drive. Line 214 is printed by the callback tuh_umount_cb() and line 216 by tuh_msc_umount_cb().
  • From line 217 to ...
fallow birchBOT
#

Pull Request Overview

This PR adds support for the ESP32-H4 microcontroller to TinyUSB, enabling USB functionality on this new Espressif chip. The changes extend the existing ESP32 family support by adding H4-specific configurations and drivers.

Key changes:

  • Add ESP32-H4 MCU definition and configuration in TinyUSB option files
  • Extend DWC2 controller support for H4's specific register mapping and interrupt sources
  • Update component files to include H4 in build targets and workflows

...

#

The change from setting specific override bits to clearing all override bits is a significant behavioral change. This should be documented explaining why "No overrides" is the correct approach for H4, as it differs from the previous implementation.

  /*
   * Clear all override bits in GOTGCTL ("No overrides").
   * 
   * For ESP32-H4 (and similar MCUs), the USB controller's override bits (BVALOEN, BVALOVAL, VBVALOVAL)
   * should be cleared during device initialization. Setting ...
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Pull Request Overview

This pull request adds support for the NUCLEO-WBA65RI evaluation board to TinyUSB, enabling USB functionality on the STM32WBA65 microcontroller series. This is the first STM32WBA family support added to TinyUSB.

Key changes include:

  • Addition of STM32WBA MCU support with DWC2 USB controller configuration
  • Complete board support package for NUCLEO-WBA65RI evaluation board
  • Updated dependency management to include STM32WBA HAL drivers

Reviewed Changes

Copilot...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

@hathach Yes sir. Here is the log from check_dwc2:

guid, gsnpsid, ghwcfg1, ghwcfg2, ghwcfg3, ghwcfg4
0x00006100, 0x4F54430A, 0x00000000, 0x228FE052, 0x03B882E8, 0xE2103A30

I think in this version of the synopsis dwc2 IP, you cannot read the version from the register once the GRSTCTL_CSRST is set.

In this case it's already fixed by https://github.com/hathach/tinyusb/commit/38f41f5fa28943086cd36653e0914fd59cb7ed03

fallow birchBOT
#

I'm observing exactly the same issue as above. My terminal output matches the above as well. However, I'm running a USB-Host on a NXP LPC4337, running tinyUSB v0.18.0.

I observe that the first time plugging in a USB-Flash-Drive the enumeration is successful. However, after I unplug it, pause, then re-plug it back into the Host, no further enumeration is successful. Attached is a text file capturing my terminal output.

[TermIo_UsbMscFlashDrive_RepeatedPlugins.txt](https://github.com/us...

fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: mtp
fallow birchBOT
#

Pull Request Overview

This PR fixes issues with EHCI device removal and re-plugging by addressing several race conditions and hardware-specific problems. The main purpose is to ensure proper device cleanup when disconnected and successful endpoint opening on subsequent reconnections.

Key changes include:

  • Implementation of NXP-specific USB PHY disconnect detection for high-speed devices
  • Fixed race condition in queue head management to prevent reuse of removed QHDs
  • Added proper MPU c...
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Pull Request Overview

This PR adds configuration support for single-buffered isochronous endpoints in the STM32 FSDEV driver. The feature is controlled by CFG_TUD_FSDEV_DOUBLE_BUFFERED_ISO_EP in tusb_config.h and uses hardware-specific capabilities when available.

  • Introduces hardware capability flags (FSDEV_HAS_SBUF_ISO) for different STM32 families
  • Adds configuration logic to choose between single and double-buffered ISO endpoints
  • Updates endpoint allocation and data transfe...
#

The comment on line 285 is unclear. It should explain what 'configuring the same buffer twice' means in the context of single-buffered mode without hardware SBUF_ISO support.

  // Otherwise, on devices without hardware SBUF_ISO support, a single-buffered
  // endpoint consumes the entire endpoint pair (both halves of the register).
  // To save PMA memory, we configure both halves to point to the same buffer,
  // effectively mapping the same memory region twice. This avoids all...
fallow birchBOT
#

I have been working on building CircuitPython for the Olimex RP2350pc and have modified the CircuitPython core to allow an rp2350 build to use the native usb pins for usb host instead of the normal CircuitPython device usage. I believe this is the first board attempting to use tinyUSB/RP2040 host with CircuitPython (non-PIO).

I seem to be running into the issue this PR is attempting to address as my initial build immediately would panic in rp2040_usb.c with "ep xx was already available". ...

#
[hathach/tinyusb] New branch created: fsdev_fix
fallow birchBOT
fallow birchBOT
#

Pull Request Overview

This PR implements manual d-cache support for the OHCI host controller driver to prevent data corruption when the CPU and OHCI controller access shared memory structures. The changes add cache-conscious data structure alignment, explicit cache operations, and modify struct access patterns to work with cache line boundaries.

Key changes:

  • Adds conditional alignment of OHCI transfer descriptors to cache line boundaries when d-cache is enabled
  • Introduces weak cache ...
#

This static assertion will fail when CFG_TUH_MEM_DCACHE_ENABLE is false because (0 % 32 == 0) evaluates to true, but the logic seems intended to only validate when dcache is enabled. Consider: TU_VERIFY_STATIC( !CFG_TUH_MEM_DCACHE_ENABLE || (CFG_TUH_MEM_DCACHE_LINE_SIZE % 32 == 0), \"cache line not multiple of 32\" );

TU_VERIFY_STATIC( !CFG_TUH_MEM_DCACHE_ENABLE || (CFG_TUH_MEM_DCACHE_LINE_SIZE % 32 == 0), "cache line not multiple of 32" );
#

The HCCA structure should be invalidated before reading the done_head field to ensure the CPU sees the latest data written by the OHCI controller. Add hcd_dcache_invalidate(&ohci_data.hcca, sizeof(ohci_hcca_t)); before accessing the done_head field.

  // done head is written in reversed order of completion --> need to reverse the done queue first
  hcd_dcache_invalidate(&ohci_data.hcca, sizeof(ohci_hcca_t));
fallow birchBOT
#

mtp example enumerate, but I got permission issue when trying to open the readme.txt on debian 12, not sure what is wrong. Btw, I also try to make modification to this PR but it seems that I couldn't push to the fork. @roundby let me know if you could give me the write permission to your PR's branch, or we can merge this as it is since it look good enough and I could make an follow up PR to update later.
Uploading image.pngโ€ฆ

fallow birchBOT
fallow birchBOT
#

In my application, I define it like this:

#define hcd_dcache_uncached(x) (*(volatile __typeof__(x) *)((uintptr_t)(&(x)) + MAGIC_OFFSET))

In words, it takes the address of x, adds a specific offset to it, and then accesses this new address (the address with the offset added) with the same type as the original x.

This is why it is a macro and not a function -- the return type is generic and always matches the type of x.

The reason this is able to work is because of ...

#

I wanted to avoid having to access an ED in done_queue_isr, because I am in general trying to access an ED as infrequently as possible, and I noticed that there were two reasons to access an ED there:

  1. To apply a workaround for a STALL situation
  2. To obtain the dev_addr and ep_addr for calling hcd_event_xfer_complete

For reason 1, I believe the STALL workaround is not necessary if EDs have an empty TD like the OHCI specification suggests.

After making that change to TD al...

fallow birchBOT
#

@hathach thank you so much for your positive review on this. Of course there is no problem of giving you write access on the fork, you should be already in.

If you can wait a week or two before merging I may have a look at the issue on Debian (unfortunately I cannot guarantee a more precise timeline). In addition, the file content should be the same defined on line 63 of mtp_fs_example.c. As it differs in your screenshot, may I ask you some additional context on the file content and the pl...

fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: fix-dwc2-reseet
#

Pull Request Overview

This PR fixes a hardware initialization issue in the DWC2 USB controller driver by ensuring the AHB (Advanced High-performance Bus) is idle before performing a core reset, as required by the official databook specification.

  • Adds AHB idle check before core reset operation
  • Improves code documentation with detailed comments explaining the reset sequence
  • Makes a variable const that was previously mutable but never modified

Files not reviewed (6)

  • **.idea/debug...
fallow birchBOT
fallow birchBOT
#

Those functions have slightly different semantics, especially since TDs do not go through the alternate uncached memory address. TDs use the normal memory mapping and use explicit cache operations.

It could be possible to use an approach like the following:

  • Modify these functions to take a parameter specifying the type of object being translated (TD, ED, HCCA)
  • Add compiler directives to place uncached data in a different linker section (placing it at 0xDxxxxxxx)

Would this be a be...

fallow birchBOT
fallow birchBOT
#

Hi, I am experiencing a similar issue, the callback is never called. I use a stm32g0 and a samd21 as my portable examples.

I use tinyusb as a 3rd party package to an existing private framework, and I put the glue around it myself. (I only use the /portable layer of the repo). The examples like cdc_msc and cdc_dual work fine, however when I try to put the cdc_task inside tud_cdc_rx_cb, tud_cdc_rx_cb is never called.

A look at disassembly tells me the weak link substitution is not occur...

fallow birchBOT
fallow birchBOT
#

Are you referring to allocating an empty TD in the OHCI specification? That's shown in Figure 5-6:

<img width="828" height="508" alt="Screen Shot 2025-09-16 at 5 28 35 AM" src="https://github.com/user-attachments/assets/7f71a77b-4ad8-4be5-bded-be6137b66ba1" />

<img width="826" height="684" alt="Screen Shot 2025-09-16 at 5 29 08 AM" src="https://github.com/user-attachments/assets/c83235ef-e2c8-4c4a-8a00-feddbdbfb2bc" />

The reason for doing this is so that you don't have to reach back...

fallow birchBOT
fallow birchBOT
#

Hi, I am experiencing a similar issue, the callback is never called. I use a stm32g0 and a samd21 as my portable examples.

I use tinyusb as a 3rd party package to an existing private framework, and I put the glue around it myself. (I only use the /portable layer of the repo). The examples like cdc_msc and cdc_dual work fine, however when I try to put the cdc_task inside tud_cdc_rx_cb, tud_cdc_rx_cb is never called.

A look at disassembly tells me the weak link substitution is...

fallow birchBOT
#

โ€ฆtime:

  • tusb_option.h: define OPT_MCU_ESP32H4
  • tusb_mcu.h: enable DWC2 USBIP for H4
  • dcd_dwc2.c: add H4 USB_WRAP field aliases (wrap_* โ†’ legacy names)
  • dwc2_esp32.h: add H4 controller entry (FS base/IRQ, ep caps)
  • family.c: include H4 in USB init/PHY setup

Describe the PR
A clear and concise description of what this PR solve.

Additional context
If applicable, add any other context about the PR and/or screenshots here.

#

Pull Request Overview

This PR adds support for the ESP32-H4 microcontroller to TinyUSB by integrating it into the existing DWC2 USB driver infrastructure. The ESP32-H4 is treated similarly to other ESP32 variants (S2, S3) that use the DWC2 USB controller.

  • Defines the new MCU option constant for ESP32-H4
  • Configures DWC2 USB controller parameters and register field mapping for H4
  • Enables H4 in USB initialization and PHY setup code paths

Reviewed Changes

Copilot reviewed 5 out ...

#

[nitpick] Using preprocessor macros to alias register field names can lead to debugging difficulties and namespace pollution. Consider using a struct-based approach or inline functions to map between H4's 'wrap_*' names and the legacy names, which would provide better type safety and debugging visibility.

// H4's USB_WRAP register block uses "wrap_*" field names. Provide struct-based accessors
// to map them to the names used by TinyUSB's DWC2 port for type safety and debugging....
fallow birchBOT
#

CDC class haven't been migrated to new weak override syntax yet, you can take a look how callbacks work in HID class. You can open a PR if you like.

Hi,
Thanks for the pointers, I'll have a look at the host code. I'm pretty sure I will find exactly what I expect, a direct call to a function, and it's weak, empty definition, instead of a weak declaration.

As for the issue carrying over with armgcc I figured I'd need to enable -flto, and it worked, but this is a big no-no for the compan...

fallow birchBOT
#

The present ./src/common/tusb_mcu.h forces a particular TU_ATTR_FAST_FUNC to assign a particular section name (specific to the Pico SDK linker files).

Given there is already a __not_in_flash() macro with the same section name in Pico SDK, it would be desirable to use the existing capabilities instead creating yet more. Also, the existing __not_in_flash() macro allows for overloading for custom builds, unlike the existing RP2040/RP2350 specific TU_ATTR_FAST_FUNC in tusb_mcu.h

fallow birchBOT
#
[hathach/tinyusb] New branch created: weak_cb
fallow birchBOT
fallow birchBOT
#

@HiFiPhile That is great! I really didn't expect this to be picked up this fast!

I started moving stuff on my own mirror on a branch and I have exactly the same changes (give or take). Making direct calls to weakly defined stubs works just fine with that compiler. We do that all the time in our private frameworks. I have not done the whole project tho, you clearly beat me to it ๐Ÿ˜…

I have other patches for passing compilation, mainly because of built ins (in the __GNUC__ section, becau...

fallow birchBOT
#

Operating System

Windows 10

Commit SHA

aa65639878f27a44d349044afd9c3fc134a92bd560874fdac1d836019b5c07ca version: 0.18.0~4

Board

ESP32-S3-DevKitC

Firmware

Hi,
I'm trying to use ESP32-S3 to construct a test device. I copied examples/device/usbtmc ("usb_descriptors.c and usbd_tmc.c") to my project and following is my initlization code :
`void usbtmc_task(void* pvParameters)
{
usb_phy_handle_t phy_handle;

usb_phy_config_t phy_conf = {
    .controller = USB_PHY...
fallow birchBOT
fallow birchBOT
#

@HiFiPhile Sorry for my rude, the hash is belongs to esp-registery, and the correct commit hash is https://github.com/espressif/tinyusb/tree/63c21abfbb383e490cb797d8076fe9ba29ddae3b/

After correct the direction of EP, it did no change.
Log:

USBD init on controller 0, speed = Full
sizeof(usbd_device_t) = 48
sizeof(dcd_event_t) = 12
sizeof(tu_fifo_t) = 20
sizeof(tu_edpt_stream_t) = 112
TMC init
guid, gsnpsid, ghwcfg1, ghwcfg2, ghwcfg3, ghwcfg4
0x00000000, 0x4F54400A, 0x00000000, 0x224DD93...
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Thank you for the deep review and rework on the driver, @hathach. I had a look at the functional changes, from what I see you are adding a tud_mtp_command_received_cb callback to allow the user code to handle the commands with more flexibility. Responsibility of managing MTP_OP_OPEN_SESSION, MTP_OP_GET_STORAGE_IDS, MTP_OP_GET_STORAGE_INFO, MTP_OP_GET_DEVICE_PROP_DESC and MTP_OP_GET_DEVICE_PROP_VALUE is moved from the driver to the user implementation (provided into the example). `...

fallow birchBOT
#

@roundby thank you, I am glad the refactor make sense to you. Indeed I think we should let application take full control of the data/response. Since it will be different from app to apps. Some device will has slow block storage such as SDcard and will only need to call the tud_mtp_data_send() when it got the data asynchronously. Actually the driver can handle part of the request e.g get_device_info() the data is pre-filled according to the CFG_TUD_MTP_DEVICE_INFO_* but still presented the who...

fallow birchBOT
fallow birchBOT
#

Hi @inbarab,

I double checked the issue and tried to reproduce it.

MSC example uses the USB-OTG peripheral and the same peripheral is used, when you enable the CONFIG_ESP_CONSOLE_USB_CDC option (or manually add the lines, you described earlier).

So, as this is the same peripheral, this is not possible to share it. Basically this is why this option is not available, when MSC class example is built with CONFIG_ESP_CONSOLE_USB_CDC enabled.

Could you please clarify what are you trying...

fallow birchBOT
#

Operating System

Windows 11

Commit SHA

Version used in micropython 1.26.1 and micropython 1.27

Board

different ESP32S3 boards UM FeatherS3 and plain "vanilla" ESP32S3 Wroom

Firmware

I wrote up a detailed bug report in:

https://github.com/micropython/micropython-lib/issues/1044

But no one seems to care or have simmilar problems.

Using circuitpython I easily can make the USB HID driver work with the same boards!

But for many reasons I want to do this project under mic...

fallow birchBOT
#

Related area

New chip support

Hardware specification

stm32u3xx

Is your feature request related to a problem?

I'd like to use TinyUSB with a Nucleo STM32U385RG-Q, but TinyUSB doesn't support STM32U3xx.

Describe the solution you'd like

Add support for STM32U3xx and the Nucleo STM32U385RG-Q.

I have checked existing issues, dicussion and documentation

  • [x] I confirm I have checked existing issues, dicussion and documentation.
fallow birchBOT
fallow birchBOT
#

Hello friends I have such a problem with the keyboard. I want to connect as a keyboard to a device that only supports USB1.1. The microcontroller I use is ESP32-S2 with tinyusb. I have changed CFG_TUD_ENDPOINT0_SIZE in tusbconfig to 8, but No connection was made.

I am using ESP32-S3
same issue with if trying to set .bMaxPacketSize0 = 8, on espressi/tinyusb. We setaddress or device descriptor failure if using .bMaxPacketSize0 = 8, with full speed usb configuration for hid setup. With ...

fallow birchBOT
#

Describe the PR
This PR add HID Usage Page and Table for Power Devices (0x84 - 0x85) based on pdcv11.pdf.

Additional context
While developing USB HID hardware using ESP32, I discovered this library and noticed its limited support for the power device HID field. Therefore, I made modifications to it.

Four usage pages are reserved for Power Devices: 0x84 to 0x87. This specification defines two usage pages:
the Power Device P...

fallow birchBOT
#

Hi @roma-jam

In this issue report, I asked that the app will be notified if the MSC failed to start (in this case, because the interrupt allocation failed).
My original intention was to start with a USB console and switch to MSC in run time. This isn't possible because the built in USB stack that's used for the USB console can't be stopped, and the interrupt is not released, but that's beyond this specific report

fallow birchBOT
#

Pull Request Overview

This PR adds HID Usage Page and Table definitions for Power Devices (0x84 - 0x85) based on the USB Power Device Class specification. The changes enhance TinyUSB's support for HID Power Device class by providing comprehensive usage definitions for power-related USB devices.

Key changes:

  • Separates existing HID_USAGE_PAGE_POWER (0x84) from new HID_USAGE_PAGE_BATTERY (0x85)
  • Adds complete Power Device Page usage table with 86 usage definitions
  • Adds complete Bat...
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

I have completed the rework, including adding support control request. I found that most command is rather application specific with filesystem manipulation. Therefore I think it would be easier for both the stack (and application) to forward most of the command handler to user. Though we can pre-process some command such as get device info (still the whole container is given to user should they want to have their own from sratch). This can change/expand in the future though. @roundby let me ...

fallow birchBOT
#
[hathach/tinyusb] New branch created: uac_simplify
fallow birchBOT
#

Previously alt settings are saved in an array sized by CFG_TUD_AUDIO_FUNC_n_N_AS_INT, since we limit each audio instance to one IN EP and one OUT EP, we can save directly the current alt setting value in the instance, which avoid a lookup operation.

  • No more need to define CFG_TUD_AUDIO_FUNC_1_N_AS_INT
  • No more need to call audiod_get_AS_interface_index in each transfer, on STM32F7 this call cost 600 cycles = 3us !
  • Remaining usage of audiod_get_AS_interface_index_global is re...
#

Pull Request Overview

This PR simplifies alternate setting management in the TinyUSB audio device class by removing the array-based storage and using direct field storage instead. The change eliminates the need for CFG_TUD_AUDIO_FUNC_n_N_AS_INT configuration and removes lookup operations that were costing 600 cycles (3ยตs) on STM32F7.

Key Changes

  • Replaced array-based alternate setting storage with direct fields in the audio instance structure
  • Removed configuration requirements f...
fallow birchBOT
fallow birchBOT
#

Operating System

Windows 11

Commit SHA

5130850337c1e8e0eedfa2d7165413de27ff6d2f

Board

Raspberry Pi Pico (RP2040)

Firmware

examples/device/uac2_speaker_fb

CFG_AUDIO_DEBUG is set to 1 (enabled), but to reproduce the issue, it must be set to 0 (disabled).
https://github.com/hathach/tinyusb/blob/master/examples/device/uac2_speaker_fb/src/tusb_config.h#L104

What happened ?

When CFG_AUDI...

fallow birchBOT
#

Pull Request Overview

This PR adds support for the STM32U083C-DK Discovery Kit board to TinyUSB. The STM32U0 series is a new ultra-low-power microcontroller family from STMicroelectronics based on the Cortex-M0+ core.

Key changes include:

  • Added STM32U0 family support with USB device functionality
  • Configured board-specific settings for GPIO, clock, and USB peripheral
  • Updated build system and CI to include the new board

Reviewed Changes

Copilot reviewed 15 out of 15 changed fil...

fallow birchBOT
fallow birchBOT
#

@shermp Hi, good news for you, my UAC1 support is in a good state: https://github.com/HiFiPhile/tinyusb/tree/uac1, it supports v1 & v2 at the same time.
audio_test_multi_rate and uac2_speaker_fb examples have been updated with dynamic switching based on actual operating speed (FS=UAC1, HS=UAC2)

However with uac2_speaker_fb example I'm unable to getting UAC1 feedback work on Windows, enumeration goes well but the device ended with `Error 10: the i/o device is configured incorrectly or...

fallow birchBOT
#

@shermp Hi, good news for you, my UAC1 support is in a good state: https://github.com/HiFiPhile/tinyusb/tree/uac1, it supports v1 & v2 at the same time. audio_test_multi_rate and uac2_speaker_fb examples have been updated with dynamic switching based on actual operating speed (FS=UAC1, HS=UAC2)

However with uac2_speaker_fb example I'm unable to getting UAC1 feedback work on Windows, enumeration goes well but the device ended with `Error 10: the i/o de...

fallow birchBOT
#

@shermp Hi, good news for you, my UAC1 support is in a good state: https://github.com/HiFiPhile/tinyusb/tree/uac1, it supports v1 & v2 at the same time. audio_test_multi_rate and uac2_speaker_fb examples have been updated with dynamic switching based on actual operating speed (FS=UAC1, HS=UAC2)

However with uac2_speaker_fb example I'm unable to getting UAC1 feedback work on Windows, enumeration goes well but the device ended with `Error 10: the i/o de...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Describe the PR

This PR adds USB Audio Class 1.0 (UAC1) support, now audio device driver supports both UAC1 and UAC2 with dynamic switching possibility based on host capabilities.

For asynchronous OUT with feedback, now it's recommended to use UAC1 for Full-Speed device for better OS compatibility, while UAC2 is recommended only for High-Speed device for better performance.

Let me break down this PR:

USBD

  • Add UAC1 constants to audio.h with prefix audio10_, UAC2 rena...
#

Pull Request Overview

This PR adds comprehensive USB Audio Class 1.0 (UAC1) support to TinyUSB's audio device driver, enabling dynamic switching between UAC1 and UAC2 based on host capabilities. The implementation focuses on improving compatibility with Full-Speed devices by recommending UAC1 for better OS compatibility while maintaining UAC2 for High-Speed performance.

  • Adds complete UAC1 constants, descriptors, and macros with audio10_ prefix
  • Implements UAC1 descriptor parsing and...
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: add-claude-github-actions-1759342361886
#

๐Ÿค– Installing Claude Code GitHub App

This PR adds a GitHub Actions workflow that enables Claude Code integration in our repository.

What is Claude Code?

Claude Code is an AI coding agent that can help with:

  • Bug fixes and improvements
  • Documentation updates
  • Implementing new features
  • Code reviews and suggestions
  • Writing tests
  • And more!

How it works

Once this PR is merged, we'll be able to interact with Claude by menti...

#

Pull Request Overview

This PR adds GitHub Actions workflows to integrate Claude Code, an AI coding agent, into the repository. The integration allows team members to trigger Claude by mentioning @claude in PR or issue comments for automated code assistance and reviews.

Key changes include:

  • Addition of a main Claude Code workflow that responds to @claude mentions in comments
  • Addition of an automatic code review workflow that triggers on PR events
  • Configuration for secure API key han...
fallow birchBOT
#

Operating System

MacOS

Commit SHA

6507dc3b3b51d99d9423a93ec1fec0c91b6a8816

Board

mimxrt1170_evkb

Firmware

uac2_speaker_fb

uac2_headset

What happened ?

make BOARD=mimxrt1170_evkb flash-jlink
result: enumerates, and timecode passes when playing something on spotify (or whatever), no audio heard.

same result with uac2_headset.

To confirm my board works, I tried mcuxpresso 2.16 examples:

evkbmimxrt1170_dev_audio_speaker_freertos_cm7 - audio is fine.

evkbmimxrt...

fallow birchBOT
#

Of cause there is no audio, these examples demonstrate only the USB function, you need to implement I2S playback your own !

audio_task is only a stub:

void audio_debug_task(void) {
  static uint32_t start_ms = 0;
  uint32_t curr_ms = board_millis();
  if (start_ms == curr_ms) return;// not enough time
  start_ms = curr_ms;

  audio_debug_info_t debug_info;
  debug_info.sample_rate = current_sample_rate;
  debug_info.alt_settings = current_alt_settings;
  debug_info.fifo_size = CFG_TUD_AU...
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: remove-claude-code-review
fallow birchBOT
#

Isochronous IN transfer handling:
dwc2 requires manually toggle Even/Odd bit manually for ISO IN transfer, that's poses a problem when bInterval > 1 mainly for audio class, as the moment the transfer is scheduled, we don't know when the host will issue IN token (bInterval vs bRefresh shenanigans).

Linux driver use NAK interrupt to detect when the host is sending IN token and toggle the Even/Odd bit accordingly based on the current frame number and bInterval.

However on ST's strippe...

#

Pull Request Overview

This PR enhances the DWC2 USB device controller driver to properly support isochronous IN transfers when the bInterval is greater than 1, which is commonly used in audio applications. The changes address hardware limitations where the Even/Odd frame toggling mechanism needs special handling for different DWC2 controller variants.

Key changes include:

  • Enhanced ISO IN transfer scheduling to work with any bInterval value
  • Added incomplete isochronous transfer interr...
#

This busy-wait loop could potentially block indefinitely if the endpoint disable never completes. Consider adding a timeout mechanism or yielding to prevent system lockup.

        // Add timeout to prevent indefinite blocking
        #define DWC2_EP_DISABLE_TIMEOUT 1000000UL
        volatile uint32_t timeout = DWC2_EP_DISABLE_TIMEOUT;
        while ((epin->diepint & DIEPINT_EPDISD_Msk) == 0 && --timeout) { }
        if (timeout == 0) {
          // Optionally, handle timeout err...
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: release-0.19.0
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

@HiFiPhile I am currently on the 2.1.1 sdk path, and confirmed that I am on 0.18.0. It just panics upon boot. So, there's something definitely wrong:

UART

*** PANIC ***
ep %02X was already available

DMESG:

[721975.383931] usb 3-4.2.1: new full-speed USB device number 65 using xhci_hcd
[721975.491245] usb 3-4.2.1: New USB device found, idVendor=cafe, idProduct=4010, bcdDevice= 1.00
[721975.491253] usb 3-4.2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[721975.49125...
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Sorry for the delay in responding. I was on leave for several months and this is tied to my work email that I wasnโ€™t checking. But I can follow up on this once I sync up with the engineer who picked up my work before I left.

From: Zixun LI @.>
Sent: Thursday, October 2, 2025 2:01 PM
To: hathach/tinyusb @.
>
Cc: Cooper Jr., Franklin @.>; Mention @.>
Subject: [EXTERNAL] Re: [hathach/tinyusb] mentor/dcd_musb - Fix issue reading and writing to USBFIFOn re...

fallow birchBOT
#
[hathach/tinyusb] New branch created: remove-claude-code
fallow birchBOT
#

๐Ÿ’ก Codex Review

Here are some automated review suggestions for this pull request.

โ„น๏ธ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with ๐Ÿ‘.

Codex can also answer questions or update the PR. Try commenting

  • @cod...
#

<sub><sub>P0 Badge</sub></sub> Direct FIFO writes repeat same EP0 chunk

For singleโ€‘packet IN transfers the new path writes straight to the Tx FIFO but never advances xfer->buffer. EP0 multiโ€‘packet control responses rely on the TXFE interrupt handler to bump the buffer between packets; with that interrupt now bypassed, every subsequent call to edpt_schedule_packets retransmits the first 64 bytes instead of progressing through the des...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

The programming manual section 8.2.5 says we can simply toggle Even/Odd inside Incomplete transfer interrupt, but I tried all boards I have from 2.70a to 4.20a and it never worked.
In DEPCTL the bit is toggled but the endpoint doesn't make transfer at all, also section 8.2.7 says the opposite, that the endpoint must be disabled....

<img width="1402" height="338" alt="image" src="https://github.com/user-attachments/assets/b1301aa7-acc9-4252-90ff-96b0ae670ebb" />

fallow birchBOT
fallow birchBOT
#

๐Ÿ’ก Codex Review

Here are some automated review suggestions for this pull request.

โ„น๏ธ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with ๐Ÿ‘.

Codex can also answer questions or update the PR. Try commenting

  • @cod...
#

<sub><sub>P1 Badge</sub></sub> Stop scanning when encountering a second AC interface

During enumeration the driver now computes the audio functionโ€™s descriptor length by walking forward until it sees a non-audio interface or an IAD. If a configuration contains two separate audio functions without IADs (common in UAC1 where each function starts with another Audio Control interface), the loop here will happily absorb the next AC interf...

fallow birchBOT
fallow birchBOT
#

Describe the PR
This streamlines documentation quite a bit:

  • first and foremost, this improves "getting started" in many regards.
    • improving text flow (starts with examples rather than setup details)
    • simplifies the example code to a common case rather than the corner tud+tuh case
    • streamlines details that don't really belong in a getting started document, like IAR
    • improves and rearranges headlines so that the TOC becomes more useful
  • this adds a couple of pages
    ...
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Pull Request Overview

This PR fixes USB enumeration issues with the DWC2 USB controller when EP0 max packet size is 8 bytes by ensuring the RX FIFO size is at least 64 words. Additionally, it updates the CMake preset generation to handle Espressif boards with Ninja single config generator.

  • Fixed DWC2 RX FIFO allocation to use minimum 64 words regardless of EP0 size
  • Corrected EP0 max packet size handling during bus reset to use configured size
  • Updated preset generation to separate E...
#

Hello friends I have such a problem with the keyboard. I want to connect as a keyboard to a device that only supports USB1.1. The microcontroller I use is ESP32-S2 with tinyusb. I have changed CFG_TUD_ENDPOINT0_SIZE in tusbconfig to 8, but No connection was made.

I am using ESP32-S3 same issue with if trying to set .bMaxPacketSize0 = 8, on espressi/tinyusb. We setaddress or device descriptor failure if using .bMaxPacketSize0 = 8, with full speed usb configuration for hid setup. With ...

fallow birchBOT
#

Pull Request Overview

This PR fixes HID stylus descriptor and example implementation issues that cause Windows driver errors and cursor locking problems.

  • Corrects HID stylus descriptor usage declarations that were causing Windows "Driver Error Code: code 10"
  • Refactors stylus touch handling in hid_composite example to prevent cursor locking on Windows
  • Integrates stylus touch logic into the existing button-driven HID report system

Reviewed Changes

Copilot reviewed 2 out of 2 ch...

fallow birchBOT
#

Operating System

Linux

Commit SHA

6ce46da042eb9ab243e4127ddcac57519c0a226f

Board

N/A

Firmware

N/A

What happened ?

Trace

/src/tinyusb/src/device/usbd.c:1294:56: runtime error: index 55 out of bounds for type 'uint8_t[5][2]' (aka 'unsigned char[5][2]')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /src/tinyusb/src/device/usbd.c:1294:56 

How to reproduce ?

Steps to reproduce

  • Build oss-fuzz docker
    Download files in this folder https://github...
fallow birchBOT
#
[hathach/tinyusb] New tag created: 0.19.0
#

Codex Review: Didn't find any major issues. You're on a roll.

<details> <summary>โ„น๏ธ About Codex in GitHub</summary>
<br/>

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with ๐Ÿ‘.

Codex can also answer questions or update the PR. Try commenting

  • @...
fallow birchBOT
#
[hathach/tinyusb] New branch created: remove-dcd_esp32sx
fallow birchBOT
fallow birchBOT
#

Codex Review: Didn't find any major issues. Bravo.

<details> <summary>โ„น๏ธ About Codex in GitHub</summary>
<br/>

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with ๐Ÿ‘.

Codex can also answer questions or update the PR. Try commenting

  • @codex fix t...
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: fix-typo
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Good news, there is no need to change usbd.c, my hub will try to use wLength=64 after initial wlength=18 attempt. Previous failure is fact caused by something else in dwc2 driver.

USBD Bus Reset : Full Speed
USBD Suspend  Skipped

USBD Setup Received 80 06 00 01 00 00 12 00
  Get Descriptor Device
  Queue EP 80 with 8 bytes ...
USBD Xfer Complete on EP 80 with 8 bytes
  Queue EP 80 with 8 bytes ...

USBD Setup Received 80 06 00 01 00 00 12 00
  Get Descriptor Device
  Queue...
fallow birchBOT
#

Describe the PR

Fixes the calculation of remaining bytes to transfer in MTP device class.

The original code casts the result of subtraction into uint16_t before taking the minimum, which will break all transfers with more than 65535 bytes. Only (filesize & 0xFFFF) bytes can be transferred before the transfer comes to a halt.

This bug is discovered when I'm testing MTP Device with an LittleFS on SPI flash as the backing store, with about 11MiB of free space I copied a lot more...

fallow birchBOT
#

Operating System

Linux

Commit SHA

21ed72bab119e0

Board

n/a

Firmware

n/a

What happened ?

https://github.com/hathach/tinyusb/blob/master/docs/reference/getting_started.rst?plain=1#L80 doesn't correctly link when rendered.

From: https://docs.tinyusb.org/en/latest/reference/getting_started.html it attempts to get to https://docs.tinyusb.org/en/latest/reference/dependencies.rst which is the RST file itself, not the final rendered html.

How to reproduce ?

can't f...

#

Operating System

Linux

Commit SHA

21ed72bab119

Board

espressif_s3_devkitc

Firmware

N/A

What happened ?

As documented on https://docs.tinyusb.org/en/latest/reference/getting_started.html#dependencies you should be able to do either
make -C examples/host/cdc_msc_hid_freertos BOARD=espressif_s3_devkitc get-deps
or

tools/get_deps esp32 (or esp32s3)

This works for other platforms. For esp32s3 you receive for the make form:

/tinyusb/examples/host/...
fallow birchBOT
#

I agree the doc is lagging behind, cmake support was added long ago. It would be appreciated if you could help improving the doc from a user's view, neither me or Thach speak native English.

For esp32 you can do like this:

  1. source esp-idf
  2. Enter example folder
  3. cmake -DBOARD=espressif_s3_devkitc -B build -G Ninja .
  4. cmake --build build

Or use presets (broken for esp32 ATM until #3279):

  1. source esp-idf
  2. Enter example folder
  3. cmake --preset espressif_s3_devkitc
  4. cmake --build ...
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: h7rs_typo
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: add-agents-md
#

Pull Request Overview

This PR adds a new documentation file AGENTS.md that serves as a handbook for AI agents working with the TinyUSB codebase. The file provides comprehensive guidelines covering development practices, build procedures, testing workflows, and specific instructions for different AI agents.

  • Establishes standardized ground rules for TinyUSB development including memory safety and coding conventions
  • Documents build and test procedures with specific commands and timing...
#

[nitpick] This line is quite long and contains multiple distinct concepts. Consider breaking it into separate bullet points for better readability: one for formatting tools, one for assertions, one for license headers, and one for documentation requirements.

- Run `clang-format` on all touched files to ensure consistent formatting.
- Use `TU_ASSERT` for all fallible calls to enforce runtime checks.
- Ensure header comments retain the MIT license notice.
- Add descriptive comment...
fallow birchBOT
#
[hathach/tinyusb] New branch created: copilot/fix-dependency-link-in-docs
#

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original prompt


This section details on the original issue you should resolve

docs: link to list of dependencies doesn't link correctly

Operating System

Linux

Commit SHA

21ed72bab119e0

Board

n/a

Firmware

n/a

What happened ?

https://github.com/hathach/...

#

๐Ÿ’ก Codex Review

Here are some automated review suggestions for this pull request.

โ„น๏ธ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with ๐Ÿ‘.

Codex can also answer questions or update the PR. Try commenting

  • @cod...
#

<sub><sub>P1 Badge</sub></sub> Use fully qualified docname in :doc: link

The :doc: role expects a document name relative to the Sphinx source root, not a path relative to the current file. The target document lives at docs/reference/boards.rst, so its docname is reference/boards. Using :doc:the supported boards <boards>will raiseUnknown document: boards` and fail the docs build (or produce a broken link). This should inst...

#

<sub><sub>P1 Badge</sub></sub> Dependency link also misses docname prefix

Similar to the board link above, :doc:complete list of dependencies โ€ฆ <dependencies>omits thereference/prefix that is part of the document name. Because the file resides atdocs/reference/dependencies.rst, Sphinx will not find a doc named dependencies, breaking the internal cross-reference and failing the build. Use reference/dependencies` as the t...

fallow birchBOT
#

What this PR does

Makes USB data transfer 2.6x faster by removing unnecessary data copying.

The change

Instead of copying data before sending it, we now send data directly from where it's stored.

Results

  • Before: 10 MB/s (slow due to copying)
  • After: 26.5 MB/s (fast - no copying)
  • Improvement: 165% faster transfers

Why it matters

  • Faster file transfers
  • Smoother video streaming
  • Better performance for sensors and medical devices

Tested on

...

fallow birchBOT
#

NO ! Have you read what you've committed ? Why talking about vendor class but doing some nonsense modification on tusb.c ?

And NO you can't just remove a buffer and call it zero-buffer support ! Many MCU needs to put the buffer on specific memory section with special alignment requirement, like NXP LPC43xx, LPC55x, iMX.RT and STM32H7 etc... You are just lucky that it works on ch32v305.

Have you ever read what the macro TUD_EPBUF_DEF, CFG_TUD_MEM_ALIGN and CFG_TUD_MEM_SECTION does...

fallow birchBOT
fallow birchBOT
#

The FIXME comment indicates a known issue where the wrong object size is used for cache invalidation. This should be properly addressed by determining the actual TD type and using the correct size, rather than relying on assumptions about cache line sizes.

    // Use the correct object size for cache invalidation.
    size_t td_size = sizeof(ohci_td_item_t);
    // If there are other TD types, determine the type and set td_size accordingly.
    // For example, if you have ohci_i...
#

๐Ÿ’ก Codex Review

Here are some automated review suggestions for this pull request.

โ„น๏ธ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with ๐Ÿ‘.

Codex can also answer questions or update the PR. Try commenting

  • @cod...
#

<sub><sub>P1 Badge</sub></sub> Invalidate HCCA before reading done queue

When OHCI_INT_WRITEBACK_DONEHEAD_MASK fires, done_queue_isr() reads ohci_data.hcca.done_head directly, sets it back to zero, and only later invalidates individual TDs while reversing the list. In dโ€‘cache enabled configurations the HCCA lives in cached RAM, so the controllerโ€™s write to done_head can remain hidden in memory while the CPU keeps a cached zer...

fallow birchBOT
#

This patch fixes an issue where USB interrupts were mistakenly disabled instead of enabled when the USB interrupt remap (usbintmap) was active.
Previously, the code called NVIC_DisableIRQ() for USBFS_MAPH_IRQn, USBFS_MAPL_IRQn, and USBFSWakeUp_IRQn, which prevented USB interrupts from working correctly after remapping.

The fix replaces those calls with NVIC_EnableIRQ() to properly enable the corresponding USB interrupts.

fallow birchBOT
#

๐Ÿงฉ Description

This PR fixes incorrect handling of Zero-Length Packets (ZLP) in the DWC2 driver when receiving data (OUT transfers).
Previously, the DWC2 RX-FIFO transfer logic would misinterpret a ZLP as a full-size packet, causing the transfer to complete with the wrong size (equal to the requested buffer length rather than actual received bytes).

This issue was reported in #3154 (ESP32-S3 bulk transfer issues).


#...

fallow birchBOT
#
[hathach/tinyusb] New branch created: add-ohci-lpc55
fallow birchBOT
#

Pull Request Overview

This PR attempts to enable OHCI (Open Host Controller Interface) support for the LPC55 microcontroller family but notes it's not working properly, likely due to clock configuration issues. The implementation refactors the OHCI code to be more modular and adds LPC55 support alongside existing LPC17/40 support.

Key changes include:

  • Refactoring OHCI hardware abstraction with a new ohci_nxp.h header
  • Adding LPC55 OHCI configuration and USB0 host mode support
  • Rest...
#

๐Ÿ’ก Codex Review

Here are some automated review suggestions for this pull request.

โ„น๏ธ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with ๐Ÿ‘.

Codex can also answer questions or update the PR. Try commenting

  • @cod...
#

<sub><sub>P1 Badge</sub></sub> Include CMakePrintHelpers or drop cmake_print_variables

cmake_print_variables is invoked during configuration without including the CMakePrintHelpers module. On a clean build this command is undefined and CMake stops before generating any targets, so none of the LPC55 examples can be configured. Either include CMakePrintHelpers or remove the debug print.

Useful? React with ๐Ÿ‘ย / ๐Ÿ‘Ž.

#

<sub><sub>P1 Badge</sub></sub> Avoid forcing USB1 into device mode when host uses port 1

The initialization for USB1 now runs when either the device or host selects port 1, but the body still configures the PHY and clocks for device mode (USBHSH->PORTMODE |= USBHSH_PORTMODE_DEV_ENABLE_MASK, device clock enables). For host builds that set BOARD_TUH_RHPORT == 1, this code flips the controller into device mode and never enables ho...

fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: dwc2_ep0
#

Describe the PR
There was an issue in edpt_schedule_packets, as ep0_pending = xfer->max_size is set in dcd_edpt_xfer, ep0_pending will become 0.

if (epnum == 0) {
    total_bytes = tu_min16(_dcd_data.ep0_pending[dir], xfer->max_size);
    _dcd_data.ep0_pending[dir] -= total_bytes;
    num_packets = 1;
  } 

The issue didn't broken since we schedule only one control transfer each time.

I've add an option CFG_TUD_EP0_BUFSIZE to allow setting EP0 buffer size indivi...

#

Pull Request Overview

This PR fixes EP0 multi-packet transfer logic in the DWC2 driver and adds configurable EP0 buffer size support. The issue was in the edpt_schedule_packets function where ep0_pending was incorrectly being set to xfer->max_size instead of the proper endpoint size, causing transfer size calculation errors.

Key changes:

  • Added CFG_TUD_EP0_BUFSIZE configuration option for EP0 buffer size
  • Fixed EP0 packet scheduling logic to use correct endpoint size
  • Enhanced...
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Operating System

Linux

Commit SHA

8f2e3ed4418a08cc13aee4527b7bdd1b8bb1bf55, current master

Board

Pi Pico 1 / RP2040

Firmware

Custom firmware for FPGA Companion https://github.com/MiSTle-Dev/FPGA-Companion

Running inside FreeRTOS, using PIO-PICO-USB, also latest master

This is actually extensively used for the MiSTle retro gaming project, where TinyUSB is used on a rp2040 to control keyboard, mouse and joysticks in a FPGA retro gaming setup.

What happened ?

Some...

fallow birchBOT
#
[hathach/tinyusb] New branch created: hil-increase-timeout-for-mtp
fallow birchBOT
fallow birchBOT
#

Operating System

Windows 10

Commit SHA

331c263400dd5ccf77264cab1fa6bbd9f374b44e

Board

Adafruit Feather M0 (RFM95)

Firmware

https://github.com/maxgerhardt/samd21-usb-host-repro/

What happened ?

When starting up the TinyUSB stack configured for just USB host, and with only the CDC host driver enabled, no hubs, the enumeration of USB devices files with a timeout.

When using the same hardware with the USBHost library (https://github.com/arduino/ArduinoCore-samd/tree/...

fallow birchBOT
fallow birchBOT
#

I compiled the host/device_info example for the feather_m0_express, with the addition that I changed

https://github.com/hathach/tinyusb/blob/0.19.0/hw/bsp/samd21/boards/feather_m0_express/board.h#L47-L49

to be

// UART
#define UART_SERCOM           0
#define UART_RX_PIN           11
#define UART_TX_PIN           10

This seems to be a bug in all SAMD board.h, the UART_SERCOM is left undefined so it doesn't trigger the right code to activate UART logging, on top of that all RX /...

fallow birchBOT
#
[hathach/tinyusb] New branch created: initial-nrf54h20
fallow birchBOT
#

Some more results:

  • the same happens in a minimal software setup, basically only running tinyusb on freertos
  • the same happens with an off-the-shelf Pi-Pico with an off-the-shelf CH334 hub
  • the same happens with a different hub

The same does not happen if I use the rp2040's native USB. So this may actually be a problem with pio-usb rather than the tinyusb stack itself.

Interestingly, some devices also don't enumerate anymore since I updated from the current pico-sdk to the latest tiny...

fallow birchBOT
#

Pull Request Overview

This PR adds initial support for the Nordic nRF54H20 microcontroller to TinyUSB, primarily focusing on getting CMake builds working. The changes introduce a new MCU variant (OPT_MCU_NRF54) and update the Nordic nRF ecosystem to support the newer nRF54 series alongside the existing nRF5X series.

  • Updates Nordic nRFx dependency to a newer version that supports nRF54H20
  • Introduces nRF54H20 board configuration and USB driver integration using DWC2 controller
  • Refact...
#

๐Ÿ’ก Codex Review

Here are some automated review suggestions for this pull request.

โ„น๏ธ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with ๐Ÿ‘.

Codex can also answer questions or update the PR. Try commenting

  • @cod...
#

<sub><sub>P1 Badge</sub></sub> Quote MCU variant checks in family.cmake

The new CMake logic compares MCU_VARIANT against literals without quoting them (if (MCU_VARIANT STREQUAL nrf5340 OR MCU_VARIANT STREQUAL nrf54h20)). In CMake an unquoted identifier is treated as a variable, so nrf5340 and nrf54h20 expand to empty strings. As a result the condition is always false and the cortexโ€‘M33/JLink settings for nrf5340 and nrf54h20 ...

#
[hathach/tinyusb] New branch created: change-qodana-linter
#

๐Ÿ’ก Codex Review

Here are some automated review suggestions for this pull request.

โ„น๏ธ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with ๐Ÿ‘.

Codex can also answer questions or update the PR. Try commenting

  • @cod...
#

<sub><sub>P1 Badge</sub></sub> Configure compile commands before using qodana-clang

Switching the linter to jetbrains/qodana-clang will break the existing Qodana workflow because the clang-based analyzers require a compile_commands.json or explicit build step to understand C/C++ sources. Neither the workflow nor this configuration produces such a databaseโ€”there is no compile database anywhere in the repositoryโ€”so the Qodana job w...

fallow birchBOT
#
[hathach/tinyusb] New branch created: add-tool-for-oss
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Code Review - PR #3302: Revert "Add qodana CI checks"

Summary: โš ๏ธ Clean revert - but raises questions about CI strategy

Technical execution:
โœ… Perfect revert:

  • Cleanly removes both files (.github/workflows/qodana_code_quality.yml and qodana.yaml)
  • No stray changes or artifacts left behind
  • 0 additions, -38 deletions as expected for a clean revert

Positive aspects:

  1. Fast turnaround: Merged within seconds of creation - shows effective decision maki...
fallow birchBOT
fallow birchBOT
#

Removing FreeRTOS does not make a difference. Also, the HUB doesn't seem to matter and the device being plugged also doesn't matter.

What matters is whether the device being unplugged is actually being polled. This is the case for all of my HID devices, and thus this happens quite reliably for any HID device I unplug. This does not happen if I don't poll for HID reports.

I'd actually assume the HID Controller example would expose the same problem.

fallow birchBOT
#

Removing FreeRTOS does not make a difference. Also, the HUB doesn't seem to matter and the device being plugged also doesn't matter.

What matters is whether the device being unplugged is actually being polled. This is the case for all of my HID devices, and thus this happens quite reliably for any HID device I unplug. This does not happen if I don't poll for HID reports.

I'd actually assume the HID Controller example would expose the same problem.

so which examples you are testin...

fallow birchBOT
#
[hathach/tinyusb] New branch created: refactor-buildsystem
fallow birchBOT
#

I am still using my own code, which is now reduced to the bare minimum and has actually less functionality left than any of the official examples.

There are a few things I do see happen. While tinyusb is retrying for the HUB unplug event, it keeps generating 0 byte application callbacks for the HID reports. My code immediately requests to receive the next request, just like the hid_controller demo does at https://github.com/hathach/tinyusb/blob/38255ffc3879e9aef12796ce25b58a2c654ce67d/exampl...

fallow birchBOT
#

This pull request refactors the build system integration for multiple example device projects, standardizing Makefile includes and improving toolchain support. The main focus is on replacing legacy build system includes with board family-specific ones, and unifying compiler flag handling for GCC and Clang.

Build system refactoring:

  • All example device Makefiles now include family_support.mk and family_rules.mk from the board support package (hw/bsp) instead of the previous gene...
#

Pull Request Overview

Refactors build system integration to standardize example Makefiles on new family_support/family_rules includes, consolidates compiler warning flag handling, introduces SAML2X MCU aliasing, adds new board families (SAME7X, EFM32), and adjusts various BSP and class headers for consistency and warning suppression. Key changes:

  • Replaced legacy example Makefile includes with hw/bsp/family_support.mk and family_rules.mk; switched path variable CURRENT_PATH to EXAMPLE_PA...
#

The newly introduced callback tud_audio_int_xfer_cb lacks accompanying documentation/comments explaining its invocation timing, purpose (e.g. per packet transfer completion vs. final done), parameter semantics, and interaction with tud_audio_int_done_cb. Please add a brief doc comment consistent with other public audio callbacks (e.g. describing when TinyUSB calls it and expected user responsibilities) to avoid confusion for API consumers.

void tud_audio_int_done_cb(uint8_t rhpo...
#

The application-provided rndis_class_set_handler() prototype was moved here but has no description of the expected buffer format (RNDIS set messages), ownership/lifetime of data, or return/error handling expectations (void). Please add a short comment describing when TinyUSB invokes this, what 'data' contains, and whether the application may modify or must process synchronously.

#if CFG_TUD_ECM_RNDIS
/**
 * Application callback invoked by TinyUSB when an RNDIS "Set" message is r...
#

๐Ÿ’ก Codex Review

https://github.com/hathach/tinyusb/blob/6a1117a8d85a6c029808a22ae53be1387ff2ce92/tools/get_deps.py#L43-L51
P1 Badge Update get_deps family list for samd2x_l2x

The boards formerly under saml2x were moved into the new samd2x_l2x family, but tools/get_deps.py still only looks for saml2x when deciding whether to clone the Microchip SDK and CMSIS dependencies. Calling tools/get_deps.py samd2x_l2x (or passing...

fallow birchBOT
#

Since you are working on it, could you add this to family_support.cmake, IAR by default only define CC but not CMAKE_C_COMPILER

# Also check for CC env variable if set
if(DEFINED ENV{CC})
  string(FIND $ENV{CC} "iccarm" IS_IAR)
  string(FIND $ENV{CC} "clang" IS_CLANG)
  string(FIND $ENV{CC} "gcc" IS_GCC)

  if (NOT IS_GCC EQUAL -1)
    set(TOOLCHAIN gcc)
  elseif (NOT IS_CLANG EQUAL -1)
    set(TOOLCHAIN clang)
  elseif (NOT IS_IAR EQUAL -1)
    set(TOOLCHAIN iar)
 ...
fallow birchBOT
fallow birchBOT
#

The GetTick callback type (MFXSTM32L152_GetTick_Func) expects an unsigned 32-bit return (typically uint32_t). Defining i2c_get_tick() as int32_t creates an incompatible function pointer type and may trigger warnings or undefined behavior. Change to 'static uint32_t i2c_get_tick(void) { return HAL_GetTick(); }' to match the expected signature.

static uint32_t i2c_get_tick(void) {
  return HAL_GetTick();
#

๐Ÿ’ก Codex Review

https://github.com/hathach/tinyusb/blob/d96d468b55ae7db21740502059034300fb147638/hw/bsp/family_support.mk#L129-L141
P1 Badge Define FreeRTOS portable path before including CPU mk

The new family_support.mk includes ${TOP}/examples/build_system/make/cpu/$(CPU_CORE).mk at the top, but FREERTOS_SRC and FREERTOS_PORTABLE_PATH are only defined afterwards. The CPUโ€‘specific makefiles compute `FREERTOS_PORTABLE_SR...

#

<sub><sub>P1 Badge</sub></sub> Enabling ISO endpoint API without implementation breaks Nuvoton audio/video

This commit defines TUP_DCD_EDPT_ISO_ALLOC for the NUC120/121/505 families (see tusb_mcu.h), which makes the USB audio/video classes call usbd_edpt_iso_alloc() and usbd_edpt_iso_activate() at startup. However the corresponding driver implementations added here still return false and are tagged โ€œTODO not implementedโ€. B...

fallow birchBOT
#

I just found my device that would send zero-length reports under normal circumstances. It's a competition pro USB joystick. This behavior is in the app callback indistinguishable from errors. I will open a separate issue on the topic of HID error replies.

But I also see an issue in the hub error handing here. Missing/lost hub reports are potentially critical. A missed unplug event is one example. Such errors would potentially break the entire application, break file transfers etc. I'd sugges...

fallow birchBOT
#

@jay94ks Hi, something is off with the stylus support, which makes hid_composite example fails on Windows with error This device cannot start. (Code 10) A non constant main item was declared without a corresponding usage.

The descriptor template have some major difference with Microsoft: https://learn.microsoft.com/en-us/windows-hardware/design/component-guidelines/supporting-usages-in-digitizer-report-descriptors

@HiFiPhile -- You commented within an issue that has been clo...

fallow birchBOT
fallow birchBOT
#

Related area

HID host class driver

Hardware specification

RP2040/PIO_USB

Is your feature request related to a problem?

I am having some trouble with HID host unplug events on RP2040/PIO_USB as described in #3296

Part of the problem is that the HID host driver has quite limited error reporting. Especially the fact that the result code is simply ignored:

https://github.com/hathach/tinyusb/blob/79445c2386adefb207a76a70d87578b53c3e7922/src/class/hid/hid_host.c#L475

As a result...

fallow birchBOT
#

@jay94ks Hi, something is off with the stylus support, which makes hid_composite example fails on Windows with error This device cannot start. (Code 10) A non constant main item was declared without a corresponding usage.
The descriptor template have some major difference with Microsoft: https://learn.microsoft.com/en-us/windows-hardware/design/component-guidelines/supporting-usages-in-digitizer-report-descriptors

@HiFiPhile -- You commented within an issue that has been c...

fallow birchBOT
#

Operating System

Linux

Commit SHA

no idea

Board

STM32F103 Bluepill

Firmware

Working on a custom implementation of "examples/device/cdc_dual_ports", I found an coding inconsistency.

What happened ?

In "src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c"

Two different initialisations of "ep_buf_ptr" variable defined in handle_bus_reset() and dcd_edpt_close_all().

static void handle_bus_reset(uint8_t rhport)
// Reset PMA allocation
ep_buf_ptr = FSDEV_BTABLE_BASE + ...

fallow birchBOT
#

Alternately, one could return a pointer to the result itself in the error case like so:

tuh_hid_report_received_cb(daddr, idx, (XFER_RESULT_SUCCESS == result)?epbuf->epin:&result, (uint16_t) xferred_bytes);

This would allow to forward more information in the error case. The check on application side would then either check for len > 0 or for len == 0 and pointer pointing to XFER_RESULT_SUCCESS. In the long term additional information could be passed through that pointer without brea...

fallow birchBOT
#

Great! I added terjr's changes and tested the steps in getting_started, and it seems fine.
I also tested the actual HTML rendering, but it seems some styling is missing locally (also in the original build).
I'm not sure about the FAQ page - while a project should have one, this is mostly generated, and I cannot really verify it. If in doubt we can just delete it for now.
Please review. :)

#

Thank you, actually CMake is more used today, either full command:

cmake -DBOARD=stm32f723disco -B build -G Ninja .  # "-G Ninja" is required on Windows
cmake --build build

Or preset:

cmake --preset stm32f723disco
cmake --build --preset stm32f723disco

For esp32 only CMake works since their SDK only support CMake, whole step is:

  1. source esp-idf
  2. Enter example folder
  3. cmake --preset espressif_s3_devkitc
  4. cmake --build --preset espressif_s3_devkitc
fallow birchBOT
#

Operating System

Windows 11

Commit SHA

331c263

Board

STM32F746G-DISCO

Firmware

Custom firmware with FreeRTOS and USBFS DWC2 driver (based on examples/uac2_headset)

What happened ?

On version v0.18.0, UAC2 examples & my custom firmware works with no problems.
On version v0.19.0 (and latest master) the software hangs in FreeRTOS assertion because taskENTER_CRITICAL() was called from ISR.

In dcd_edpt_xfer() there is a spinlock which assumes non-interrupt context.

`...

#

Thank you, that's something I've in mind but didn't have time to fix it.

You can remove usbd_spin_lock in dcd_dwc2.c for temporary workaround as it's only used for multi-core ESP32 MCUs.

@tore-espressif @hathach With the introduce of ISR transfer dcd_edpt_xfer can be called from ISR, usbd_spin_lock inside will case issues. What do you think, add an is_isr parameter or something else ?

#

Thank you, actually CMake is more used today

Yes I noticed in testing that RP2040 also gives an error on make (similar to ESP32 probably).

Is there an equivalent to make ... all flash?

You can build all examples at once by cd into example parent folder tinyusb/examples/device then do the step above. For flashing with J-Link cmake --build --preset stm32h7s3nucleo --target audio_test_freertos-jlink

You can find other supported flasher in family_support.cmake

fallow birchBOT
fallow birchBOT
#

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Original prompt

Fix issue #3311 by adding is_isr argument to dcd_edpt_xfer and dcd_edpt_xfer_fifo. If they are called in isr context then set is_isr to true otherwise false.


โœจ Let Copilot coding agent [set things up for you](https://github.com/hathach/tinyusb/issues/new?title=โœจ+Set+up+Copilot+instructions&body=Configure instructi...

fallow birchBOT
fallow birchBOT
#

@copilot

  • revert all submodule changes
  • Add is_isr argument to usbd_edpt_xfer and usbd_edpt_xfer_fifo, set it to true if called in ISR, for example audiod_rx_xfer_isr

Added is_isr parameter to usbd_edpt_xfer() and usbd_edpt_xfer_fifo() wrapper functions. ISR functions like audiod_rx_xfer_isr() and audiod_tx_xfer_isr() now pass true, while all other callers pass false. Submodule changes will be reverted in next commit. Commit: 27415e6

fallow birchBOT
#

Operating System

Windows 11

Commit SHA

4dfac3f3566268450b46f1c19899b0b53bf48706

Board

ArteryTek AT32F405 Custom Board

Firmware

Custom firmware with this tusb_config.h

What happened ?

When the bus is suspended, the device does not receive the event DCD_EVENT_SUSPEND event received. However, when the bus is resumed, the device receives both DCD_EVENT_RESUME and DCD_EVENT_SUSPEND in the sam...

fallow birchBOT
#

Pull Request Overview

This PR adds a bool is_isr parameter to the DCD and USBD transfer functions (dcd_edpt_xfer, dcd_edpt_xfer_fifo, usbd_edpt_xfer, and usbd_edpt_xfer_fifo) to indicate whether the functions are being called from ISR or task context. This enables proper synchronization handling by allowing the locking mechanism to differentiate between interrupt and non-interrupt contexts.

Key changes:

  • Updated function signatures across DCD layer, USBD layer, and class d...
fallow birchBOT
#

This pull request refactors the CMake build system for several AT32 board families and updates SCSI Mass Storage callbacks across multiple example projects for consistency and correctness. The key changes include standardizing board target creation, improving linker and startup file handling, and updating SCSI inquiry and command callbacks to use safer string operations and cleaner error handling.

Build System Refactoring (CMake):

  • Replaces the add_board_target function with `family_...
#

๐Ÿ’ก Codex Review

Here are some automated review suggestions for this pull request.

โ„น๏ธ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with ๐Ÿ‘.

Codex can also answer questions or update the PR. Try commenting "@code...

#

<sub><sub>P1 Badge</sub></sub> Apply compile flags to undefined target in CH32V10x board setup

The refactor changed family_add_board so the compile options are now added with target_compile_options(${TARGET} PUBLIC -mcmodel=medany). Within this function there is no variable named TARGET; the parameter is BOARD_TARGET. At configure time CMake expands ${TARGET} to the empty string, so the command fails with "No TARGET specifi...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: static-analysis
fallow birchBOT
#

Pull Request Overview

This pull request adds static analysis support and addresses warnings identified by IAR C-STAT and PVS-Studio analyzers. The changes improve code quality through better type safety, proper variable scoping, and coding standard compliance.

Key changes:

  • Added IAR C-STAT integration with CMake build system via -DIAR_CSTAT=1 flag
  • Added PVS-Studio CI workflow for automated static analysis
  • Fixed type safety issues by adding unsigned suffixes to integer literals

#...

#

This comment is misleading and unclear. If the mask is 0, explain why the assignment operation on line 404 was removed, or clarify what 'mask is 0' means in this context. Consider: 'High speed configuration uses a mask value of 0, so no explicit assignment is needed' or document the register behavior.

    // High-speed configuration: DCFG_DSPD mask is 0, so no explicit assignment is needed.
    // The register defaults to high-speed mode per DWC2 specification.
fallow birchBOT
#

Hi! I am using v0.19 with an esp32 + max3421 and same happens to me (sometimes not rx cb and sometimes only one).
But I guess it is because the HOST stops polling for some reason.
I will upload the USB captured data.
The window between the end of the enumeration and all the SOF timaouts at the end, I managed to receive one small thing. However, the IN transaction no longer occurs, and that is why the RX callback is not being called.
Maybe I am dumb enough not to ralize the error.

[scan_t...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests wi...

fallow birchBOT
fallow birchBOT
#

I think you can simply write like this, otherwise pending Enum Done interrupt will trigger the IRQ again:

if (gintsts & GINTSTS_ENUMDNE) {
    // ENUMDNE is the end of reset where speed of the link is detected
    dwc2->gintsts = GINTSTS_ENUMDNE;
    // There may be a pending suspend event, so we clear it first
    dwc2->gintsts = GINTSTS_USBSUSP;
    dwc2->gintmsk |= GINTMSK_USBSUSPM;
    handle_enum_done(rhport);
  }
fallow birchBOT
#

I think you can simply write like this, otherwise pending Enum Done interrupt will trigger the IRQ again:

if (gintsts & GINTSTS_ENUMDNE) {
    // ENUMDNE is the end of reset where speed of the link is detected
    dwc2->gintsts = GINTSTS_ENUMDNE;
    // There may be a pending suspend event, so we clear it first
    dwc2->gintsts = GINTSTS_USBSUSP;
    dwc2->gintmsk |= GINTMSK_USBSUSPM;
    handle_enum_done(rhport);
  }

Right, I wasn't aware you ...

fallow birchBOT
fallow birchBOT
#

@kwarc93 Please test #3313

Thanks, seems to be working good now.

Have you considered an approach which would add (in the osal/port layer) a function that checks if program is executing in ISR context? Like: __get_IPSR() for Cortex-M? That would get rid of all these flags in many functions. I dont know if that would be possible on every architecture that tinyusb supports (but seems that cortex is most popular).

fallow birchBOT
#

Implicit conversion of `{TUD_CONFIG_DESCRIPTOR,TUD_CONFIG_DESCRIPTOR,((TUD_CONFIG_DESC_LEN+(TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN)+(TUD_MSC_DESC_LEN+TUD_MSC_DESC_LEN+TUD_MSC_DESC_LEN))&TU_U16_LOW),(((TUD_CONFIG_DESC_LEN+(TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_...

fallow birchBOT
#
[hathach/tinyusb] New branch created: more-sast
#

This pull request updates the static analysis workflow and configuration to improve code quality checks and optimize CI resource usage. The most significant changes include restricting workflow triggers to relevant directories, adding a Qodana static analysis job, and updating SonarQube exclusions.

Static Analysis Workflow Improvements:

  • The .github/workflows/static_analysis.yml workflow now only runs for changes in src/**, examples/**, and hw/bsp/** directories, reducing u...
#

Pull Request Overview

This PR adds Qodana static analysis to the CI workflow and optimizes the static analysis configuration by limiting when it runs and what it analyzes.

Key changes:

  • Restricts static analysis workflow to only run on changes in src/, examples/, and hw/bsp/ directories
  • Adds a new Qodana static analysis job that scans the mimxrt1060_evk board example
  • Excludes external dependencies (lib/**, hw/mcu/**, test/**) from SonarQube analysis

Reviewed C...

#

The args parameter uses comma separators ('--image,jetbrains/qodana-clang:2025.2-eap') which is non-standard YAML syntax. According to Qodana action documentation, this should be a proper YAML list. Use standard YAML list syntax: args: | with newline-separated arguments or args: ['--image', 'jetbrains/qodana-clang:2025.2-eap'].

          args: ['--image', 'jetbrains/qodana-clang:2025.2-eap']  # Community version
#

๐Ÿ’ก Codex Review

https://github.com/hathach/tinyusb/blob/cec8661a31f28cffba568232c458ae544d8b7ecc/.github/workflows/static_analysis.yml#L254-L258
<sub><sub>P1 Badge</sub></sub> Guard Qodana checkout for nonโ€‘PR events

The new Qodana job runs for both push and pull_request triggers, but the checkout step unconditionally references github.event.pull_request.head.sha. On push events this object is undefined, so the expression...

fallow birchBOT
fallow birchBOT
#

Describe the PR
This PR adds a tud_audio_set_ep_in_target_fifo_size function that allows the user to set the target fifo level of the EP IN flow control.

Additional context
For applications that require dynamic configuration of the audio EP IN, having the target fifo size set to half of the fifo depth can be limiting. In some cases the input latency might be very big. This MR aims to add the ability to configure this value at run time using the `tud_audio_set_ep_in_target_fifo_...

fallow birchBOT
fallow birchBOT
#

I think we should keep using the TXFE interrupt to write to fifo. Otherwise there could be race condition whereas usbd mis-manage control transfer, and we are attempting to xfer on busy endpoint0.

I think it should be safe, which scenario you are thinking about ?

also I think we need to also increase (double) the dfifo_alloc() for EP0 when the EP0_BUFSIZE is large enough e.g 8x64 bytes since user is clearly want to make a large transfer with EP0

EP0 can't only queue 3 packets eac...