#tinyusb

1 messages · Page 11 of 1

fallow birchBOT
#

I've took a look and it seems simply missing a notification state reset:

diff --git a/src/class/net/ncm_device.c b/src/class/net/ncm_device.c
index 3e19b5f3a..3b39654c7 100644
--- a/src/class/net/ncm_device.c
+++ b/src/class/net/ncm_device.c
@@ -940,6 +950,9 @@ bool netd_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t
           if (ncm_interface.itf_data_alt == 1) {
             tud_network_recv_renew_r(rhport);
             notification_xmit(rhport, false);
+ ...
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

On getting_started.rst, Improve build step for rp2040 and esp32 by adding additional steps:

  • rp2040: install pick-sdk; export sdk path to PICO_SDK_PATH before cmake
  • esp32 : install esp-idf; source esp-idf (export.bat or export.sh) before cmake

✨ Let Copilot coding agent [set things up for you](https://github....

fallow birchBOT
#
[hathach/tinyusb] New branch created: ncm_restart
#
  • Fixed notification state handling so that when the interface is deactivated and reactivated, the link state update notification is correctly sent. Fix #3436

  • Refactored both recv_ready_ntb and xmit_ready_ntb buffers in ncm_interface_t to use circular buffers, adding head, tail, and count fields for each, replacing the previous linear search and memmove approach.

#

Pull request overview

This PR aims to fix missing Zero Length Packet (ZLP) handling for MTP device IN/OUT data transfers. The changes add logic to detect when a ZLP should be queued and implements the queueing mechanism.

Key changes:

  • Added ep_sz_fs field to store full-speed endpoint packet size for dynamic ZLP detection
  • Modified endpoint initialization order and added endpoint packet size capture
  • Implemented ZLP queueing logic based on transfer completion and packet size alignmen...
#

The ep_sz_fs field is only initialized when the device is running at full speed, leaving it uninitialized (value 0) for high-speed mode. This will cause incorrect behavior on line 429 where it's used as a fallback value for high-speed. The field should either be initialized for all speeds or the logic on line 429 should be adjusted to use a hardcoded value like 64 for full-speed when in high-speed mode.


  // Initialize full-speed endpoint size fallback for all speeds.
  // For ...
#

The order of assertions has been swapped - the endpoint is now opened (line 291) before validating its descriptor type and transfer type (line 292). This means that if the descriptor validation fails, the endpoint will have already been opened but not properly cleaned up. The assertions should remain in the original order: first validate the descriptor, then open the endpoint.

  TU_ASSERT(ep_desc_int->bDescriptorType == TUSB_DESC_ENDPOINT && ep_desc_int->bmAttributes.xfer == TUS...
#

The ZLP queueing logic has issues with OUT transfers. For OUT transfers, the threshold is set to CFG_TUD_MTP_EP_BUFSIZE (line 430), but ZLP detection should always be based on the endpoint's maximum packet size (MPS), not the buffer size. OUT transfers receive ZLPs from the host, not send them, so queueing a ZLP on the same endpoint (line 440) is incorrect. The ZLP queueing logic should only apply to IN transfers where the device sends data to the host.

      const uint16_t thre...
#

The completion detection logic for OUT transfers uses CFG_TUD_MTP_EP_BUFSIZE as the threshold for detecting short packets (line 430). However, short packet detection should be based on the endpoint's maximum packet size (MPS), not the buffer size. A packet is considered short when it's less than the MPS, not when it's less than the buffer size. For OUT transfers, the threshold should also be bulk_mps to correctly detect short packets.

fallow birchBOT
#

@HiFiPhile thank you, but it does not really solve the problem. on data out, it seems that the completion callback (which would send the response) is not hit:

<img width="1198" height="394" alt="Image" src="https://github.com/user-attachments/assets/b43dd284-4a15-480e-9322-9c01f5440df9" />

Also, i do not quite understand where it is made sure that the newly introduced p_mtp->ep_sz_fs always has a value (there is not only TUSB_SPPED_HIGH vs. TUSB_SPEED_FULL.

Is there a sound reference s...

#

I don't have issue sending 64 bytes data:

<img width="1758" height="1131" alt="Image" src="https://github.com/user-attachments/assets/fc562ef8-eb0f-4258-b411-408e29fecec1" />

<img width="1220" height="179" alt="Image" src="https://github.com/user-attachments/assets/7c29cfc9-5583-4b63-9842-dcd9a33c7d99" />

On ep_sz_fs: Yes, but in your code it is set only if tud_speed_get() == TUSB_SPEED_FULL, isn't there also (theoretically) TUSB_SPEED_LOW? (enum tusb_speed_t)

USB low speed doesn't supp...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

ZLP is explained in USB 2.0 spec 5.8.3, it's a way to let the other end knowing data sending is finished:

<img width="1814" height="517" alt="Image" src="https://github.com/user-attachments/assets/d13cb998-0f64-43cf-9314-c81dcafe94a3" />

Some protocols don't use ZLP like MSC.

In MTP case IN/OUT handling are different:

  • IN is simple we know how many data are sent, if last packet length = MPS then simply add a ZLP.
  • OUT is different, we always queue CFG_TUD_MTP_EP_BUFSIZE (eg 512), the t...
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Describe the PR
Implement a printer device driver for USB Printers. The example illustrates receiving data from a host, the device driver as-is is recognized by the generic printer drivers on linux (and I assume, Windows too).

This allows sending binary data to the device, with no specific drivers, using tools like ld -o raw.

Additional context
The example compiles and works on a Pi Pico.

I am not yet sure about integration of the changes in the build toolchain. I have n...

fallow birchBOT
#

Operating System

Others

Commit SHA

Version bundled with ESP-IDF 5.5.2

Board

ESP32S3

Firmware

Can be reproduced with examples/peripherals/usb/device/tusb_ncm

What happened ?

When using USB-NCM with iOS devices (iPhone/iPad), the network connection often fails to re-establish after the host wakes up from sleep.

The iOS host wakes up and immediately sends a DHCP DISCOVER or REQUEST.
The ESP32 application receives this and attempts to send a DHCP OFFER/ACK.
The tr...

fallow birchBOT
#

Operating System

Others

Commit SHA

3eafddb02a3347873dc1816f53b428518eb97c61

Board

fystec ucan (stm32f072)

Firmware

Custom firmware using CDC, based on examples/device/cdc_dual_ports. FIFO depth configured as 128 bytes in tusb_config.h.

What happened ?

Hardfault happened while printing at a fast rate. Asked AI to analyze the issue based on the stack trace and the variable contents. This looks like a legit bug, but I can't judge myself.

The bug occurs in tusb_fifo....

fallow birchBOT
#

However, ff_push_n (and possibly ff_pull_n) receives the absolute wr_idx, and internally calculates linear space via 'lin_count = depth - wr_ptr'. When wr_idx=132 is passed directly, 128-132 = -4, and as uint16_t this underflows to 65532, causing memcpy to attempt an enormous copy and triggering a hardfault.

I think your issue is something else. ff_push_n doesn't take the raw write index, the write pointer is processed by idx2ptr:
https://github.com/hathach/tinyusb/blob/3eafddb02a33478...

fallow birchBOT
fallow birchBOT
#

Pull request overview

This PR refactors the HWFIFO access layer across multiple USB controllers (FSDEV, RUSB2, MUSB, DWC2) by removing the item_size concept from tu_fifo and moving to raw byte storage. The key changes include:

  • Replaced fixed-address FIFO access enum with stride-aware access mode supporting configurable data and address strides
  • Updated HWFIFO API with new tu_hwfifo_access_t structure and dedicated helper functions
  • Removed FSDEV PMA packet helpers in favor of shared ...
#

The OSAL queue definition now includes an item_size field and stores it separately from the FIFO. However, this creates a mismatch: the FIFO is initialized with depth * sizeof(type) as the buffer size (total bytes), but osal_queue_receive and osal_queue_send use qhdl->item_size for reading/writing. This means the FIFO thinks it has (depth * sizeof(type)) items of size 1 byte each, while the queue functions try to read/write item_size bytes. This inconsistency could lead to incorrect behavior ...

#

The conditional compilation check uses bitwise operations (CFG_TUSB_FIFO_HWFIFO_DATA_STRIDE & 4) and (CFG_TUSB_FIFO_HWFIFO_DATA_STRIDE & 2) to determine which stride sizes are supported. However, the comparison within these blocks uses equality (data_stride == 4, data_stride == 2). If CFG_TUSB_FIFO_HWFIFO_DATA_STRIDE has multiple bits set (e.g., 6 or (2|4)), the inner conditions need to properly handle all cases. The current implementation may not work correctly when multiple stride sizes are...

#

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 20d009daa1

ℹ️ 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 u...

#

<sub><sub>P1 Badge</sub></sub> Fix RUSB2 default HWFIFO stride to supported width

For RUSB2 the default HWFIFO stride is defined as (2 | (TUD_OPT_HIGH_SPEED ? 4 : 0)), which resolves to 6 when high-speed is enabled. The HWFIFO helpers in tusb_fifo.c treat data_stride as an actual access width and only perform work for 2- or 4-byte strides; a data_stride of 6 falls through and drops data while still advancing the length coun...

fallow birchBOT
fallow birchBOT
#

this should be fixed and superceded by 20d009d as part of #3441

@hathach That's nice, maybe you can also fix the ZLP ? In handle_xfer_in ZLP will cause the function return early without starting transfer, making the endpoint stuck in busy state. I made a fix:

diff --git a/src/portable/mentor/musb/dcd_musb.c b/src/portable/mentor/musb/dcd_musb.c
index ad20d64bd..cdd4cf8fc 100644
--- a/src/...
fallow birchBOT
#

Operating System

Windows 10

Commit SHA

dd1822ba032e3e86efd445cda1c3fd0e8f342bbc

Board

STM32F103RCT6

Firmware

Custom USB-CDC example

What happened ?

I have build an USB Composite Device with multiple USB-CDC based on FSDEV, and each of them has different endpoint size.

It seams that is_mps512 in tu_edpt_stream_t only considered the situation where the endpoint size is 64 or 512 bytes.

When I sending a 32-bytes packet, TinyUSB did not send ZLP packet.

#...

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

In my terminal, compilation and upload of the printer_to_hid example now correctly yields :

$ cat helloworld.ps  # see helloworld.ps content
  %!PS
  8 selectfont
  (Hello world!) show

$ lp -d TinyUSB_Device -o raw ./helloworld.ps  # print helloworld.ps on the device
  request id is TinyUSB_Device-330 (1 file(s))

$   PS 8 selectfont  Hello world   show  # auto-typed by HID

The last line is automatically typed by the HID device. Only alphan...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Describe the PR
This is a proof-of-concept patch to support Full-Speed USB on DWC2 on a board with High-Speed ULPI

Additional context
I've a stm32h747 board with a high-speed external PHY.
But for testing/reliability purposes I want to limit the speed to Full-Speed.

I tried with:

#define BOARD_TUH_MAX_SPEED OPT_MODE_HIGH_SPEED
#define CFG_TUH_MAX_SPEED OPT_MODE_FULL_SPEED

In my tusb_config.h, but with bad results (hang in trying to setup the low-speed phy)

...

#

Size Difference Report

Because TinyUSB code size varies by port and configuration, the metrics below represent the averaged totals across all example builds.

Note: If there is no change, only one value is shown.

Changes >1% in size

No entries.

Changes <1% in size

No entries.

<details><summary>No changes</summary>

file .text .rodata .data .bss size % diff
audio_device.c...
fallow birchBOT
#

Pull request overview

This PR adds support for the AT32F45X series of microcontrollers from ArteryTek. The implementation follows the existing pattern used for other AT32 family members and includes support for three board variants: AT-START-F455, AT-START-F456, and AT-START-F457.

Key changes:

  • Added MCU option definition (OPT_MCU_AT32F45X = 2507) and USB controller configuration using DWC2 driver
  • Included complete BSP implementation with clock configuration, interrupt handlers, and b...
fallow birchBOT
#

Pull request overview

This pull request refactors the RP2040 USB driver code to improve maintainability and prepare for RP2350 support. The changes reorganize the hardware endpoint structure, simplify register access patterns, and improve conditional compilation for errata workarounds.

Key changes include:

  • Refactored hardware endpoint structure with reordered fields and conditional compilation for RP2040-specific errata fixes
  • Replaced stored register pointers with inline accessor fun...
#

IDE configuration files in the .idea/ directory are typically personal development environment settings that should not be committed to the repository. These files are usually added to .gitignore. Consider removing these files from the pull request and ensuring they are properly ignored in the repository's .gitignore file.


#

A debug trace statement has been removed that provided useful information about short packets. This could make debugging more difficult. Consider keeping this trace or documenting why it was removed if it was causing issues.

  if (xferred_bytes < ep->wMaxPacketSize) {
    // Log short packet to aid debugging of truncated transfers
    TU_LOG(3, "  Short packet on ep 0x%02x: xferred=%u, wMaxPacketSize=%u\r\n",
           ep->ep_addr, xferred_bytes, ep->wMaxPacketSize);
#

IDE configuration files in the .idea/ directory are typically personal development environment settings that should not be committed to the repository. These files are usually added to .gitignore. Consider removing these files from the pull request and ensuring they are properly ignored in the repository's .gitignore file.

  <!-- Intentionally left empty: developer-specific debug server configurations
       should not be version-controlled and should be managed locally. -...
#

The parameter dev_addr is cast to void to suppress unused variable warnings, but it's never used in the function. While this is a valid approach, it's inconsistent with other functions in the same file (like dcd_remote_wakeup on line 410) which use the __unused attribute. For consistency, consider using __unused uint8_t dev_addr instead of (void)dev_addr.

void dcd_set_address(uint8_t rhport, __unused uint8_t dev_addr) {
#

The trace statement references ep->transfer_type, but this field is never assigned in hw_endpoint_init for host mode (the assignment was removed during refactoring). This will cause the trace to print an uninitialized or stale value. Change the trace to use the transfer_type parameter instead: pico_trace("hw_endpoint_init dev %d ep %02X xfer %d\n", ep->dev_addr, ep->ep_addr, transfer_type);

  pico_trace("hw_endpoint_init dev %d ep %02X xfer %d\n", ep->dev_addr, ep->ep_ad...
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: rp2-hwfifo
#

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c86cbdc82

ℹ️ 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 u...

#

<sub><sub>P2 Badge</sub></sub> Clamp TX length to bytes actually read from FIFO

When ep->is_xfer_fifo is true, tu_hwfifo_write_from_fifo() can return fewer bytes than buflen if the FIFO has less data (which usbd_edpt_xfer_fifo() explicitly allows). This code ignores the returned byte count and still programs the buffer control length based on buflen, so the RP2040 will transmit whatever stale bytes are already in DPRAM for ...

fallow birchBOT
#

why not use the built-in FS PHY instead ? does the mcu only has 1 phy, and that is used by the other usb controller ?

You're right, I could use the built-in FS PHY of the MCU, but the board has been designed with the USB3315C external PHY, to be high-speed capable. So the built-in FS PHY pins are not connected.

At the moment, for some reasons I'm trying to understand, high-speed devices do not enumerate on that board with the latest TinyUSB, but full-speed devices work well. So with ...

fallow birchBOT
fallow birchBOT
#

Related area

如何兼容支持fatfs文件操作系统,并支持使用Tinyusb通过MSC识别

Hardware specification

STM32F103

Is your feature request related to a problem?

I want to connect an SD card to the STM32F103, mount the fatfs file system, and use tinyusb to enable the SD card to be recognized on the computer.

Describe the solution you'd like

可以将MSC与FATFS兼容,通过调用FATFS上的通用接口实现对应的驱动

I have checked existing issues, dicussion and documentation

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

@hathach I invited you to be a collaborator on my whole TinyUSB fork repository. That should let you do what you need. Please bear in mind that people have reported bugs in my pull request that I have not found the time to try to address. @wbcbz7 fork has further changes that fix some issues; I have not tested it yet, but it looks like that fork is using auto-retry of Bulk transfers on EPx...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Size Difference Report

Because TinyUSB code size varies by port and configuration, the metrics below represent the averaged totals across all example builds.

Note: If there is no change, only one value is shown.

Changes >1% in size

No entries.

Changes <1% in size

No entries.

<details><summary>No changes</summary>

file .text .rodata .data .bss size % diff
audio_device.c...
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: bsp_h7_tm4c
#

As discussed, this PR adds a MemBrowse integration to TinyUSB.

The integration is wired into the existing CI tests, so it can be used to collect both historical and ongoing memory footprint data.

The configured targets are set in membrowse-targets.json. (66 targets)

Run membrowse-onboard.yml manually to get historical data.
For an example I ran it from my fork to upload the last 60 commits, which are visible here:
https://membrowse.com/public/membrowse/tinyusb

Ongoing re...

fallow birchBOT
#

UART pin configuration mismatch: UART_DEV is defined as USART3 (line 40) but the UART TX and RX pins are configured with GPIO_AF7_USART1 alternate function. This should be GPIO_AF7_USART3 to match the UART_DEV definition, otherwise UART communication will not work correctly.

    .pin_init = { .Pin = GPIO_PIN_9, .Mode = GPIO_MODE_AF_PP, .Pull = GPIO_PULLUP, .Speed = GPIO_SPEED_HIGH, .Alternate = GPIO_AF7_USART3 },
    .active_state = 0
  },
  { // UART RX
    .port = GPIOA,
    ....
fallow birchBOT
#
[hathach/tinyusb] New branch created: edpt_stream-remove-nofifo-mode
#

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 86ca8fe717

ℹ️ 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 u...

#

<sub><sub>P2 Badge</sub></sub> Keep first stream binding for multi-EP vendor interfaces

In vendord_open the stream is now opened unconditionally for every endpoint, so the last IN/OUT descriptor overwrites rx_stream.ep_addr/tx_stream.ep_addr. If an interface has multiple IN or OUT endpoints, the first transfer is still queued for the earlier endpoint, but find_vendor_itf/vendord_xfer_cb only match against the current stre...

fallow birchBOT
#

thank you very much for your PR, is there any way we can use/upload the elf file that is built by current build.yml (we can upload the artifact and/or ld file) then download and push to membrowse. That would reduce the number of build job, currently it already takes quite a bit of time to run ci (10 mins), adding 65 more jobs will hurt since my account can only run like 20 jobs concurrently.

PS: I think we will need tons more targets since each board can have like 20 examples (elf).

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

Done. MemBrowse now reuses the artifacts from the existing cmake job instead of building
separately. Added upload-artifacts: true to the cmake job and membrowse downloads and analyzes
those ELFs.

Also fixed a bug I noticed: the workflow was running twice on every PR update (both push and
pull_request events were triggering). Restricted push to only the master branch so PRs trigger once.

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Please try:

diff --git a/src/tusb.c b/src/tusb.c
index bf82cdbe9..6075e9db4 100644
--- a/src/tusb.c
+++ b/src/tusb.c
@@ -392,7 +392,7 @@ uint32_t tu_edpt_stream_write_xfer(tu_edpt_stream_t *s) {
   // Pull data from FIFO -> EP buf
   uint16_t count;
   if (s->ep_buf == NULL) {
-    count = ff_count;
+    count = tu_fifo_count(&s->ff); // re-get count since fifo can be changed
   } else {
     count = tu_fifo_read_n(&s->ff, s->ep_buf, s->ep_bufsize);
   }
#

I took a very brief look and noticed this:

TU_ATTR_ALWAYS_INLINE static inline uint16_t tu_ff_overflow_count(uint16_t depth, uint16_t wr_idx, uint16_t rd_idx) {
  if (wr_idx >= rd_idx) {
    return (uint16_t)(wr_idx - rd_idx);
  } else {
    return (uint16_t)(2 * depth - (rd_idx - wr_idx));
  }
}

Especially the else part.
Apparently depth will not be over 2^15. (see tu_fifo_config)
However 2 * depth can be and since it isn't 2u, but 2, it might be cast to an int here?...

#

@TD-er

You can read more about the unmasked pointer FIFO (including response): https://www.snellman.net/blog/archive/2016-12-13-ring-buffers/

Also per C99 standard:

6.3.1.8 Usual arithmetic conversions
...
Otherwise, if the operand that has unsigned integer type has rank greater or equal to the rank of the type of the other operand, then the operand with signed integer type is converted to the type of the operand with unsigned integer type.

fallow birchBOT
fallow birchBOT
#

@HiFiPhile, after running git bisect and testing the good commits for more than 1 hour, this is the final result:

$ git bisect bad
Bisecting: 0 revisions left to test after this (roughly 0 steps)
[d0d56a51a15dbdb760f5607702cf4ceeb2451a9e] more tu_fifo refactor

After running the modified cdc_msc_freertos code for about 8 hours, I can confirm that this is the last good commit:

commit d0d56a51a15dbdb760f5607702cf4ceeb2451a9e (HEAD)
A...
#

Please try:

diff --git a/src/tusb.c b/src/tusb.c
index bf82cdbe9..6075e9db4 100644
--- a/src/tusb.c
+++ b/src/tusb.c
@@ -392,7 +392,7 @@ uint32_t tu_edpt_stream_write_xfer(tu_edpt_stream_t *s) {
// Pull data from FIFO -> EP buf
uint16_t count;
if (s->ep_buf == NULL) {

  • count = ff_count;
  • count = tu_fifo_count(&s->ff); // re-get count since fifo can be changed
    } else {
    count = tu_fifo_read_n(&s->ff, s->ep_buf, s->ep_bufsize);
    }
    With ...
#

Please try:
diff --git a/src/tusb.c b/src/tusb.c
index bf82cdbe9..6075e9db4 100644
--- a/src/tusb.c
+++ b/src/tusb.c
@@ -392,7 +392,7 @@ uint32_t tu_edpt_stream_write_xfer(tu_edpt_stream_t *s) {
// Pull data from FIFO -> EP buf
uint16_t count;
if (s->ep_buf == NULL) {

  • count = ff_count;

  • count = tu_fifo_count(&s->ff); // re-get count since fifo can be changed
    } else {
    count = tu_fifo_read_n(&s->ff, s->ep_buf, s->ep_bufsi...

fallow birchBOT
#

Size Difference Report

Because TinyUSB code size varies by port and configuration, the metrics below represent the averaged totals across all example builds.

Note: If there is no change, only one value is shown.

Changes >1% in size

No entries.

Changes <1% in size

No entries.

<details><summary>No changes</summary>

file .text .rodata .data .bss size % diff
audio_device.c...
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: stream_write_fix
fallow birchBOT
fallow birchBOT
#

Describe the PR
This PR ports a small fix from espressif/tinyusb into hathach/tinyusb to keep the code aligned and avoid divergence.

What it solves
Syncs the upstream fix in the core...

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

list all users with write access to hathach/tinyusb


✨ Let Copilot coding agent [set things up for you](https://github.com/hathach/tinyusb/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure instructions for this repository as documented in [Best practices for Copilot coding agen...

fallow birchBOT
#

Size Difference Report

Because TinyUSB code size varies by port and configuration, the metrics below represent the averaged totals across all example builds.

Note: If there is no change, only one value is shown.

Changes >1% in size

No entries.

Changes <1% in size

No entries.

<details><summary>No changes</summary>

file .text .rodata .data .bss size % diff
audio_device.c...
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Describe the PR
Enable FSDEV D+ pull-up control on CH32V20x by including EXTEN_USBD_PU_EN in the dcd_connect/disconnect build guard.

Additional context
The FSDEV DCD only defines dcd_connect() when USB_BCDR_DPPU or SYSCFG_PMC_USB_PU are present.
On CH32V20x those macros are absent, so dcd_connect() is empty and the USB pull-up never turns on, leaving the device will never enumerated by PC.
In this patch, add defined(EXTEN_USBD_PU_EN) so the CH32V20x functions in `...

fallow birchBOT
fallow birchBOT
#

Hi @HiFiPhile,
Please try go to the link again.
The issue was that only one commit was uploaded to the system and it didnt find the parent commit report to compare to.
I will add a better error message to the system to make it clearer.

I've uploaded more reports using the membrowse-onboard.yml workflow so now the comparison works.

After merging this pull request, i suggest to run the provided membrowse-onboard.yml github workflow as well at least on the last 20 commits (its a param...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

MemBrowse targets file was misconfigured for 2 targets. It configured targets that are not actually built in the CI.
That caused failing generating and uploading the reports for those targets.
This PR changes the targets to the ones that are actually being built:

  • stm32h7: daisyseed -> stm32h743eval
  • samd5x_e5x: d5035_01 -> metro_m4_express
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: msc_stall
fallow birchBOT
#
[hathach/tinyusb] New branch created: u0_fix
#

Pull request overview

This PR adjusts TinyUSB’s STM32 FS device configuration so that STM32U0, which has a 1024-byte PMA but 32-bit access width, uses the correct data/address stride and access scheme.

Changes:

  • In tusb_option.h, special-cases STM32U0 so that although CFG_TUSB_FSDEV_PMA_SIZE is 1024, it uses the 32-bit FIFO data and address stride settings previously used only for 2048-byte PMA devices.
  • In fsdev_common.h, similarly special-cases STM32U0 so that it uses the 3...
#

The explanatory comment above that describes how CFG_TUSB_FSDEV_PMA_SIZE maps to access schemes (512/1024/2048) is now out of date: STM32U0 has CFG_TUSB_FSDEV_PMA_SIZE == 1024 but uses the 32-bit access scheme handled in this new #elif CFG_TUSB_FSDEV_PMA_SIZE == 2048 || CFG_TUSB_MCU == OPT_MCU_STM32U0 branch. Please update that comment to mention the STM32U0 exception so future readers do not assume all 1024-byte devices use the 2x16-bit scheme.

fallow birchBOT
#

Thank you, I am looking forward to feedback. The tests I could perform on Windows indeed reveal that detection of the printer is not 100% automatic, and there is a need to "install" the printer (same on linux) from the configuration menu. At least there is no need to use admin privileges, download or execute dependencies, which is sufficient for my use case.

In the interest of TinyUSB as a whole, however, it is interesting to see if that can be improved. I suppose the printer description, ...

fallow birchBOT
#

Operating System

MacOS

Commit SHA

dc00f3536f7f636ffea639430faa2d828317137c

Board

STM32U5 Nucleo-144 (NUCLEO-U575ZI-Q)

Firmware

First discovered issue while working on a custom STM32U575 design (USB-FS device) that is self-powered. Tiny-USB was being built as a static library and everything aside from mentioned issue works correctly.

Reproduced issue on a STM32U5 Nucleo-144 (NUCLEO-U575ZI-Q) development board with unmodified TinyUSB cdc_msc example.

What happen...

fallow birchBOT
#

Since #1476 now we have a better understanding of dwc2 core.

GOTGINT_SEDET bit is set when the utmiotg_bvalid signal is deasserted, to make it work you need to have VBus signal connected (in which case B-peripheral session valid override is not used).

Unfortunately NUCLEO-U575ZI-Q board doesn't have VBus signal.

In fact without VBus signal device is no way to know the difference between suspend and disconnection since voltage level is the same.

Let's keep the discussion in #1476.

#

Update

Now we have a better understanding of DWC2 core.

GOTGINT_SEDET bit used by disconnection detection is set only when the utmiotg_bvalid signal is deasserted, to make DCD_EVENT_UNPLUGGED event work <ins>you must have VBus signal connected</ins> (in which case B-peripheral session valid override is not used).

In fact without VBus signal USB device has no way to know the difference between suspend and disconnection since voltage level is the same.

fallow birchBOT
fallow birchBOT
#

Thanks @HiFiPhile for the quick response on my issue ticket. (3475)

It appears the Nucleo board does have a VBUS sense line attached to PC2, but it is merely a GPIO and doesn't have an alternate function which connects it to the USB peripheral.
<img width="1924" height="1270" alt="Image" src="https://github.com/user-attachments/assets/464f6631-923d-4ef6-9cd3-28fc5d4968cb" />

Do you think that the DWC2 driver could be made to accept a pin int...

fallow birchBOT
#

@Viatorus

Could you please clarify whether this could be resolved:
via software (e.g., TinyUSB or STM32 driver/configuration)
via hardware (e.g., missing or incorrect bus signaling)
or if it’s a limitation inherent to the STM32 USB peripheral

If you have Vbus connected then DCD_EVENT_UNPLUGGED event and tu_unmount_cb should work normally.

If you don't have Vbus then DCD_EVENT_UNPLUGGED and tu_unmount_cb won't work, you have to use tud_suspend_cb instead.

fallow birchBOT
fallow birchBOT
#

@brentmellor

Do you think that the DWC2 driver could be made to accept a pin interrupt to signal VBUS rise/fall and initiate the proper callbacks through TinyUSB? I'll be doing this externally for now, but it would be nice to have it integrated.

It's possible by toggle B session override in GPIO interrupt, I did a successful experiment on U5A5-Nucleo (HS).

Note:

  • STM32's DWC2 has a customized configuration register GCCFG, sometimes session override needs to be done in GCCFG instead of ...
fallow birchBOT
#
[hathach/tinyusb] New branch created: dwc2_vbus
fallow birchBOT
#

Describe the PR

  • Add VBus sensing option to tud_configure(), for STM32 GCCFG register config is now included in the stack, which reduces BSP compicity.
  • Also turn off device mode Vbus output in F4/F7's BSP to fix disconnection detection.
  • Add Vbus detection support to Nucleo-U5A5AZJ which uses ADC to read Vbus voltage.

Other device families should not be infected as GOTGCFG default value stays the same.

Device and host modes are tested and functional:
| Board | Type | D...

#

Pull request overview

This PR extends the DWC2 STM32 integration to support configurable VBUS sensing via tud_configure(), centralizes STM32 GCCFG/VBUS handling inside the DWC2 port, and wires board-level configurations (including ADC-based sensing) to fix missing DCD_EVENT_UNPLUGGED events on STM32 DWC2 targets.

Changes:

  • Extend the DWC2 device configuration (tud_configure_dwc2_t) with a vbus_sensing flag and propagate it into the DWC2 device/host drivers, including a new...
#

board_vbus_sense_init() here largely duplicates the ADC and TIM1 configuration used in stm32u5/boards/stm32u5a5nucleo/board.h. Keeping two copies of this low-level init code increases the risk that future changes (e.g., trigger source, sampling time, calibration behavior) are applied in one board but forgotten in the other; it would be more maintainable to move the shared configuration into a common helper and parameterize only the differences (IRQ line and USB instance).

#

board_vbus_sense_init() contains a full ADC and TIM1 configuration sequence that is almost identical to the implementation in stm32u5/boards/stm32u575nucleo/board.h. Duplicating this amount of setup code across boards makes future fixes (e.g., sampling time, trigger source, threshold logic) easy to miss in one place; consider factoring the common ADC/TIM setup into a shared helper (e.g., in family.c or a common header) with parameters for the IRQ and USB instance.

#

In ADC1_IRQHandler() the condition checks USB_OTG_HS->GOTGCTL & USB_OTG_GOTGCTL_BVALOEN, but the handler then sets/clears USB_OTG_FS->GOTGCTL bits. On this FS-only board the HS core is not used, so this access will either fail to compile (if USB_OTG_HS is undefined) or, if it does compile, will read the wrong controller and de-synchronize the VBUS override logic. The check and the writes should consistently target the same USB OTG instance (FS).

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Describe the PR
Add CFG_TUD_TASK_EVENTS_PER_RUN and CFG_TUH_TASK_EVENTS_PER_RUN options to limit the number of events processed in a single call to tud_task_ext() or tuh_task_ext().

This is a simplified replacement for pull request #3432 after hathach last comment.

Additional context

An application main loop (without os) with tinyusb host and device stack look like:

      while(1) { // the mainloop
        application_code();
        t...
fallow birchBOT
fallow birchBOT
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 this user feedback, double check with specs

Am I correct in thinking tinyUSB supports DFU 1.1? If so, should the descriptor below not be advertising 0x0110 (i.e. 1.1) instaed of 0x0101 (1.0.1)?

// DFU runtime descriptor
// Interface number, string index, attributes, detach timeout, transfer size
#define...
fallow birchBOT
#

Codex Review: Didn't find any major issues. Hooray!

<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 addre...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

@hathach I was using no-fifo mode previously in order to get the buffers directly in my callback handlers rather than reading and writing to and from the FIFO.

IIRC before this change, in that mode there was a logic bug in the vendor_n_write code that was causing the endpoint transfers to be skipped completely, so no messages were ever getting sent out from the device. On the host side, this was causing my "requests" (a write then a read) to the device to time out because nothing reached ...

fallow birchBOT
fallow birchBOT
#

Describe the PR
This remove all calls to tusb_time_delay_ms_api() from inside tuh_task_ext().

Additional context
Use of the host API was not really possible with OPT_OS_NONE due to blocking calls in tuh_task_ext().

I've split this in 3 patches:

  1. Long boring preparation patch to split the functions calling tusb_time_delay_ms_api().
  2. Executing the continuation functions asynchronously.
  3. cleaning up the handling of deferred attachments with a separate queue (note: I've...
fallow birchBOT
fallow birchBOT
#

How to handle the few platforms missing tusb_time_millis_api()?

I see you can't wait longer :)

I've asked Claude if OSAL ports has millis API:

✅ Already supported:

  • OPT_OS_FREERTOS: Uses xTaskGetTickCount()
  • OPT_OS_MYNEWT: Uses os_time_ticks_to_ms32(os_time_get()
  • OPT_OS_PICO: Uses to_ms_since_boot(get_absolute_time()
  • OPT_OS_RTTHREAD: Uses rt_tick_get() converted to milliseconds
  • OPT_OS_ZEPHYR: Uses k_uptime_get_32()
  • OPT_OS_CUSTOM: Requires user implementation

...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Ok, now all compilation checks pass.

How to handle the few platforms missing tusb_time_millis_api()?

I see you can't wait longer :)

Hey, I've customers waiting :)

Regarding tusb_time_millis_api(), I've added a configuration option, CFG_TUH_TASK_USE_TIME_MILLIS_API, which is enabled by default except for OPT_OS_RTX4 and OPT_OS_PICO. I've also disabled the feature for expressif.

For OPT_OS_PICO this is weird because in ./hw/bsp/board_api.h, board_millis() is defined, but ...

fallow birchBOT
#

Another challenge is control transfer and buffer management. To save ressource USBH only manage one control transfer (composed by setup+data+status packets) each time.

Ok, I've looked at tuh_control_xfer() and I think I see some of the issues. here are a few of my observations:

  1. tuh_control_xfer() without a callback can recurse into tuh_task(). I was scared when I saw that but fortunately tuh_control_xfer() is never called without callback in the enumeration code or anywhere in my...
fallow birchBOT
#

My goodness, is there a way to silence this "advanced" security bot?

that is OK, just ignore it if it does not make sense. It is static analyzer warning from PVS-studio and/or other tool, but I currently configure some of the tusb config (this thing take lots of time to tweak and tune-up) therefore code may be mistaken as unreachable. I got annoyed by it as well, but we do review with a pair of human eye.

fallow birchBOT
#

Ok, I've looked at tuh_control_xfer() and I think I see some of the issues. here are a few of my observations:

1 . Yes
2.1/2.2 Yes, currently there is no retry if tuh_control_xfer failed early.
2.3 To support timeout we need to modify HCD drivers to manage devices who sends NAK but no transfer error. (Windows use 20s timeout)
3. Yes
4. Oh, I saw it....
5. I tried to do something last week but realized that to have full concurrency we may need to add transfer status and buffer to ea...

fallow birchBOT
#
  1. I tried to do something last week but realized that to have full concurrency we may need to add transfer status and buffer to each devices, it's a hard decision to make for smaller MCUs ...

Reading the code, adding a transfer status to each device for use after enumeration was also my first idea (but keeping a global transfer status and buffer global for enumeration).

For the buffer, acm_set_line_coding() and friends could maybe just put the small buffers they need right into the C...

fallow birchBOT
#
[hathach/tinyusb] New branch created: skip-some-ci
#

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b85a3967bf

ℹ️ 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 u...

#

<sub><sub>P2 Badge</sub></sub> Restore Zephyr CI job gating instead of hard-disabling

The zephyr job is now hard-disabled via if: false && needs.check-paths.outputs.code_changed == 'true', which means no Zephyr builds will run for any PRs or pushes. That removes CI coverage for the Zephyr integration entirely, so regressions in the Zephyr examples (or toolchain updates) can land undetected. If the intention is to suppress only th...

#

Using false && to disable workflow jobs creates a permanent skip condition that bypasses all other conditionals. This approach makes the job always skip regardless of the other conditions. Consider using a workflow-level variable or GitHub repository variable to make this toggle more manageable without requiring code changes. For example, you could use vars.SKIP_ZEPHYR != 'true' && needs.check-paths.outputs.code_changed == 'true' which would allow toggling via repository variables in the ...

#

The comment "kind of distracting" is vague and subjective. Consider providing more context about why this is being disabled (e.g., "skip membrowse comment due to excessive noise in PRs" or "skip membrowse comment pending workflow optimization"). This will help future maintainers understand the reasoning and decide if/when to re-enable it.

    # Membrowse PR comment disabled due to excessive noise in pull requests; re-enable once the workflow is optimized or comments are made mor...
#

Using false && to disable workflow jobs creates a permanent skip condition that bypasses all other conditionals. This approach makes the job always skip regardless of the other conditions. Consider using a workflow-level variable or GitHub repository variable to make this toggle more manageable without requiring code changes. For example, you could use vars.SKIP_MEMBROWSE_COMMENT != 'true' && always() && ... which would allow toggling via repository variables in the GitHub UI.

#

Pull request overview

This PR temporarily disables two GitHub Actions workflow jobs in the build pipeline: the Zephyr build job and the Membrowse comment posting job. The changes use false && conditions to short-circuit the job execution without removing the job definitions.

Changes:

  • Disabled the zephyr job due to build failures with plans to fix later
  • Disabled the membrowse-comment job to reduce noise/distraction in pull requests

💡 Add Copilot custom instructions...

fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: update-readme
fallow birchBOT
#
[hathach/tinyusb] New branch created: readd-ci-checkpath
#

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4632441ae7

ℹ️ 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 u...

#

<sub><sub>P2 Badge</sub></sub> Allow doc-only pushes to reach membrowse chain

The new check-paths gating causes set-matrix (and therefore cmake and membrowse) to be skipped whenever code_changed is false. For pushes that only touch non-matching paths (e.g., docs), this means the workflow runs but does not execute the build or membrowse jobs, so the commit chain registration described in the comment never occurs. This regres...

#

Pull request overview

This PR updates the Build GitHub Actions workflow to always trigger on push/pull_request events (removing event-level paths filters) and reintroduces path-based gating via a dedicated check-paths job, with the intent of still supporting membrowse commit-chain registration.

Changes:

  • Removed on.push.paths and on.pull_request.paths filters so the workflow triggers for all pushes/PRs.
  • Added a check-paths job using dorny/paths-filter to detect whe...
#

set-matrix is skipped when code_changed is false, which causes the entire build chain (cmake -> membrowse) to be skipped as well. That contradicts the stated goal of always running this workflow to keep the membrowse commit chain updated on doc-only pushes; consider running the membrowse job unconditionally (passing code_changed through) and decoupling it from the cmake dependency for doc-only changes.

fallow birchBOT
#

yeah, I am not entirely sure, I am only interested in the file changes in tinyusb src, instead of the whole target which also pull in other code such vendor hal, mcu and 3rd party lib.

Also I break it out into > 1%, < 1% and not changed (which is hidden by default). However, my needs is a bit specific. I think your current implementation work for most end-user exe target. I am still not familliar with membrowse yet, but if it is posible to have pr comment from a (md) file, it would be gre...

fallow birchBOT
fallow birchBOT
#

@membrowse let me know if this could resolve the issue in #3483

The membrowse job currently has needs: cmake, but when code_changed is false, the dependency chain (set-matrix
cmake) gets skipped, which causes membrowse to also be skipped.

This breaks the commit chain tracking for MemBrowse on push events (even doc-only pushes should register with MemBrowse).

Suggested fix - restore the original logic with always() and event checks:

me...
fallow birchBOT
#
[hathach/tinyusb] New branch created: zlp-hs-on-fs
#

Pull request overview

This PR addresses incorrect bulk transfer sizing when a high-speed-capable device/host is operating at full speed, which can otherwise cause Zero Length Packet (ZLP) termination issues.

Changes:

  • Replace endpoint-stream “buffer size” usage with an explicit per-endpoint xfer_len used to bound read/write transfer requests.
  • Introduce *_FS_XFERSIZE / *_HS_XFERSIZE configuration macros for CDC/MIDI/Vendor classes and update device drivers to select the appro...
#

tu_edpt_stream_open() now takes a single xfer_len argument, but this call passes extra/undefined arguments (xfer_size is not defined in this file). This will not compile and also won’t correctly set the stream’s transfer length. Update this to pass a single xfer_len value (e.g., based on endpoint direction and the configured CFG_TUH_CDC_{RX,TX}_EPSIZE and/or tu_edpt_packet_size(desc_ep)), ensuring it does not exceed the size of stream->ep_buf.


    // Determine tra...
fallow birchBOT
fallow birchBOT
#

@copilot update using suggestion below

@membrowse let me know if this could resolve the issue in #3483

The membrowse job currently has needs: cmake, but when code_changed is false, the dependency chain (set-matrixcmake) gets skipped, which causes membrowse to also be skipped.

This breaks the commit chain tracking for MemBrowse on push events (even doc-only pushes should register with MemBrowse).

Suggested fix - restore the original logic with `al...

#

Thanks for the feedback on #3485. I've created this new PR, which merges into #3485, to address your comment. I will work on the changes and keep this PR's description up to date as I make progress.

Original PR: #3485
Triggering comment (https://github.com/hathach/tinyusb/pull/3485#issuecomment-3871376373):

@copilot update using suggestion below

@membrowse let me know if this could resolve the issue in #3483

The membrowse job currently has needs: cmake, but when `...

fallow birchBOT
#

Pull request overview

Adjusts the Build workflow so the membrowse reporting job runs on all pushes (including doc-only pushes) to preserve MemBrowse commit-chain tracking, while keeping PR behavior gated by actual code changes.

Changes:

  • Make membrowse resilient to skipped upstream jobs by using always() && !cancelled() and adding check-paths to needs.
  • Add event-based gating: always run on push/release/workflow_dispatch, run on pull_request only when `code_change...
#

code_changed is defined as “Whether code paths changed (true) or doc-only (false)” in membrowse-report.yml, but here it’s forced to true for release/workflow_dispatch regardless of what check-paths computed. This can cause the reusable workflow to attempt artifact download/restore steps even when set-matrix/cmake were skipped (no artifacts), and it blurs the meaning of the input. Consider passing the actual needs.check-paths.outputs.code_changed == 'true' value and, if you n...

#

Using always() at the job level means membrowse will also run when cmake fails, not just when it’s skipped. In that case membrowse-report.yml will likely fall back to the identical: true path (no ELF), which can misrepresent a real code change/build failure as a doc-only/identical report. Consider additionally gating on needs.cmake.result != 'failure' (or needs.cmake.result == 'success' || needs.cmake.result == 'skipped') while keeping always() so it still runs when cmake ...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

we can have tud_class_configure() to disable zlp handling which pass that to edpt stream API instead.

Do you mean add a config like multi_packet_rx:

  • For IN keep current behavior (without PR)
  • For OUT if true then queue EP_BUFSIZE like current behavior (Need host sending ZLP), if false then only queue MPS

?

Another inconsistency is when CFG_TUD_EDPT_DEDICATED_HWFIFO = 0, data is written into FIFO and tud_cdc_n_available is incremented, but tud_cdc_rx_cb is only called e...

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

Pull request overview

This PR updates the CI workflow to integrate membrowse (a memory analysis tool) upload functionality directly into the build process, replacing the previous separate workflow approach. The implementation adds membrowse upload as an optional build target that runs after successful CMake builds when an API key is available.

Changes:

  • Added --membrowse-upload command-line option to tools/build.py that triggers membrowse upload targets after successful CMake buil...
#

The echo command syntax is unconventional and inconsistent with the rest of the codebase. Line 35 in this same file uses the standard pattern echo "value" >> $GITHUB_ENV, but lines 26-27 use echo >> $GITHUB_PATH "value". While this syntax may work in bash, it's inconsistent and should be changed to match the conventional pattern used throughout the codebase: echo "$HOME/.local/bin" >> $GITHUB_PATH and echo "${{ github.workspace }}/ninja-bin" >> $GITHUB_PATH.

        #ech...
#

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 69a00c2ad7

ℹ️ 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 u...

#

<sub><sub>P2 Badge</sub></sub> Restore membrowse job for non-code push events

Commenting out the dedicated membrowse workflow removes the only path that handled doc-only pushes with an identical report; the new upload path runs inside cmake, which is skipped whenever set-matrix is skipped on code_changed == false, so those commits no longer update Membrowse history. This breaks the commit chain and can invalidate baseline-t...

#

Size Difference Report

Because TinyUSB code size varies by port and configuration, the metrics below represent the averaged totals across all example builds.

Note: If there is no change, only one value is shown.

Changes >1% in size

No entries.

Changes <1% in size

No entries.

<details><summary>No changes</summary>

file .text .rodata .data .bss size % diff
audio_device.c...
fallow birchBOT
fallow birchBOT
#

Actually the issue exist for default value CFG_TUD_CDC_EP_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64) even before stream refactor.

For high speed device since TUD_OPT_HIGH_SPEED is true, even at full speed it will queue transfer of 512 length instead of 64 leading to OUT transfer zlp issue.

I didn't came up with a fix without separate the config for each speed.

yeah, I mean by defauult it will send using buffer size, however if zlp behavior is disabled. we will only queue 1 p...

#

we can have tud_class_configure() to disable zlp handling which pass that to edpt stream API instead.

Do you mean add a config like multi_packet_rx:

  • For IN keep current behavior (without PR)
  • For OUT if true then queue EP_BUFSIZE like current behavior (Need host sending ZLP), if false then only queue MPS

?

Another inconsistency is when CFG_TUD_EDPT_DEDICATED_HWFIFO = 0, data is written into FIFO and tud_cdc_n_available is incremented, but `tud_cdc_r...

fallow birchBOT
fallow birchBOT
#

Describe the PR
This remove all calls to tusb_time_delay_ms_api() from inside tuh_task_ext().

Additional context

This is a cleaned-up version of #3482

Use of the host API was not really possible with OPT_OS_NONE due to blocking calls in tuh_task_ext().

With an OS, it will also improve the situation because:

  1. The timeout_ms parameter of tuh_task_ext() is now respected.
  2. The traffic with device 1 will not stop when device 2 is plugged.

I've split this in 3 main p...

fallow birchBOT
#

Describe the PR
Add a hook to define an external function that will be called when TU_BREAKPOINT is hit.

Additional context

Like CFG_TUSB_DEBUG_PRINTF, if CFG_TUSB_DEBUG_BREAKPOINT is defined, a function of that name will be called instead of the predefined platform-dependent code.

This external function could for example print "TU_BREAKPOINT", and/or allows the user to define a "real" breakpoint on that function when debugging.

The immediate need for me is that the...

#

Pull request overview

Adds an opt-in hook to override TinyUSB’s default TU_BREAKPOINT() implementation with an application-provided function, similar in intent to the existing CFG_TUSB_DEBUG_PRINTF customization.

Changes:

  • Add CFG_TUSB_DEBUG_BREAKPOINT conditional path to route TU_BREAKPOINT() through a user-defined symbol.
  • Preserve the existing architecture-specific breakpoint implementations as the fallback.

💡 Add Copilot custom instructions for smarter, more g...

#

TU_BREAKPOINT() declares the hook function inside the macro expansion. In C++ translation units this declaration will have C++ linkage (name mangling) at the call site, which can cause link failures or require users to add extern "C" themselves. Align with CFG_TUSB_DEBUG_PRINTF by declaring extern void CFG_TUSB_DEBUG_BREAKPOINT(void); at header scope (inside the existing extern "C" block) and make the macro just call it.

fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: pr-3471-status-sent-stall
#

Follow-up to #3471.

This keeps behavior unchanged (set CMD + queue CBW) and only defers queueing in when EP OUT is stalled.

Changes:

  • Revert stall check from
  • In , if EP OUT is stalled: set without queuing transfer
  • Otherwise call as before

Rationale:

  • The assert risk exists on the STATUS_SENT -> CMD re-arm path
  • Other call sites (open/reset-recovery) should keep original semantics
  • Existing Clear Stall handler for EP OUT in CMD stage will queue CBW when host clears halt
#

Describe the PR
This patch allows configuring a Full-Speed USB host with DWC2 on a board wired with a High-Speed ULPI PHY

Additional context
This implements #3450 proof-of-concept in a proper way (I hope).

It introduces an optional CFG_TUH_PHY_SPEED configuration option, which specify the PHY configuration and can be different (higher than) CFG_TUH_MAX_SPEED

For example, this works on a stm32h747 board with external ULPI:

#define CFG_TUH_MAX_SPEED		OPT_MODE_FULL_S...
fallow birchBOT
fallow birchBOT
#
fallow birchBOT
#

I think it's better to add a forced speed tuh_configure dynamic config.

https://github.com/hathach/tinyusb/blob/2883403ed010c54c33a38c28358a4dd0c67d67c0/src/host/usbh.h#L150

Ok, I would prefer a dynamic config too.

But I tried to do it the other way around. The problem with

  1. speed = high
  2. forced_speed = full

Is that all buffers sizes will be based on "high speed" settings (big)

Or do we need something like PR #3487 for the host side too?

I was trying to ta...

fallow birchBOT
#

Operating System

Linux

Commit SHA

80b207852a96a7639c6ec83d0d37322a8d6e53c0

Board

Pico2

Firmware

My project uses TinyUSB with lots of interfaces, project is https://github.com/rgrr/yapicoprobe/

Problem appears on an RP2350 Pico2 board.

Not sure if it also will happen with an RP2040 board.

What happened ?

Updating TinyUSB from 0.20.0 to recent master showed a bug which crashes my device after some seconds after a reset. I guess this is the time of USB handshakin...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: rp2-disable-hwifo
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: more-membrowse
#

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 441b667e6b

ℹ️ 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 u...

#

<sub><sub>P1 Badge</sub></sub> Keep membrowse target-name consistent across upload paths

The --identical upload path now uses --target-name ${BOARD}/${TARGET}, but the normal upload path in the same function still uses ${FAMILY}/${BOARD}/${TARGET}. In this workflow, docs-only changes skip the build (.github/workflows/build_util.yml lines 85-87), so uploads take the --identical branch and write to a different target key than...

#

Pull request overview

Updates Membrowse reporting identifiers and adjusts CI workflow behavior for Membrowse uploads.

Changes:

  • Changed the Membrowse --target-name used when uploading an --identical report.
  • Removed continue-on-error from the “Membrowse Upload” step in the reusable build workflow.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
hw/bsp/family_suppor...
#

--target-name is now ${BOARD}/${TARGET} only in the no-ELF (--identical) upload path, while the normal upload path (when the ELF exists) still uses ${FAMILY}/${BOARD}/${TARGET}. This will split Membrowse history across two target names depending on whether TARGET_ELF_PATH exists. Make the --target-name consistent in both branches (and ensure the PR description matches the chosen format).

    MEMBROWSE_CMD=\"${MEMBROWSE_EXE} report ${OPTION} --identical --upload --git...
#

Removing continue-on-error means Membrowse upload failures (including missing/empty secrets.MEMBROWSE_API_KEY on forked PRs, or transient server errors) will fail the entire reusable build job and block CI. If uploads are best-effort, keep continue-on-error or add retry/backoff; otherwise gate this step on secrets.MEMBROWSE_API_KEY being non-empty so forked PRs don’t fail.

fallow birchBOT
#

I use a custom msc_host modified to support CBI and removable media. This hcd_edpt_abort_xfer is needed when a SCSI command times out. I was able to verify this abort works by ejecting a 3.5" floppy disk during IO and forcing a real hardware timeout.

The msc_host and app used for testing:
https://github.com/picocomputer/rp6502/blob/main/src/ria/usb/msc_host.c
https://github.com/picocomputer/rp6502/blob/main/src/ria/usb/msc.c

#

Size Difference Report

Because TinyUSB code size varies by port and configuration, the metrics below represent the averaged totals across all example builds.

Note: If there is no change, only one value is shown.

Changes >1% in size

No entries.

Changes <1% in size

No entries.

<details><summary>No changes</summary>

file .text .rodata .data .bss size % diff
audio_device.c...
#

Pull request overview

Implements hcd_edpt_abort_xfer() for the RP2040 native USB host controller to support aborting in-flight endpoint transfers (e.g., on SCSI/MSC command timeout).

Changes:

  • Add an RP2040 host-side hcd_edpt_abort_xfer() implementation that clears the endpoint buffer control and resets the endpoint transfer state.
  • Reset endpoint PID tracking on abort.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

#

hcd_edpt_abort_xfer() resets the endpoint state (hw_endpoint_reset_transfer() clears ep->active) without preventing/clearing a pending HOST buf_status interrupt for that endpoint. If the hardware has already set the buf_status bit (or does so shortly after), the IRQ handler will call hw_endpoint_xfer_continue(ep) which panics on an inactive endpoint (see rp2040_usb.c), causing a hard crash after abort. Consider disabling USBCTRL IRQs around the abort, clearing the relevant `usb_...

#

Resetting ep->next_pid to 0 during abort will reset the data toggle for non-control endpoints, which can desynchronize the host/device toggle state and potentially trigger DATA_SEQ_ERROR (this HCD currently panics on that IRQ). Unless abort is intended to perform a full toggle reset/recovery, it’s safer to preserve next_pid (or reset it only as part of the class/endpoint reset sequence).


fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Operating System

Linux

Commit SHA

d13284d02da552c843e3ccbda4472083f25b0b16

Board

LPC4330

Firmware

custom firmware for HackRF on LPC4330

What happened ?

When a multi-port FTDI device (FT4232H) is connected, only interface 0 enumerates successfully. The enumeration of interfaces greater than 0 enters an infinite loop, repeatedly re-enumerating interface 0.

In cdch_set_config function in cdc_host.c, wIndex is set to the interface number, i.e. `xfer.request.wInde...

fallow birchBOT
#

perfect, thank you. I made some change using GUID, also

  • add CFG_TUD_VBUS_DETECT_HW which serve as default value for vbus sense. I think it could also be used by other port
  • add CFG_TUD_CONFIGURE_DWC2_DEFAULT, which make it easier for us to add more variable to the struct, also make it configurable as well.

@HiFiPhile Let me know if these change make sense to you

#

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

Infinite Loop in Multi-Channel FTDI Chip Initialisation

Operating System

Linux

Commit SHA

d13284d02da552c843e3ccbda4472083f25b0b16

Board

LPC4330

Firmware

custom firmware for HackRF on LPC4330

What happened ?

When a multi-po...

#
[hathach/tinyusb] New branch created: fix-3499-ftdi-multi-channel-init
#

Summary

Fix FTDI multi-interface host initialization so each interface resolves to the correct CDC instance during set_config.

Issue: cdch_set_config() used interface number in wIndex for all drivers, while FTDI lookup uses channel in wIndex. On multi-channel FTDI devices (e.g. FT4232H), this can resolve interface 1+ transfers back to interface 0 and loop initialization.

What changed

  • In cdch_set_config():
    • Use FTDI channel for wIndex (instead of interface number).
      -...
fallow birchBOT
fallow birchBOT
#

Description

When new device was attached (to root port or downstream port), it goes through the enumeration process. After getting the 8 bytes of the Device Descriptor, the enumeration process calculates a new value for the device address, based on the current implementation:

static uint8_t enum_get_new_address(bool is_hub) {
  uint8_t start;
  uint8_t end;

  if ( is_hub ) {
    start = CFG_TUH_DEVICE_MAX;
    end   = start + CFG_TUH_HUB;
  }else {
    start = 0;
   ...
fallow birchBOT
#

Pull request overview

This PR adds a debug log message to help developers diagnose configuration issues when USB hub address allocation fails during device enumeration. When CFG_TUH_HUB is enabled and a hub device cannot be assigned an address (because all hub slots are occupied), the code now logs an explicit message suggesting to increase the CFG_TUH_HUB configuration value.

Changes:

  • Added a TU_LOG1() debug message in enum_get_new_address() function to alert when hub addr...
#

The added logging only covers the case when hub addresses are exhausted. Consider also logging when non-hub device addresses are exhausted (when is_hub is false). This would provide a consistent debugging experience regardless of whether the user has exhausted hub slots or regular device slots. The else case could log something like: "All addresses are occupied, try to increase CFG_TUH_DEVICE_MAX value."

  } else
#endif // CFG_TUH_HUB
  {
    TU_LOG1("All addresses are occupied,...
fallow birchBOT
#

Pull request overview

This PR aims to address RP2040 host-controller behavior where control endpoint state (EPX/EP0 max packet size) can become stale across different devices, leading to fragmented control transfers that some devices fail to reassemble.

Changes:

  • Re-opens EP0 inside usbh_setup_send() using the device’s bMaxPacketSize0 to ensure correct control max packet size before sending a SETUP packet.

💡 Add Copilot custom instructions for smarter, more guided revi...

#

usbh_setup_send() now calls usbh_edpt_control_open() for every control transfer on all host controllers. For HCDs like DWC2, hcd_edpt_open() allocates a fresh endpoint each call (no “already opened” check), so this can exhaust endpoint slots / leak state and break control transfers. This re-open should be guarded to only run on controllers that share EP0/EPX across devices (e.g. RP2040), or moved behind a dedicated opt-in config/HCD hook so other ports keep the existing behavior.

#

The return value of usbh_edpt_control_open(daddr, ep0_mps) is ignored. If the open fails, the code still proceeds to hcd_setup_send(), which can lead to confusing failures later. Consider handling the failure here (e.g., set control stage back to IDLE and return false) so callers’ TU_ASSERT(usbh_setup_send(...)) behaves correctly.

  if (!usbh_edpt_control_open(daddr, ep0_mps)) {
    _control_set_xfer_stage(CONTROL_STAGE_IDLE);
    return false;
  }
#

Pull request overview

This PR implements the hcd_edpt_abort_xfer function for the RP2040 host controller driver, which was previously a stub returning false. The implementation allows aborting an in-progress USB transfer on a given endpoint, which is useful for handling timeout scenarios such as CBI (Control/Bulk/Interrupt) protocol timeouts.

Changes:

  • Implemented hcd_edpt_abort_xfer by clearing the buffer control register, resetting transfer state, and resetting the PID toggle
    ...
#

Unconditionally resetting next_pid to 0 may cause protocol errors. The DATA toggle (PID) state should typically be preserved when aborting a transfer unless explicitly resetting the endpoint. The device mode implementation in this codebase (dcd_rp2040.c lines 144-147) preserves next_pid by setting the buffer control register with the current PID state. Consider either removing this line entirely to preserve the existing next_pid value, or only resetting it for specific endpoint types where it...

fallow birchBOT
fallow birchBOT
#

Operating System

Others

Commit SHA

41a00f498e525c3b8ec0b5aa2b2744acdad799e8

Board

multiple custom boards, esp32-s3 based and nrf52833 based

Firmware

examples/device/net_lwip_webserver

What happened ?

On the newest iOS version 26.3 and ever since the release of iOS 26, the success rate of obtaining a IP Address from the built in DHCP server is about 30%.

How to reproduce ?

Upload example to a nrf52833dk, plug into an iPad or iPhone running iOS 26 and the ip a...

fallow birchBOT
#

The problem with
speed = high
forced_speed = full
Is that all buffers sizes will be based on "high speed" settings (big)

You mean which buffer, FIFO in dfifo_host_init ?

No, you're right, I made a mistake.

I was thinking about code like:

#define CFG_TUD_NET_ENDPOINT_SIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
#define CFG_TUD_CDC_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)

But I now see that this only in the device side, and not in the host side.

fallow birchBOT
#

We should use tuh_configure() to force the phy selection e.g CFG_TUH_MAX_SPEED = FULL, but tuh_configure(use_hs_phy=1). The function dwc2_core_is_highspeed() should be rename to dwc2_core_is_highspeed_phy() and return true if we force phy selection. HCFG_FSLS_ONLY should only be set ONCE in init per manual since I think it involves HS PLL phy on/off.

Ok, that makes a lot of sense, time for a v3 patch

fallow birchBOT
#

Describe the PR
This patch allows configuring a Full-Speed USB host with DWC2 on a board wired with a High-Speed ULPI PHY

Additional context
Another week, another try. New version which re-implements #3494 after some guidance from HiFiPhile and hathach

This PR Introduce a new configuration option TUH_CFGID_PHY_SPEED which can be used to have a phy speed different than the bus speed.

For example:

static c...
fallow birchBOT
#

These are all the changes I needed to make for an XInput driver and bespoke MSC driver that supports removable media on both CBI and BOT. Because I want to use floppy drives. I may even add LUN support. The shared control endpoint had so many problems that I nearly gave up. The final piece was hcd_pause_interrupt_eps. I'm seeing massive stability improvements with this upgraded hcd. Testing error conditions by removing media while reading is how found all these edge cases that don't normally ...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

From what I can tell, latest changes in the rp2040 code fix the null pointer problems, so in theory I can now just focus on the actual issue, the race condition between the endpoint structs being cleared. I'm not sure what's the best way to keep track if the structs have all been initialized, so I just pulled out the ep->configured out of the #ifdef block it was put under so we can use it in general for host or device mode (I'm not sure if that may lead to a conflict... I don't think so? ...

fallow birchBOT
#

Operating System

MacOS

Commit SHA

41a00f498e525c3b8ec0b5aa2b2744acdad799e8

Board

NUCLEO-N657X0-Q

Firmware

  • MCU: STM32N657X0H3Q (STM32N6 family)
  • Board: NUCLEO-N657X0-Q / custom
  • STM32CubeIDE 2.0.0 / CubeMX 6.16.1
  • MIDI implementation, no FreeRTOS

What happened ?

**NOTE!! This is written by Opus 4.6, but I have reviewed it for correctness and made some edits to present my configuration more clearly. If nothing else, I hope that raising this issue will offer oth...

fallow birchBOT
#

Pull request overview

This pull request enables Full-Speed USB host mode on DWC2 hardware with High-Speed ULPI/UTMI PHY. It addresses scenarios where a board has a high-speed PHY but needs to operate the USB bus at full-speed.

Changes:

  • Introduces TUH_CFGID_DWC2 configuration ID with tuh_configure_dwc2_t structure for configuring PHY usage
  • Refactors PHY detection logic to separate PHY type from bus speed
  • Adds conditional HCFG_FSLS_ONLY bit control based on requested bus spee...
#

The PR description shows a different API than what's implemented. The description mentions TUH_CFGID_PHY_SPEED with a tusb_speed_t parameter, but the actual implementation uses TUH_CFGID_DWC2 with a tuh_configure_dwc2_t struct containing a use_hs_phy boolean field. This discrepancy should be resolved - either update the PR description to match the implementation, or adjust the implementation to match the description.

#

The femtoPHY detection logic on lines 184-187 always returns true for STM32 devices with guid >= 0x5000, ignoring the prefer_hs_phy parameter. This means users cannot force full-speed mode on these devices even if they explicitly configure use_hs_phy = false. The prefer_hs_phy check (line 190-192) should be moved before the femtoPHY check to respect user configuration.

#

For consistency with other HCD implementations (max3421 and fsdev), the configuration parameter should be cast to tuh_configure_param_t first, then the dwc2 member should be extracted. Change line 398 to:
tuh_configure_param_t const* cfg = (tuh_configure_param_t const*) cfg_param;
_tuh_cfg = cfg->dwc2;

  tuh_configure_param_t const* cfg = (tuh_configure_param_t const*) cfg_param;
  _tuh_cfg = cfg->dwc2;
fallow birchBOT
fallow birchBOT
#

Operating System

Windows 11

Commit SHA

tinyusb 0.20.0

Board

STM32U375KG custom board

Firmware

###main function
`int main(void)
{

/* USER CODE BEGIN 1 /
/
USER CODE END 1 */

/* MCU Configuration--------------------------------------------------------*/

/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();

/* USER CODE BEGIN Init /
/
USER CODE END Init */

/* Configure the system clock */
SystemClock_Config(...

fallow birchBOT
#
[hathach/tinyusb] New branch created: pr3506-followup
fallow birchBOT
#

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1eef6f4f4f

ℹ️ 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 u...

#

<sub><sub>P1 Badge</sub></sub> Gate HS FIFO sizing on selected PHY

This branch derives is_highspeed only from TUH_OPT_HIGH_SPEED and rh_init->speed, but dwc2_core_init() may already have selected a full-speed PHY (is_hs_phy == false) in the same function. In that mismatch case (e.g. no HS PHY available or HS PHY disabled via DWC2 config), dfifo_host_init() is called with is_highspeed=true and allocates HS-sized FIFOs, w...

fallow birchBOT
fallow birchBOT
#

Sorry if I don't really know what I'm talking about, but Is it really a good idea to reduce the size of the buffers if the core is able to have bigger buffers?

There is this comment in dfifo_host_init() that implies that a "small" buffer is allocated because of the core limitation:

// - ptx_largest is limited to 256 for FS since most FS core only has 1024 bytes total

But that certainly does not apply if the core is HS-capable.

#

I tried to pull the D+ line up by changing a register value using HAL_DevConnect() function in the beginning as the stm32 documentation said "USB connect / disconnect capability (controllable embedded pull-up resistor on USB_DP line)" but it did not seem to pull-up the D+ line although it did change the correct register value.

It looks like some U3 specific power/clock settings are missing. STM32 (except ancient F1 series) have built-in pull-up resistor so if the DP line is not HIGH then ...

fallow birchBOT
fallow birchBOT
#

U3's BSP is not added yet, maybe you can get some clue from U0's BSP: https://github.com/hathach/tinyusb/blob/master/hw/bsp/stm32u0/boards/stm32u083cdk/board.h https://github.com/hathach/tinyusb/blob/master/hw/bsp/stm32u0/family.c

I was able to figure out my issue with the aid of #3325 and your comment that something basic was missing. That was correct, i didn't use HAL_PWREx_EnableVddUSB() function to enable the VDDUSB supply nor did i attempt to using some other method.

I can now see...

fallow birchBOT
#

I cant tell you the exact issue, but the organisation I work for was using a nRF52840 with the NCM stack and it has also been suffering considerably.

Whether this is a TinyUSB issue or an issue on the Apple side I cant tell you. They do sometimes restrict implementations on their side. I had similar issues with the NCM stack inside Zephyr..

What I can tell you is the ECM stack seems to work well still. So if performance is no problem and you need a product quickly, temporarily switching to ...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

The function qtd_init() begins with:

static void qtd_init(dcd_qtd_t *p_qtd, void *data_ptr, uint16_t total_bytes) {
  dcd_dcache_clean_invalidate((uint32_t *)tu_align((uint32_t)data_ptr, 4), total_bytes);

4 byte aligned pointer is passed to dcd_dcache_clean_invalidate() that in turn call imxrt_dcache_clean_invalidate()

TU_ATTR_ALWAYS_INLINE static inline bool imxrt_dcache_clean_invalidate(void const* addr, uint32_t data_size) {
  const uintptr_t addr32 = (uin...
fallow birchBOT
#

Operating System

Others

Commit SHA

3af1bec1a9161ee8dec29487831f7ac7ade9e189

Board

same7xplained

Firmware

Custom SAME70 firmware.

What happened ?

i have a custom class which uses usbd_edpt_xfer to start read transfers on an endpoint.
If the usb device has already received an zlp then a call to dcd_edpt_xfer returns false which causes the call usbd_edpt_xfer to run into a TU_BREAKPOINT return false and never execute the DCD_EVENT_XFER_COMPLETE event.
This is hand...

fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: fix-cdch-ftdi-mulitple-channel
#

Pull request overview

This pull request fixes a critical bug in the FTDI multi-channel CDC host driver, corrects a function name typo, and adds comprehensive J-Link GDB Server documentation for RTT logging.

Changes:

  • Fixed FTDI multi-channel loop bug where non-zero interface numbers would skip channel assignment, causing incorrect operation for multi-channel FTDI devices
  • Corrected spelling of ftdi_proccess_set_config to ftdi_process_set_config throughout the codebase
  • Refacto...
fallow birchBOT
fallow birchBOT
#

Appreciate the activity guys. I made a couple logs/dumps using the unmodified master branch (except for TU_LOG_BUF(3, ...) debug statements in ncm_device.c causing compilation errors). And added some very simple print statements in dhserver.c.

(Un)successful connection may be a bit misleading, I mean the final result is not a network interface through which I can access the device. As a general description: it seems as though after the NCM interface is established, it is not completely fin...

fallow birchBOT
#

Summary

Implements the tud_midi_n_demux_stream_read() function proposed in #1838 — a cable-aware variant of tud_midi_n_stream_read() that returns the cable number of the data actually read.

The existing tud_midi_n_stream_read() accepts a cable_num parameter but ignores it ((void) cable_num), silently mixing data from all virtual cables into a single stream. This makes it impossible to build multi-port MIDI devices where each cable maps to a separate DIN jack or logical MIDI por...

#

Submitted a PR for this: #3514

The implementation follows the API shape proposed by @rppicomidi — tud_midi_n_demux_stream_read() reads from the RX FIFO and returns the cable number via pointer, stopping when the next packet belongs to a different cable. This lets callers loop until it returns 0 and route each cable's stream independently.

The approach mirrors what's already working on the host side (tuh_midi_stream_read()) — peek at the packet header before consuming, CIN-based byte cou...

#

Pull request overview

This PR implements a cable-aware stream read function tud_midi_n_demux_stream_read() for USB-MIDI devices, addressing issue #1838. The existing tud_midi_n_stream_read() function ignores its cable_num parameter and mixes data from all virtual cables, making it impossible to build multi-port MIDI devices where each cable maps to a separate physical MIDI port.

Changes:

  • Added tud_midi_n_demux_stream_read() that returns the cable number of data actually rea...
#

The stream->buffer is shared state used by both tud_midi_n_stream_read and tud_midi_n_demux_stream_read. If a caller uses both functions on the same interface, leftover bytes from one function could be incorrectly consumed by the other. This could lead to data corruption or incorrect cable routing. Consider documenting that these functions should not be mixed on the same interface, or add a mechanism to track which function owns the leftover data.

#

When leftover bytes exist from a previous call (stream->total > 0), the function should verify that the next packet in the FIFO matches the cable number of the leftover bytes before continuing to read more data. Currently, after returning leftover bytes, the function may read from a different cable without checking, which violates the API contract that data should be from a single cable per call. Consider peeking at the next packet's cable number after returning leftovers and stopping if it d...

#

The output parameter p_cable_num is not initialized when the function returns 0 due to no available data (when both leftover bytes don't exist and peek fails). This leaves the output parameter in an undefined state. Consider initializing p_cable_num to a sentinel value (e.g., 0xFF) at the start of the function, or setting it to a defined value before returning 0 when no data is available.


  // Initialize output cable number to a sentinel value when no data is available.
  *p_ca...
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Hmm, any idea why hil-tinyusb would fail with this PR, but passed with #5484? This should be exactly the same final diff (but against master)

usb subsystem on my VM sometime got "stuck" and/or timeout due to lots of usb attach/activity. May need to re-run or reset the whole system.

OK.

Anyway, after I did the [Merge branch 'hathach:master' into non-blocking-host-v2] two days ago, all tests passed.

wary cypress
#

Hello i need some help with Adafruit Tinyusb and Dualshock 3 usb device implementation, is this the right place to ask for help ?

fallow birchBOT
#

if resolved the issue with this fix.
is this a valid way?

src/portable/microchip/samx7x/dcd_samx7x.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/portable/microchip/samx7x/dcd_samx7x.c b/src/portable/microchip/samx7x/dcd_samx7x.c
index 51308f7a2..f23e24904 100644
--- a/src/portable/microchip/samx7x/dcd_samx7x.c
+++ b/src/portable/microchip/samx7x/dcd_samx7x.c
@@ -646,11 +646,11 @@ bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, u...
fallow birchBOT
#

It happends on my side. I'm using STH32U5 + lwip + tinyUSB as NCM device, and test:

  • Windows 10/11
  • Android 15/16
  • IOS 18/26
  • Linux 6.14

Only IOS 26 got this issue, and it can't be reproduced stably (~20% success rate)
BTW, IOS 18 is observed slower than other OS on initialization, it takes about 7~10 seconds to start the first ARP connection.

I can test more if you guys need.

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

My goal with that check was to enable the new asynchronous code with or without OS (because it is better in BOTH cases).
Unfortunately, somme platforms do not define tusb_time_millis_api() so I had to use this check to support them and get the CI green.
If tusb_time_millis_api() could be defined for all platforms, then I think this conditional code could just be removed. Unfortunately, adding the missing tusb_time_millis_api() is not something I can do.

fallow birchBOT
#

I can't reproduce the issue with cdc_dual_port example with this script (delay is only for RTT output, same without):

# cdc_dual_port example will change case on echo
def _casefold_bytes(b: bytes) -> bytes:
    return bytes((byte + 32) if 65 <= byte <= 90 else byte for byte in b)

def main():
    if len(sys.argv) != 2:
        print("No port name specified")
        exit()

    ser = serial.Serial(sys.argv[1])
    print(f"Opened port: {ser.name}")
    ser.timeout = 1
    ser.read_al...
fallow birchBOT
#

I was testing CDC example until I realized host refused to send ZLP...

Unable to reproduce with a quick echo test on webusb_serial example:

<details><summary>Test details</summary>

Patch:

diff --git a/examples/device/webusb_serial/src/main.c b/examples/device/webusb_serial/src/main.c
index 155768b76..fc8213344 100644
--- a/examples/device/webusb_serial/src/main.c
+++ b/examples/device/webusb_serial/src/main.c
@@ -111,7 +111,6 @@ static void echo_all(const uint8_t buf[], uint32...
fallow birchBOT
#

Thanks a lot for your time,
i will inspect this further and surely that would be the best case that i'm simply doing something wrong in my application.
My current implementation is working with a pool of buffer where received messages are stored.
I have a send and receive queue the problem on my side is occuring on the receive queue.
I'm taking an empty buffer of 2KiB which runs 4 512 Byte transfers. and start the transfer on this endpoint. the buffer is put into a full buffer fifo which is ...

fallow birchBOT
#

This PR adds support for the WCH CH58x series (CH582, CH583), device, host and dual role demo have been tested and confirmed working on real hardware, but there are still some things that need to be discussed/improved:

CH581: It shares the same SDK, but I have only one USB device and different flash size, and it isn't on the market yet, So there is no support for it.
CH584/CH585: Despite the similar name, their SDK is in a separate
repository with a different register layout. I haven'...

fallow birchBOT
fallow birchBOT
#

Size Difference Report

Because TinyUSB code size varies by port and configuration, the metrics below represent the averaged totals across all example builds.

Note: If there is no change, only one value is shown.

Changes >1% in size

No entries.

Changes <1% in size

No entries.

<details><summary>No changes</summary>

file .text .rodata .data .bss size % diff
audio_device.c...
fallow birchBOT
fallow birchBOT
#

perfect, thank you @ceedriic for the PR. I make some changes

  • replace CFG_TUH_TASK_USE_TIME_MILLIS_API with CFG_TUSB_OS_HAS_SCHEDULER
  • rename usbh_wait_delay to usbh_call_after_ms() and also take arg. This is useful helper, maybe used in other places as well in the future
  • merge all delay/after callback to make it easier to maintain
    I also make some other changes while doing local tests as well. Let me know what you think, or do we need to make any other improvement.
fallow birchBOT
fallow birchBOT
#

perfect, thank you @ceedriic for the PR. I make some changes

Thank you for reviewing/improving!

  • replace CFG_TUH_TASK_USE_TIME_MILLIS_API with CFG_TUSB_OS_HAS_SCHEDULER

This is the part I do not understand: I agree my option name (CFG_TUH_TASK_USE_TIME_MILLIS_API) was bad,
but if I understand the new define, you will not run the asynchronous code with a multitasking RTOS.
I only use OPT_OS_NONE at the moment, so this is fine for me, but why not running the asynchronous code wi...

fallow birchBOT
#

Operating System

Others

Commit SHA

bd1e79bc6cefbbbe981691c3a55e24cf25537301

Board

stm32f411blackpill

Firmware

any example

What happened ?

Not started after flashing

How to reproduce ?

Build and flash any example

Debug Log as txt file (LOG/CFG_TUSB_DEBUG=2)

No log. CPU freezes

Screenshots

https://github.com/hathach/tinyusb/blob/bd1e79bc6cefbbbe981691c3a55e24cf25537301/hw/bsp/stm32f4/boards/stm32f411blackpill/board.h#L92

HSE_VALUE not defined for...

fallow birchBOT
#

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

STM32F411 BlackPill board has wrong HSE Value Definition

Operating System

Others

Commit SHA

bd1e79bc6cefbbbe981691c3a55e24cf25537301

Board

stm32f411blackpill

Firmware

any example

###...

fallow birchBOT
fallow birchBOT
#

@ceedriic how's it doing on your Mac ?

Ok, I redid the tests with TinyUSB from 1 week ago, and with or without the one-liner fix here:

https://github.com/hathach/tinyusb/pull/3438/changes/fef11cd4451f0f9c6e5bf5b5f2c067a9c54b1216

I see no difference with or without this patch unfortunately. The following examples are all with the patch applied.

When I plug my fixed board board in, most of the time I get an IP address, but sometime not.

Here is when I didn't get an IP address:
...

fallow birchBOT
fallow birchBOT
#

I feel like something shady is going on, with this PR on my Windows PC and Arch laptop Nucleo-U5A5/H747-DISCO boards work very well the 1st plug or link up/down by ip command or board button.

Well, I just tried on one of my FreeBSD server and it works well there too:

ugen1.2: <Precidata SL-3011> at usbus1
ubt1 on uhub0
ubt1: <MediaTek Inc. WirelessDevice, class 239/2, rev 2.10/1.00, addr 1> on usbus0
ubt1: ubt_attach:680: could not get two interfaces
device_attach: ubt1 attac...
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

@ceedriic I revert the changes to also support non-blocking on RTOS, also rename to usbh_defer_func_ms_async() and make it a helper, though usage outside of enumeration need some kind of mutex. We will address that later if needed. Let me know if you think it looks good now ?

I took a quick look at the usbh.c change, and I think is is OK, I've just 3 comments (the only important is the first one)

  1. In the following hunk, I think the osal_queue_empty(_usbh_daq) added check inside CF...
fallow birchBOT
fallow birchBOT
#

@hathach
What do you think about the following alternative patch?

I think it's simpler and follow the rule to exit tuh_task() after we've processed some events.

diff --git a/src/host/usbh.c b/src/host/usbh.c
index a674b040e..80f8e5672 100644
--- a/src/host/usbh.c
+++ b/src/host/usbh.c
@@ -666,6 +666,7 @@ void tuh_task_ext(uint32_t timeout_ms, bool in_isr) {
         TU_LOG_USBH("USBH invoke scheduled function\r\n");
         _usbh_data.call_after.func = NULL;
         aft...
fallow birchBOT
#

Size Difference Report

Because TinyUSB code size varies by port and configuration, the metrics below represent the averaged totals across all example builds.

Note: If there is no change, only one value is shown.

Changes >1% in size

No entries.

Changes <1% in size

No entries.

<details><summary>No changes</summary>

file .text .rodata .data .bss size % diff
audio_device.c...
fallow birchBOT
#

Pull request overview

Adds TinyUSB support for WCH CH58x (CH582/CH583) by introducing a new USBFS portable layer (device + host) and a new BSP/board, and wiring the new family into dependency fetching + CI.

Changes:

  • Added CH58x MCU options (with CH582/CH583 aliases) and hooked CH58x into tusb_mcu.h configuration defaults.
  • Introduced CH58x USBFS register definitions plus new DCD/HCD implementations.
  • Added hw/bsp/ch58x (build scripts, linker script, OpenOCD config, UART debug...
#

CH58X_EP_DMA(base, ep) does not handle EP4 (which shares EP0 DMA): for ep==4 the (ep-5u) term underflows and maps to base+0x50. Since the header explicitly documents that EP4 has no DMA register, it would be safer to guard ep==4 (e.g., a separate macro/function for EP0-3 vs EP5-7, or an assertion for constant ep).

#define CH58X_EP_DMA(base, ep)   (*(volatile uint16_t *)((base) + ((ep) <= 3 ? (0x10u + (ep)*4u) : ((ep) >= 5 ? (0x54u + ((ep)-5u)*4u) : 0x10u))))
#

On NAK, the driver always schedules an immediate retry via USBH_EVENT_FUNC_CALL. For interrupt endpoints, TinyUSB’s WCH USBFS host driver treats NAK as a successful 0-byte poll (so upper layers can reschedule by interval) rather than retrying immediately. Consider matching that behavior using edpt->xfer_type to avoid a tight retry loop / high CPU usage for interrupt pipes.

        // For interrupt endpoints, treat NAK as a successful 0-byte poll so
        // that upper layers c...
#

d->xfer[ep][dir].max_size is taken directly from the endpoint descriptor. Since the driver’s endpoint buffers are fixed at 64 bytes (EP_BUF_SIZE) and EP_TLEN is 8-bit, a wMaxPacketSize > 64 would cause memcpy() in update_in()/update_out() to overflow the endpoint buffer. Please clamp max_size to EP_BUF_SIZE (and/or assert) when opening endpoints.

  uint16_t max_size = tu_edpt_packet_size(desc_ep);
  if (max_size > EP_BUF_SIZE) {
    max_size = EP_BUF_SIZE;
  }
  d->xfer[ep][dir]...
#

_current_xfer is a single global, but the comment says transfers are tracked per root port. With 2 USB controllers (rhport 0/1), concurrent activity on both ports can corrupt transfer state (rhport/dev_addr/ep_addr, NAK retry, disconnect handling). Consider making the transfer state an array indexed by rhport (and adjust _xfer_retry / NAK bookkeeping accordingly).

// One transfer state per root port (indexed by rhport).
static volatile hcd_xfer_t _current_xfer[2] = {};

static i...
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

i compared this with the current asf 4 usbhs_device driver here ist the same check as in your code and



		// Disable IRQs to have a short sequence
		// between read of EOT_STA and DMA enable
		flags = cpu_irq_save();
		if (!(udd_endpoint_dma_get_status(ep)
				& USBHS_DEVDMASTATUS_END_TR_ST)) {
			dbg_print("dmaS%x ", ep);
			udd_endpoint_dma_set_control(ep, udd_dma_ctrl);
			ptr_job->buf_cnt += next_trans;
			ptr_job->buf_load = next_trans;
			udd_enable_endpoint_dma_interrupt(ep);
	...
#

i have some further fixes where i had problems with sending zlps on in transfers very shortly after the last in transfer with a full usb transfers.
it's stated in in the asf4 that the defautl way of sending zlp packages does not work with dma so there is a implementation to force sending the zlp via normal transfers which i also added by adapting it from the asf.

 src/portable/microchip/samx7x/dcd_samx7x.c | 44 ++++++++++++++++++++++++++++--
 1 file changed, 42 insertions(+), 2 delet...
fallow birchBOT
#
[hathach/tinyusb] New branch created: samx7x_update
#

i compared this with the current asf 4 usbhs_device driver here ist the same check as in your code and

Thank you for looking at ASF4's code, as TUSB doesn't have queue depth the next transfer can't be launched until previous is finished, I see no reason why END_TR_ST is still pending when next transfer is launched.

Could you make a reproducible example (see Test Details above) as I didn't issue sending/receiving ZLP.

I've some update on https://github.com/hathach/tinyusb/pull/3519

fallow birchBOT
#

Size Difference Report

Because TinyUSB code size varies by port and configuration, the metrics below represent the averaged totals across all example builds.

Note: If there is no change, only one value is shown.

Changes >1% in size

No entries.

Changes <1% in size

No entries.

<details><summary>No changes</summary>

file .text .rodata .data .bss size % diff
audio_device.c...
fallow birchBOT
#

The write+read path in tuh_max3421_spi_xfer_api() hardcodes spi0 instead of MAX3421_SPI. The read-only and write-only branches are fine — just this one got missed.

Causes a hang on any board using spi1 for the MAX3421E (e.g. Feather RP2040 USB Host with a MAX3421E FeatherWing on SPI1). spi_write_read_blocking() blocks forever since spi0 was never initialized.

One-line fix, consistent with the other two branches right above it.

fallow birchBOT
#

use tud_network_link_state to send additional interface up event to host ?

This also appears to have not made any difference, just to check this is what you meant:

during net setup we create a callback that sets the tud_network_link_state?

static void usb_net_link_up_cb(void *ctx)
{
    tud_network_link_state(0, true);
}

// ... in setup

tinyusb_net_config_t _net_config = {
    .on_recv_callback = netif_recv_callback,
    .on_init_callback = usb_net_link_up_cb,
};
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: fix-ci-hil
#

Pull request overview

Updates the HIL test configuration for the ESP32-P4 board to stop passing --force to esptool, aligning flashing behavior with the intended default tooling configuration.

Changes:

  • Removed --force from the esptool argument string for the espressif_p4_function_ev HIL board entry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.You can also share your feedback on Copilot code review. [Take the survey...

#

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1b40a1efdd

ℹ️ 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 u...

#

<sub><sub>P1 Badge</sub></sub> Restore ESP32-P4 force-flash flag

This change removes --force from the ESP32-P4 flasher arguments, but this board entry is still explicitly documented as requiring that flag for v0.1 silicon ("comment": "use --force for ESP32-P4 v0.1"), and flash_esptool() passes these args directly into the esptool invocation before running HIL tests (test/hil/hil_test.py). On runners that still use ESP32-P4 v0...

#
[hathach/tinyusb] New branch created: add-claude-github-actions-1772622485004
#

🤖 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...

#

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8479c08679

ℹ️ 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 u...

#

<sub><sub>P2 Badge</sub></sub> Guard review workflow when OAuth secret is absent

This job unconditionally uses secrets.CLAUDE_CODE_OAUTH_TOKEN on pull_request events, but fork-origin PR runs do not receive repository secrets, so external-contributor PRs will fail on open/synchronize/reopen due to a missing token. Add a same-repo PR guard (or redesign with a safe pull_request_target flow) so fork PRs don't produce persistent fai...

#

<sub><sub>P1 Badge</sub></sub> Restrict Claude invocation to trusted users

In repositories where non-members can open issues or comments, this condition only checks for @claude and does not verify actor trust (author_association/write access), so any external user can trigger paid Claude runs by posting a mention. Add an explicit permission gate (for example OWNER/MEMBER/COLLABORATOR) before calling the action to prevent untruste...

#

The job can be triggered by any issue/PR commenter who types "@claude". Because this workflow uses a repository secret (CLAUDE_CODE_OAUTH_TOKEN) and requests an OIDC token (id-token: write), an untrusted external user could trigger the job and potentially prompt the agent to exfiltrate secrets. Add an explicit trust gate (e.g., allow only OWNER/MEMBER/COLLABORATOR author_association, or restrict to specific usernames/teams) before running the Claude step, and consider removing the issues tr...

#

pull-requests and issues permissions are set to read. If the code-review plugin is expected to leave review comments or PR feedback, it will likely need pull-requests: write (and possibly issues: write for issue comments). Please confirm the required permissions for anthropics/claude-code-action in this mode and tighten to the minimum set that still allows it to post results.

      pull-requests: write
#

The workflow permissions are read-only for pull-requests and issues. If the intent is for Claude to reply with comments / reviews (as described in the PR), it will likely be blocked by token permissions. Either adjust the workflow permissions to allow the intended write operations (principle of least privilege, e.g. issues/pull-requests write only if needed) or update the PR description to match a read-only integration.

#

Pull request overview

Adds GitHub Actions workflows to integrate the Anthropic “Claude Code” agent into the repo, enabling automated responses to @claude mentions and an optional automated PR code review run.

Changes:

  • Added a Claude Code workflow that triggers on issue/PR comment/review events when @claude is present.
  • Added a Claude Code Review workflow that runs a code-review plugin automatically on PR events.

Reviewed changes

Copilot reviewed 2 out of 2 changed fi...

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: faa89ef3b6

ℹ️ 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 u...

#

<sub><sub>P1 Badge</sub></sub> Preserve board-specific HSE overrides for STM32F4 boards

Adding the family include path while deleting per-board stm32f4xx_hal_conf.h files makes Make builds for boards like feather_stm32f405, pyboardv11, and stm32f401blackpill fall back to the shared default HSE_VALUE=8000000, but their removed board configs previously set HSE_VALUE to 12 MHz or 25 MHz; since board_clock_init() computes `...

#

Pull request overview

This PR updates the STM32F4 BSP build to use the shared hw/bsp/stm32f4/stm32f4xx_hal_conf.h (instead of per-board copies) and sets the correct external oscillator (HSE_VALUE) for the STM32F411 Black Pill via build flags.

Changes:

  • Add hw/bsp/stm32f4 to the include path so the shared stm32f4xx_hal_conf.h is found.
  • Remove multiple per-board stm32f4xx_hal_conf.h files in favor of the shared config.
  • Define HSE_VALUE=25000000 for stm32f411blackpill...
#

By adding the family include path and removing per-board stm32f4xx_hal_conf.h files, HSE_VALUE now falls back to the shared default (8 MHz) unless the board build explicitly overrides it. Several boards removed in this PR previously set non-default HSE values (e.g. stm32f401blackpill and pyboardv11/feather_stm32f405), and currently don’t define HSE_VALUE in their board.mk/board.cmake, which will make their PLLM calculation (HSE_VALUE/1000000) incorrect. Please add the approp...

fallow birchBOT
fallow birchBOT
#

Operating System

MacOS

Commit SHA

TinyUSB 0.20.1 (as in esp32-arduino-lib-builder); note to confirm on upstream.

Board

ESP32S3-USB-OTG (host mode)

Firmware

  • Stack: TinyUSB host only (device_info-style enumeration).
  • Build: esp32-arduino-lib-builder with sketch calling tuh_descriptor_get_device(), tuh_task_ext(), etc., and DWC2 as the host controller.

Reproducible with any firmware that uses the DWC2 host driver and performs control transfers (e.g. get d...

#

EP size is set on endpoint open:
https://github.com/hathach/tinyusb/blob/cd7bbba1ddc1ee8f6b4f896c98a5ec452b0953d6/src/portable/synopsys/dwc2/hcd_dwc2.c#L532

Instead of patching the division it's better to know why hcchar_bm->ep_size is not set correctly.

Cause: ep_size can be 0 when the default control endpoint (EP0) is used with an invalid or unset max packet size (e.g. bMaxPacketSize0 from the first 8 bytes of the device descriptor is 0 or not yet valid). Dividing by ep_size then trig...

fallow birchBOT
#

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

DWC2 host divide-by-zero when connecting HID device (esp32-arduino)

Operating System

MacOS

Commit SHA

TinyUSB 0.20.1 (as in esp32-arduino-lib-builder); note to confirm on upstream.

Board

ESP32S3-USB-OTG (host mode)

Firmware

  • **S...
#
[hathach/tinyusb] New branch created: claude/issue-3525-20260305-1404
#

Operating System

Windows 11

Commit SHA

ae3864d21f2b206ae41d1d424b96fea0ac7e0dc6

Board

Arduino Portenta H7 Lite

Firmware

examples/host/device_info

Using ZephyrRTOS

  • Native Zephyr USB stack is disabled

What happened ?

Attempting to bring up the FS PHY on a Portenta H7 Lite (STM32H747XI) leads to an infinite loop in reset_core() similar to #2074

How to reproduce ?

  1. Attempt to enable the Fullspeed PHY as a host device

Debug Log as txt file (LOG/CFG_...

#

The comment says "Disable schedules", but the code only clears command_bm.run_stop. If the intent is to disable the periodic/async schedules as well, also clear command_bm.periodic_enable and command_bm.async_enable (some controllers require these cleared to fully stop schedule processing).

  regs->command_bm.periodic_enable = 0;
  regs->command_bm.async_enable    = 0;
  regs->command_bm.run_stop        = 0;
#

Setting PORTSC1 with '=' will overwrite all other PORTSC1 bits (including any W1C/status/config bits that should be preserved). This previously used a read-modify-write (|=) and was also conditional on rhport==1 (per the comment that RHPORT1 is FS-only). Use a RMW update (e.g., set just FORCE_FULL_SPEED) and consider keeping the rhport==1 constraint if only that port needs forcing.

  if (rhport == 1) {
    hcd_reg->PORTSC1 |= PORTSC1_FORCE_FULL_SPEED;
  }
fallow birchBOT
#
[hathach/tinyusb] New branch created: improve-iar-warnings
fallow birchBOT
#

Pull request overview

Adds IAR-specific warning flags to the CMake build and adjusts code patterns to eliminate IAR warning diagnostics (notably around volatile access ordering and unreachable code).

Changes:

  • Add IAR warning/error flags in the common CMake family configuration.
  • Refactor FIFO helpers to avoid IAR volatile access ordering warnings without compiler pragmas.
  • Remove unreachable returns / tidy control-flow and casts to resolve compiler warnings across examples and DF...
#

Applying --warnings_are_errors plus globally suppressing specific diagnostics at the family level can make downstream/3rd-party code builds fail unexpectedly while also hiding those suppressed warning classes across the entire target. Consider making --warnings_are_errors opt-in (e.g., via a CMake option) and scoping --diag_suppress to only the specific targets/files that need it, with a short comment explaining what Pa089/Pe236 represent and why suppression is safe.

# Con...
#

lun is explicitly marked unused but is still used in the tud_msc_set_sense(lun, ...) call. This is harmless but misleading for readers and can mask real unused-parameter situations during refactors. Drop the (void) lun; line (keep (void) scsi_cmd; if you intend to ignore the command), or alternatively keep using scsi_cmd[0] in a minimal switch to justify the parameter.


#

The code now intentionally snapshots volatile indices into locals to avoid IAR's Pa082 (unspecified ordering of volatile accesses). Since the previous pragma-based explanation was removed, add a brief comment near these snapshots (or once above the related inline helpers) explaining that this pattern is required to enforce a defined volatile read order for IAR and similar compilers.

#

lun is explicitly marked unused but is still used in the tud_msc_set_sense(lun, ...) call. This is harmless but misleading for readers and can mask real unused-parameter situations during refactors. Drop the (void) lun; line (keep (void) scsi_cmd; if you intend to ignore the command), or alternatively keep using scsi_cmd[0] in a minimal switch to justify the parameter.

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

@P-R-O-C-H-Y
I don't have the issue testing device_info example with 06a4c6d7190ef83f76b2a65496f2a48a54a8c134 and ESP-IDF v5.5.2 on both ESP32-P4-Function-EV-Board and ESP32-S3-DevKitC-1

cd tinyusb\examples\host\device_info\

idf.py -G Ninja -DBOARD=espressif_s3_devkitc build
idf.py -G Ninja -DBOARD=espressif_s3_devkitc -p COM8 flash
idf.py -G Ninja -DBOARD=espressif_s3_devkitc -p COM8 monitor

idf.py -G Ninja -DBOARD=espressif_p4_function_ev -B build_p4 build
idf.py -G Ninja -DBOAR...
fallow birchBOT
#

Pull request overview

Refreshes the SAMX7X device controller driver and SAME7X BSP configuration to restore board builds and make DMA usage optional (with corresponding cache maintenance helpers), while also removing the prior DMA+FIFO transfer path.

Changes:

  • Add CFG_TUD_SAMX7X_DMA_ENABLE (default off) and gate endpoint DMA support on it.
  • Introduce SAMX7X D-cache maintenance helpers/regions and default-enable D-cache when SAMX7X DMA is enabled.
  • Update SAME7X CMake board confi...
#

In the DMA OUT completion path, cache invalidation is done with xfer->total_len instead of the actual received byte count (count). Invalidating beyond the bytes actually written by DMA can unnecessarily discard cache lines (and could clobber dirty-but-unrelated data in the tail of the buffer). Use the computed count (rounded/aligned as needed) for the invalidate size.

    dcd_dcache_invalidate(xfer->buffer, count);
fallow birchBOT
fallow birchBOT
#

tuh_xfer_t xfer; is only partially initialized before being passed down; config_get_hub_descriptor() ends up queuing an async control transfer and the stack will persist fields like user_data. Please zero-initialize the struct (e.g. tuh_xfer_t xfer = {0};) and explicitly set any fields you rely on, to avoid leaking uninitialized stack data into callbacks/state.

#

In the MTT skip path, the driver claims drv_len but returns before initializing per-interface state like p_hub->itf_num / p_hub->ep_in. hub_set_config() later asserts itf_num == p_hub->itf_num, so this can fail unless some later descriptor happens to set it. Consider at least setting p_hub->itf_num = itf_desc->bInterfaceNumber before returning (and ensure the hub state is still cleared on disconnect even if no endpoint ever gets opened).

    p_hub->mtt = true;
    p_...
#

Pull request overview

This PR adds a new NXP IP3516 USB Host Controller Driver (HCD) (EHCI-like) and updates NXP BSP integration to use newer, split-out MCUX repositories (core + device packs), along with some example updates to support host-mode memory placement constraints.

Changes:

  • Add a new IP3516 HCD implementation under src/portable/nxp/lpc_ip3516/.
  • Update dependency fetching (tools/get_deps.py) and multiple NXP BSP make/cmake files to use mcuxsdk-core + `mcux-devices...
#

MCUX_DIR/SDK_DIR are set with a leading /, but later LD_FILE is built directly from $(SDK_DIR) without $(TOP). This will resolve to an absolute path like /hw/mcu/... and break builds outside a filesystem that has that root path. Drop the leading / (make them repo-relative like hw/mcu/...) or consistently prefix all uses with $(TOP).

MCUX_DIR = hw/mcu/nxp/mcuxsdk-core
SDK_DIR = hw/mcu/nxp/mcux-devices-lpc
fallow birchBOT
#
[hathach/tinyusb] New branch created: hil-mtp
#

subprocess.run(..., shell=True) is unnecessary here and executes a shell with an interpolated uid. This is avoidable and can lead to command-injection risk if uid ever contains unexpected characters (it comes from board['uid'] / JSON). Prefer passing an argv list (no shell) and keep stdout/stderr suppressed; also consider check=False explicitly since unmount may legitimately fail when nothing is mounted.

        subprocess.run(
            ["gio", "mount", "-u", f"mt...
#

Pull request overview

Enables the Hardware-in-the-Loop (HIL) MTP test path by improving MTP device open/enum handling and adding the MTP example back into the default device test list.

Changes:

  • Extend pymtp imports to access libmtp ctypes types and configure LIBMTP_Open_Raw_Device signature before use.
  • Proactively unmount any gvfs/gio MTP mount that can block libmtp access during enumeration.
  • Enable running the device/mtp HIL test by adding it to device_tests.

...

#

The comment says pymtp doesn't define the LIBMTP_Open_Raw_Device return type, but the in-repo test/hil/pymtp.py already sets LIBMTP_Open_Raw_Device.restype and .argtypes at module load time. This is misleading for future maintainers; either remove this block as redundant, or adjust the comment/guard the assignment to only apply when the attributes aren't already configured.

    # Ensure proper ctypes signature for LIBMTP_Open_Raw_Device in case it was not set by pymtp
...
fallow birchBOT
fallow birchBOT
#

The Hierarchy and Memory Layout
Standard Interface Descriptor (VC)
Video Control Header Descriptor: Contains wTotalLength.
Video Control Camera Terminal Descriptor
Video Control Output Terminal Descriptor
Standard Endpoint Descriptor: The physical interrupt pipe (Length = 7 bytes).
Class-Specific VC Interrupt Endpoint Descriptor: Additional endpoint metadata (Length = 5 bytes).

_end_of_control_descriptor is Output Terminal Descriptor End
the "end" should +7 for _find_desc se...

#

Pull request overview

Fixes UVC VideoControl (VC) interface parsing when vc->std.bNumEndpoints != 0 by ensuring the endpoint descriptor is included in the search window derived from wTotalLength.

Changes:

  • Extends the computed “end of VC descriptor” pointer so _find_desc(..., TUSB_DESC_ENDPOINT) can find the notification endpoint descriptor.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

#

Extending end by a hard-coded 7 bytes inside _open_vc_itf() fixes the endpoint search, but the same endpoint lookup pattern in _close_vc_itf() still uses _end_of_control_descriptor() without extending the search range and will return end/assert when bNumEndpoints != 0. Consider introducing a helper that computes the true end of the VC interface including the notification endpoint descriptor(s) (only when bNumEndpoints is non-zero), and use it in both open/close so behavior stays...

#

_end_of_control_descriptor() returns a void const*, so _end_of_control_descriptor(cur) + 7 performs pointer arithmetic on void*. With this repo’s -Wall -Werror flags (GCC/Clang), this typically triggers -Wpointer-arith and will fail the build. Cast to uint8_t const* (or similar) before adding the offset (and ideally use sizeof(tusb_desc_endpoint_t) instead of the literal).

  end = (uint8_t const *) _end_of_control_descriptor(cur) + sizeof(tusb_desc_endpoint_t);
fallow birchBOT
#

Operating System

Linux

Commit SHA

115581a6bfd54a3696670a4db3c5eaa471360b33

Board

rp2350

Firmware

RP6502-RIA? I don't understand what goes here.

What happened ?

Data Seq Error, lockups, and other panics.

How to reproduce ?

Do anything interesting with an RP2350 in host mode with a hub.

Debug Log as txt file (LOG/CFG_TUSB_DEBUG=2)

Literally millions of lines of logs were processed to find these bugs. They were discarded as I fixed the bugs.,

Screens...

fallow birchBOT
#

relevent register values prior to initing USB:

J-Link>mem32 0x40080000, 20 40080000 = 03010000 00100000 00000000 00001410 40080010 = 80000000 14000020 00000000 00000000 40080020 = 00000000 00000400 04000400 00080400 40080030 = 00000000 00000000 00000000 00002300 40080040 = 4F54330A 00000000 229FE190 03B8D2E8 40080050 = E3F00030 00000000 0C000010 03B80400 40080060 = 00000000 00000000 00000000 00000000 40080070 = 00000000 00000000 00000000 00000000

Register values prior to calling reset c...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Fix integer divide-by-zero crash in DWC2 host controller driver during USB host enumeration.

In cal_packet_count(), ep_size could be 0 if the device descriptor returns bMaxPacketSize0 = 0 (due to buggy device or DMA cache coherency issues on ESP32), causing an integer divide-by-zero crash.

Two-layer fix:

  • In hcd_edpt_open(): validate ep_size != 0 before allocating the endpoint slot, returning false to let enumeration handle the error gracefully.
  • In cal_packet_count(): g...
#

perfect, I update to open mtt interface in 1 hub_open(). Note that this enable the MTT for hub, but our hcd driver may not take this into account

Nice ! Since we don't do bandwidth allocation for periodic split transfers (I think only supported by EHCI/IP3516), I hope enable MTT can reduce periodic transfer failure chance when too many devices connected.

fallow birchBOT
fallow birchBOT
#

Description:
ep_ctrl_mask() in the ChipIdea HS DCD driver applies an AND mask incorrectly for the IN direction:
value &= (and_mask << 16u)
zeros the entire lower 16 bits (OUT/RX half) of the shared ENDPTCTRL register instead of preserving them.

This is triggered when two endpoints share the same endpoint number but use opposite directions (e.g. EP1 OUT for speaker, EP1 IN for mic). Calling ep_ctrl_clear() on the IN direction, which happens during dcd_edpt_iso_activate(), wipes th...

fallow birchBOT
#

Size Difference Report

Because TinyUSB code size varies by port and configuration, the metrics below represent the averaged totals across all example builds.

Note: If there is no change, only one value is shown.

Changes >1% in size

No entries.

Changes <1% in size

No entries.

<details><summary>No changes</summary>

| file | .text | .rodata | .data | .bss | size | % diff |
| :------------------ | ---------------: | ------: | ----: | ---: | -----: | ---...

fallow birchBOT
#

In hwff_push_n() and hwff_pull_n(), the HWFIFO_ADDR_NEXT_N call after processing the linear part of a wrap-around read/write used the data byte count (lin_even) as the address stride increment. On STM32 FSDEV PMA, data_stride=2 and addr_stride=4, so the pointer must advance by (lin_even / data_stride) * addr_stride bytes, not lin_even bytes.

Fixes: 74e59e433 ("fix hwfifo pull/push n with address stride > 0")

fallow birchBOT
#

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 08c9df52f6

ℹ️ 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 u...

#

<sub><sub>P2 Badge</sub></sub> Pin membrowse comment action to a released version

Referencing membrowse/membrowse-action/comment-action@main makes this workflow non-deterministic, because upstream pushes to main can change or break PR commenting here without any change in this repository. This is a regression from the previous stable tag and can unexpectedly impact CI reliability (and trust) for every pull request; use a version ...

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

Pull request overview

This PR refactors how the USB host stack stores/copies device descriptor fields and adds validation to prevent invalid max packet sizes (including zero) from propagating into endpoint open/transfer paths (addressing issue #3525’s divide-by-zero scenario).

Changes:

  • Introduces a packed desc_device_noheader_t and stores device descriptor fields in usbh_device_t as a single struct, using memcpy() for copying to/from tusb_desc_device_t.
  • Adds validation fo...
#

The static assert message "size is not correct" is vague; since this struct is tightly coupled to the USB device descriptor layout, a more specific message (e.g., mentioning it must match the device descriptor size without the 2-byte header) would make build failures easier to diagnose.

TU_VERIFY_STATIC( sizeof(desc_device_noheader_t) == 16u,
                  "desc_device_noheader_t must be 16 bytes (USB device descriptor size minus 2-byte header)");
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.

Improve PR #3538 by removing division (aeabi_idiv on cortex-m0) in related functions.


✨ Let Copilot coding agent [set things up for you](https://github.com/hathach/tinyusb/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure instructions for this repository as documented in [Best practices for Copilot coding%...

fallow birchBOT
#

Pull request overview

This PR refactors the HWFIFO wrap-around pointer advancement logic in tusb_fifo.c to avoid runtime division in hot paths (important for Cortex-M0 where division may pull in __aeabi_*div), while aiming to preserve the corrected behavior introduced in PR #3538.

Changes:

  • Added a small inline helper to convert lin_even byte counts into HWFIFO address-advance values using shift-based stride handling.
  • Updated wrapped-path pointer advancement in `hwff_push_n(...
#

lin_even_to_addr_advance() returns uint16_t and multiplies by CFG_TUSB_FIFO_HWFIFO_ADDR_STRIDE. For common configs like lin_even up to ~0x8000 and ADDR_STRIDE=4, the computed advance can exceed 65535 (e.g. 0x20000) and will be truncated, causing incorrect hwfifo pointer advancement on wrap paths. Consider using a wider type (uintptr_t/uint32_t) for data_units and the return value (and avoid the cast) so the pointer addition in HWFIFO_ADDR_NEXT_N() gets the full advance.
``...

fallow birchBOT
#

The _close_vc_itf and _open_vc_itf have extend end when bNumEndpoints > 0.
current _end_of_control_descriptor return is also extend end
Revision: 3e22de0a4782d6062959aec27e5304f1b4d4a557
static inline void const* _end_of_control_descriptor(void const *desc)
{
tusb_desc_vc_itf_t const *vc = (tusb_desc_vc_itf_t const *)desc;
uint8_t const end = (uint8_t const)desc + vc->std.bLength
+ tu_le16toh(vc->ctl.wTotalLength);
if (vc->std.bNumEndpoints) {
end ...

fallow birchBOT
#

The _close_vc_itf and _open_vc_itf have extend end when bNumEndpoints > 0.
current _end_of_control_descriptor return is also extend end
Revision: 3e22de0
static inline void const* _end_of_control_descriptor(void const *desc)
{
tusb_desc_vc_itf_t const *vc = (tusb_desc_vc_itf_t const *)desc;
uint8_t const end = (uint8_t const)desc + vc->std.bLength

  • tu_le16toh(vc->ctl.wTotalLength);
    if (vc->std.bNumEndpoints) {
    end += sizeof(tusb_desc_endpoint_t); // standard EP descriptor
    end += 5;...
fallow birchBOT
fallow birchBOT
#

Operating System

Windows 11

Commit SHA

7ddf63151d840d804ea16f6f27ad18619df3ec66

Board

Custom CH32L103

Firmware

https://github.com/203Null/tinyusb/tree/l103 but without the https://github.com/203Null/tinyusb/commit/49e8cf1ffc2a04abd03565ca80a5e5f1a8c1add7

What happened ?

I try to bring up CH32L103 support with USB MIDI host. During set up https://github.com/203Null/tinyusb/blob/7ddf63151d840d804ea16f6f27ad18619df3ec66/src/class/midi/midi_host.c#L329 is bring faulte...

fallow birchBOT
#

Pull request overview

This PR updates the GitHub Actions automation for MemBrowse to post PR comments using a configurable message template, removing the previous artifact-based flow and centralizing the comment formatting in a Jinja template.

Changes:

  • Simplifies the membrowse-comment workflow to call the MemBrowse comment action with api_key, commit, and a comment_template.
  • Adds a new .github/membrowse_pr_message.j2 template to render a “top targets by memory change” M...
#

This step will run even when the triggering Build workflow concluded failure/timed_out (job-level if only excludes cancelled). In those cases Membrowse data may not exist for workflow_run.head_sha, so the action may fail or post a misleading “no changes” comment. Consider gating the job/step on github.event.workflow_run.conclusion == 'success' (or explicitly handling missing data).

#

When total_old is 0, this template sets pct to 0 (and therefore abs_pct to 0) but later renders the % column as N/A. That means targets with a 0→N size change will be sorted as if they had no change and may never appear in the “Top 10” list. Consider giving abs_pct a non-zero sort key for total_old == 0 (e.g., sort by absolute delta in that case) so these changes are still surfaced.

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Thanks to @ceedriic we did tests on iPad (10th gen) iOS 26.3 and MBP M1 OS 26.3.1.

It looks really like a Apple's NCM or USB stack bug, when it doesn't work the host device desactive the interface (set alternate settings 0) just after the activation:

OK:
<img width="1633" height="507" alt="Image" src="https://github.com/user-attachments/assets/aa8e6eaa-9113-4fe7-a4d6-427f58cd917b" />

KO:
<img width="1633" height="509" alt="Image" src="https://github.com/user-attachments/assets/810...

fallow birchBOT
fallow birchBOT
#

I am trying to port tinyusb to the BL702 chip. The CDC function works normally.

However, the MSC gets stuck after a clear stall operation, and a bus reset occurs after 20 seconds.

I understand that according to the specification, when Hi > Di, the endpoint needs to stall ep_in. But when I remove this stall, everything works correctly.

Additionally, I have looked into how CherryUSB handles this. They are more lenient and do not check for Hi > Di.

At ...

#

After modification:

static bool proc_stage_status(mscd_interface_t *p_msc) {
  uint8_t rhport = p_msc->rhport;
  // skip status if epin is currently stalled, will do it when received Clear Stall request
  if (!usbd_edpt_stalled(rhport, p_msc->ep_in)) {
    TU_ASSERT(send_csw(p_msc));
  }


  #if TU_CHECK_MCU(OPT_MCU_CXD56)
  // WORKAROUND: cxd56 has its own nuttx usb stack which does not forward Set/ClearFeature(Endpoint) to DCD.
  // There is no way for us to know when EP is un-stall, t...
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: migrate-mcux-rt
#

<sub><sub>P1 Badge</sub></sub> Keep metro_m7_1011_sd board definitions available

Removing the entire metro_m7_1011_sd board directory breaks any build that still targets that board name (including the existing CMake preset metro_m7_1011_sd in hw/bsp/BoardPresets.json): CMake now errors at hw/bsp/imxrt/family.cmake include-time because boards/metro_m7_1011_sd/board.cmake no longer exists. I verified this by running `cmake -D...

#

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 21af7e4464

ℹ️ 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 u...

#

family.mk unconditionally includes $(BOARD_PATH)/board.mk, but the PR deletes hw/bsp/imxrt/boards/metro_m7_1011_sd/board.mk while leaving the metro_m7_1011_sd board directory present (and still referenced by hw/bsp/BoardPresets.json). Building with BOARD=metro_m7_1011_sd will now fail at makefile include time. Either remove the board entirely from board discovery/presets (and delete the directory), or restore a valid board.mk for it.

#

Pull request overview

This PR migrates the i.MX RT BSP to NXP’s newer split repositories (mcuxsdk-core + mcux-devices-rt) and updates the build integration accordingly.

Changes:

  • Update dependency fetching to pull mcux-devices-rt for i.MX RT and switch i.MX RT to CMSIS_6.
  • Refactor i.MX RT Make/CMake family files to use mcuxsdk-core drivers + mcux-devices-rt device sources, with new XIP directory selection.
  • Adjust CMake helper targets’ IDE folder grouping (FOLDER prop...
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

@HiFiPhile should we reset to NOTIFICATION_SPEED instead of NOTIFICATION_CONNECTED. I got claude suggestion below

  NCM spec ch.7.1 mandates that CONNECTION_SPEED_CHANGE must be sent before NETWORK_CONNECTION. Both notifications are required, in that order.

  All major implementations confirm this:

  ┌───────────────────────┬────────────────────────────┬─────────────────────────────────────────────────────────────────────────────┐
  │    Implementation     │   On alt=1 reactivation  ...
fallow birchBOT
#
[hathach/tinyusb] New branch created: remove-cdc-configure
#

<sub><sub>P2 Badge</sub></sub> Restore CDC TX persistence settings in host_info example

Removing the tud_cdc_configure() call here changes this example’s runtime behavior from persistent/non-overwritable TX to the new defaults (CFG_TUD_CDC_TX_PERSISTENT=0, CFG_TUD_CDC_TX_OVERWRITABLE_IF_NOT_CONNECTED=1), so CDC output produced before the terminal is fully connected (e.g. tuh_mount_cb()/tuh_umount_cb() writes) can be dropped...

#

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cd60008e89

ℹ️ 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 u...

#

Pull request overview

This PR removes the runtime CDC device driver configuration API (tud_cdc_configure()) and replaces it with compile-time configuration macros to reduce firmware footprint. It also updates contributor guidance for collecting code size metrics and bumps several GitHub Actions workflow dependencies.

Changes:

  • Remove tud_cdc_configure() / tud_cdc_configure_t and replace the behavior with new CFG_TUD_CDC_* compile-time macros.
  • Update CDC device implementati...
#

Removing the public tud_cdc_configure() API is a breaking change for downstream users and the repository documentation still references it (e.g., docs/info/changelog.rst mentions tud_cdc_configure() / tud_cdc_configure_fifo()). Consider either (1) keeping a deprecated compatibility shim (e.g., inline function/typedef guarded by a macro that maps to these new CFG_TUD_CDC_* options or triggers a clear compile-time error with migration guidance) or (2) updating the documentation/change...

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

Pull request overview

Updates the BSP and dependency plumbing to add CH32F20X MCU family support, refactor/modernize the Renesas RX BSP (including CMake support and additional flash tooling), and migrate/rename Kinetis K32L support to use updated NXP mcux-devices sources.

Changes:

  • Add CH32F20X family CMake support, update example skip lists accordingly, and adjust WCH build configuration for USBHS.
  • Refactor Renesas RX BSP by introducing a shared family.c/family.cmake, conso...
#

These IR_/IER_/IEN_ compile definitions duplicate the same macros already defined in board.h. This can lead to macro redefinition warnings and makes it unclear which source of truth is intended. Prefer defining them in one place (either only via compile definitions for global visibility, or in the header guarded with #ifndef), and keep the other in sync/removed.

#

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9eb6372b66

ℹ️ 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 u...

#

<sub><sub>P1 Badge</sub></sub> Drop nonexistent kinetis_k32l from CI family matrix

Adding kinetis_k32l here makes the build matrix include a family that has no BSP directory in this commit (the old hw/bsp/kinetis_k32l2 files were removed, and there is no hw/bsp/kinetis_k32l/boards replacement), so the workflow path in .github/workflows/build.yml/build_util.yml still invokes python tools/build.py ... ${{ matrix.arg }} and ...

fallow birchBOT
#

Size Difference Report

Because TinyUSB code size varies by port and configuration, the metrics below represent the averaged totals across all example builds.

Note: If there is no change, only one value is shown.

Changes >1% in size

No entries.

Changes <1% in size

No entries.

<details><summary>No changes</summary>

file .text .rodata .data .bss size % diff
audio_device.c...
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: readme_fix
fallow birchBOT
#

This line is a grid-table row separator for a multi-row cell, but it contains the text "ESP32". In reStructuredText grid tables, separator lines must be composed only of "+", "-", and (for spanned columns) "|" plus spaces; having text here makes the table malformed and can prevent correct rendering. Replace this with a proper multi-row separator (blank continuation for the Manufacturer column), or restructure the Espressif/ESP32 section using a valid subcolumn layout if you want to keep an "E...

#

Pull request overview

Updates documentation processing and README content to improve reStructuredText rendering (notably table formatting) in the project’s docs/README pipeline.

Changes:

  • Read README.rst and write README_processed.rst using explicit UTF-8 encoding during Sphinx build preprocessing.
  • Adjust README device-class text and refine entries in the “Supported CPUs” grid table to improve correctness/rendering.

Reviewed changes

Copilot reviewed 2 out of 2 changed fi...