Okay I am sorry for that I reviewed the code with a friend and he pointed out the xss vulnerability. I tried to fix it but I don't have access to a mcu at the moment. You can test it again now or I will ping you again some time next week after I have tested it myself.
#tinyusb
1 messages ยท Page 9 of 1
Okay I am sorry for that. I reviewed the code with a friend and he pointed out the xss vulnerability. I tried to fix it but I don't have access to a mcu at the moment. You can test it again now or I will ping you again some time next week after I have tested it myself.
Now it's much better, the sending works :)
I've some issues with auto-reconnect, it didn't reconnect when I replug the device, instead it reconnects when I manually click disconnect. To keep it simple I think you can re...
let keep this open, the github is smart enough to mark this as merged when the other PR is merged (using commit sha).
Typo in comment: "massages" should be "messages".
// "vendor-specific" commands are handled similar to normal messages, except that the MsgID is changed to "vendor-specific".
Using sizeof(usbtmc_state.transfer_size_remaining) (the size of the variable type) instead of the actual packet length (packetLen) will miscount bytes sent; this should be usbtmc_state.transfer_size_sent += packetLen;.
usbtmc_state.transfer_size_sent += packetLen;
Pull Request Overview
Add support for USBTMC vendor-specific command messages by treating them similarly to standard device-dependent messages, with an internal flag to switch the response MsgID.
- Handle
VENDOR_SPECIFIC_MSG_OUTandVENDOR_SPECIFIC_INin the transfer callback - Introduce
usbtmcVendorSpecificRequestedflag to track vendor-specific requests - Update
tud_usbtmc_transmit_dev_msg_datato choose the correct MsgID for vendor-specific responses
Comments suppressed due...
Awesome thanks for the feedback.
- [ ] Add indicator which technology is used for the underlying connection
- [ ] Fix auto reconnect when device is replugged. (I only tested resetting the mcu)
I actually really like the auto reconnect feature, that's one of the reasons I rewrote the whole app instead of using some other app.
Then you should stop ever freeing the pointer to the driver and write it first thing in the device init. The current code leads to null pointer access.
Pending transfer complete event shouldn't be fired after USB reset, if that's the case it should be fixed in DCD layer.
defective host just sends transfers without a proper setup
USB is not UART, data transfer won't happen if endpoint is not setup explicitly.
awesome, glad it works! thanks for improving and merging ๐๐ผ
awesome, glad it works! thanks for improving and merging ๐๐ผ
thank you for the awesome PR. I should have done this earlier :)
yeah, I made its own PR here and fix an issue with hid spec https://github.com/hathach/tinyusb/pull/3165 . trying to get it into more usage, but need to spend more time getting/setting thing up :)
Pull Request Overview
Adds handling for vendor-specific USBTMC messages by tracking when they occur and adjusting the message IDs in both transmit and transfer callbacks.
- Introduce a new flag to mark vendor-specific command transfers
- Update
tud_usbtmc_transmit_dev_msg_datato set the correct MsgID based on the new flag - Extend the transfer callback (
usbtmcd_xfer_cb) to processVENDOR_SPECIFIC_MSG_OUTandVENDOR_SPECIFIC_INmessages
Comments suppressed due to low confi...
The PR description indicates vendor-specific responses should use the DEV_DEP_MSG_IN MsgID rather than VENDOR_SPECIFIC_IN. Please verify and correct the MsgID constant used here.
(void) usbtmcVendorSpecificRequested; // Vendor-specific requests are handled as DEV_DEP_MSG_IN
hdr->header.MsgID = USBTMC_MSGID_DEV_DEP_MSG_IN;
[nitpick] Consider using a bool type for usbtmcVendorSpecificRequested to match termCharRequested and improve semantic clarity.
tu_static bool usbtmcVendorSpecificRequested = false;
Describe the PR
When CFG_TUH_CDC_CH34X is not true, SERIAL_DRIVER_CH34X is not defined and compilation fails. This fixes the issue by making the check conditional on CFG_TUH_CDC_CH34X.
Additional context
Pull Request Overview
This PR fixes a compilation failure when CFG_TUH_CDC_CH34X is disabled by making the SERIAL_DRIVER_CH34X check conditional on that macro.
- Wraps the serial-driver check in
#if CFG_TUH_CDC_CH34X/#elseto avoid referencing undefined symbols - Ensures the same logic path when CH34X support is turned off
The field name serial_drid appears to be misspelled; it should likely be serial_driver to match the struct definition.
if (p_cdc->serial_driver != SERIAL_DRIVER_CH34X) {
can you chagne it to
#if CFG_TUH_CDC_CH34X
if (p_cdc->serial_drid != SERIAL_DRIVER_CH34X)
#endif
{
Oh yeah, that's definitely better. Done
Operating System
MacOS
Commit SHA
8a78804ff91271fb32008288777fad9fe73f5735
Board
Raspberry Pi Pico
Firmware
examples/device/uac2_headset/src/main.c
What happened ?
Running the uac2_headset example on a RaspberryโฏPiโฏPico crashes when built from commits dated after Julyโฏ8.
The last commit that worked correctly is 1a41445b17e11db9ab58a39488e4b0d9d85f0fd1; failures start from commit a56f55c10bea2ce0d38de6a04edae41e6c814b9f onward.
How to reproduce ?
1a41445b17...
Personally I don't use RPi MCU, somebody familiar with RP2040 please have a look if any special handling should be done doing transfer from ISR.
Flashing the ch32v307 image onto CH32V305 works. Tested with USBHS
Hi all,
I can't get a Pico 2 W to work with any of the Adafruit_TinyUSB examples on Arduino
I can them to work with other MCUs i.e. QT Py 2040, XIAO 2040
My Pico W 2 works fine - it can print to Serial normally
It's just the Dual-Role examples don't have anything printed to Serial
Are there any pitfalls I'm not aware of? Starting to tear my hair out
I've double checked I'm using the right D+ D- Pins!
Thanks for any help
Related area
Avoids memcpy with calling write functions
Hardware specification
Probably applicable to all hardware
Is your feature request related to a problem?
Streaming on webusb vendor endpoint as fast as possible
The speed jumped from 10MB/s to 26.5MB/s with the modification below.
Hardware details: CH32V305, USBHS, CFG_TUD_VENDOR_EPSIZE=512
Describe the solution you'd like
Within this piece of code:
https://github.com/hathach/tinyusb/blob/8a78804ff91271fb32008288...
Fix #3177
This PR contains small but critical fixes for the RP2040, and theโฏuac2_headset example.
src/portable/raspberrypi/rp2040/dcd_rp2040.cโ suppress unnecessary resets on ISO endpoints
Skipsโฏhw_endpoint_reset_transfer()when the endpoint is isochronous. Prevents redundant EP resets that could stall ISO streams and trigger theCan't continue xfer on inactive ep 81panic.examples/device/uac2_headset/src/main.cโ always transmit a silent frame when no OUT data arr...
Describe the PR
Fix __HAL_RCC_USB_OTG_FS_CLK_ENABLE
Iโve reverted the uac2_headset playbackโnoise changes and kept only the fix that eliminates the isochronousโtransfer panic on RP2040 USB Audio. The noise issue appears to occur only on macOSโฏ15.5 and could not be reproduced on Windowsโฏ11โฏHome; Iโll open a separate issue for that.
This issue appears to affect isochronous transfers on the RP2040 in general, not just theโฏuac2_headset example. Attached are the results of a example/device run using isochronous on the RP2040.
| example | master |
fix/uac2-rp2040-panic |
|---|---|---|
| audio_test | panicCan't continue xfer on inactive ep %02X |
OK ... |
Describe the PR
This pull request handles complex audio/MIDI devices (usually guitar effects processors) where the audio streaming interface follows the audio control interface, which is then followed by a MIDI interface.
Additional context
If applicable, add any other context about the PR and/or screenshots here.
Sadly, @doughadfield's device did not enumerate for a different issue. However, I the pull request I submitted should fix compatibility with other guitar effects units that support full speed USB host devices.
hil failed due to os/driver issue when lots of usb device enumerated at the same time. I tried to tweak the timeout but it is not reliable. I have updated the hil to only re-run failed boards, you can re-run it and it could succeed with less boards.
do you mind addig the bsp for ch32v305 for testing ?
Describe the PR
For #3179
Additional context
https://github.com/wuxx/nanoCH32V305
There is another PR #3163 with much better support for AT32 than this, so I'm closing this.
@HiFiPhile Maybe you can test it again.
Web serial is working quite well but web usb is very difficult to use. The documentation is non existent and the errors are not documented at all. I gave it my best shot but I don't think I can further improve web usb robustness. Sometimes web usb breaks beyond repair and the user must reload the website. It is what it is. :man_shrugging:
Never connect web usb from multiple tabs to the same device. Chrome just doesn't like that.
In RFC 2131, the destination of DHCP OFFER/ACK is defined in Section 4.1. Fix the destination error by following the rule of RFC 2131. TODO: We implement all rule but the last one. ARP table is required to associate client's macaddr. Currently, fallback to broadcast.
Describe the PR
A clear and concise description of what this PR solve.
Additional context
If applicable, add any other context about the PR and/or screenshots here.
Operating System
Others
Commit SHA
e1509ba0bb5d4aa64c6ec471ea408c2ab43a027a
Board
Pico 2 W
Firmware
See https://github.com/pekkanikander/pico-tinyusb-msc-panic
for a minimal reliable reproduction, with a proper README explaining the root cause.
This seems to be related to https://github.com/hathach/tinyusb/issues/2322 and https://github.com/hathach/tinyusb/issues/1232.
However, this is a reliable way to reproduce the bug always and explains the root cause.
What h...
Base explanation from the README in https://github.com/pekkanikander/pico-tinyusb-msc-panic/tree/main:
The specific bug occurs with TinyUSB's MSC implementation when handling MSC SCSI READ10 commands on the RP2040 or RP2350. The root cause appears to be how the SCSI layer handles so-called short reads (which the device should not do) and that the RP2040 port does not support packet queueing.
TinyUSB schedules the next IN transfer optimistically before the previous one has a chance to comple...
Pull Request Overview
This PR fixes handling of complex audio/MIDI devices where a MIDI interface appears after an audio streaming interface, specifically addressing issue #3159. The changes enable proper parsing of device descriptors for guitar effects processors and similar devices that have audio control, audio streaming, and MIDI interfaces in sequence.
- Adds logic to skip over audio streaming interfaces when searching for MIDI interfaces
- Updates comments to explain the expected i...
The comment suggests this is an expected condition but TU_VERIFY will cause failure. Either this should be an error condition with a proper error message, or the logic should handle this case gracefully.
if (p_desc >= p_end) {
TU_LOG_DRV("Error: MIDI interface descriptor not found within max_len. Possible Audio Streaming interface issue.\r\n");
return false;
}
The while loop condition is overly complex and difficult to read. Consider breaking this into multiple conditions or extracting helper functions for better readability.
bool within_bounds = (p_desc < p_end) && (tu_desc_next(p_desc) <= p_end);
bool not_midi_streaming = (desc_itf->bDescriptorType != TUSB_DESC_INTERFACE ||
(desc_itf->bInterfaceClass == TUSB_CLASS_AUDIO &&
desc_itf->bInterfaceSubClass != AUDIO_...
The condition tu_desc_next(p_desc) <= p_end could cause buffer overread. If p_desc is at the boundary, tu_desc_next(p_desc) may read beyond the buffer to determine the next descriptor position.
while ((p_desc < p_end) &&
((p_desc + ((tusb_desc_interface_t const *)p_desc)->bLength) <= p_end) && // Ensure descriptor length is within bounds
(tu_desc_next(p_desc) <= p_end) &&
(desc_itf->bDescriptorType != TUSB_DESC_INTERFACE ||
...
are we skipping until we got TUSB_DESC_INTERFACE/TUSB_DESC_INTERFACE/AUDIO_SUBCLASS_MIDI_STREAMING , can we just use
!(desc_itf->bDescriptorType == TUSB_DESC_INTERFACE && desc_itf->bInterfaceClass == TUSB_CLASS_AUDIO && desc_itf->bInterfaceSubClass == AUDIO_SUBCLASS_MIDI_STREAMING)
Pull Request Overview
This PR adds support for the nanoCH32V305 board to the TinyUSB library. The changes involve creating a new board configuration and consolidating the CH32V30x family under a unified directory structure.
- Creates board configuration files for the nanoCH32V305 development board
- Updates family code to handle optional button configurations
- Consolidates CH32V307 into the broader CH32V30x family structure
Reviewed Changes
Copilot reviewed 6 out of 20 changed fil...
The LED_CLOCK_EN macro enables GPIOC clock but LED_PORT is defined as GPIOA. This mismatch will prevent the LED from working correctly. Change RCC_APB2Periph_GPIOC to RCC_APB2Periph_GPIOA.
#define LED_CLOCK_EN() RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE)
Pull Request Overview
This PR implements RFC 2131 Section 4.1 compliant destination address selection for DHCP OFFER and DHCP ACK messages. The change fixes incorrect destination addressing in the DHCP server implementation by replacing hardcoded broadcast addresses with proper destination selection logic.
- Adds
get_dhcp_destination()function that implements RFC 2131 destination selection rules - Updates DHCP OFFER and DHCP ACK message handling to use RFC-compliant destination addres...
[nitpick] Variable declaration should be moved closer to its first use or initialized at declaration to follow best practices for variable scope management.
[nitpick] The code after the goto label has inconsistent indentation. It should align with the function's indentation level rather than being double-indented.
ip_addr_set_ip4_u32(&dest_addr,
ip4_addr_get_u32(netif_ip4_addr(netif)) | ~ip4_addr_get_u32(netif_ip4_netmask(netif)));
return dest_addr;
[nitpick] The goto label should be indented consistently with the surrounding code. Labels are typically placed at the beginning of the line or indented to match the function scope.
dest_broadcast:
ip_addr_set_ip4_u32(&dest_addr,
ip4_addr_get_u32(netif_ip4_addr(netif)) | ~ip4_addr_get_u32(netif_ip4_netmask(netif)));
return dest_addr;
Describe the PR
Adding support for CH58x chips, currently tested on CH585.
Additional context
A new USB device driver has been introduced for CH58x, rather than reusing the ch32_usbfs driver.
While the core USB controller logic remains mostly similar to CH32, several key differences prevented a easy and clean reuse of the ch32_usbfs driver:
1.Register address layout and bitfield definitions differ significantly.
2.Endpoint control logic has been revised, now RX...
perfect, thank you. I update the linker and give board.mk/cmake to define flash/ram size since v305 has less flash/ram than v307
UVC Bulk mode has definitely issues with Linux, confirmed also by Espressif. I've tried with a Vanilla Linux 6.14 kernel on x86 and it fails with bulk but works fine with isochronous.
Now minimal BSP are added. Note that this MCU have a quirk, the 4th endpoint does not support DMA and auto toggle, so special logic is needed, which is absent now. So examples that require >3 endpoints will fail, like cdc_msc.
[hathach/tinyusb] New branch created: at32
Describe the PR
since https://github.com/hathach/tinyusb/pull/3163 deny write access for contributor, this PR is used instead.
Pull Request Overview
This PR adds support for AT32 microcontrollers (MCUs) from ArteryTek to the TinyUSB stack. This appears to be a continuation of a previous effort due to access restrictions on a previous PR.
Key changes include:
- Addition of 7 new AT32 MCU variants (AT32F403A_407, AT32F413, AT32F415, AT32F423, AT32F425, AT32F435_437, AT32F402_405)
- MCU-specific configuration files, drivers, and board support packages (BSP)
- Hardware abstraction layer implementations for USB inter...
Magic numbers are used for register addresses and bit operations. Consider defining named constants or using the proper register definitions from the AT32 HAL to improve code readability and maintainability.
*(int *)(FSDEV_REG_BASE + USB_CTRL_OFFSET) |= USB_PHY_DISABLE_BIT;
*(int *)(FSDEV_PMA_BASE + USB_CFG_OFFSET) |= USB_PHY_DISABLE_BIT;
Magic numbers are used for register addresses and bit operations. Consider defining named constants or using the proper register definitions from the AT32 HAL to improve code readability and maintainability.
*(int *)(FSDEV_REG_BASE + FSDEV_CTRL_OFFSET) |= FSDEV_PHY_DISABLE;
*(int *)(FSDEV_REG_BASE + FSDEV_CFG_OFFSET) |= FSDEV_PHY_DISABLE;
Magic numbers are used for register addresses and bit operations. Consider defining named constants or using the proper register definitions from the AT32 HAL to improve code readability and maintainability.
*(int*)(USB_OTGFS1_GCCFG) |= VBUS_SENSING_ENABLE_BIT;
#elif BOARD_TUD_RHPORT == 1
*(int*)(USB_OTGFS2_GCCFG) |= VBUS_SENSING_ENABLE_BIT;
#endif
#endif
#ifdef BOARD_TUH_RHPORT
#if BOARD_TUH_RHPORT == 0
*(int*)...
Magic numbers are used for register addresses and bit operations. Consider defining named constants or using the proper register definitions from the AT32 HAL to improve code readability and maintainability.
*(int *)(FSDEV_REG_BASE + FSDEV_CTRL_OFFSET) &= ~FSDEV_PHY_DISABLE;
*(int *)(FSDEV_PMA_BASE + FSDEV_CTRL_OFFSET) &= ~FSDEV_PHY_DISABLE;
The constant 12 for UUID length should be defined as a named constant to improve code maintainability and clarify its purpose.
uint8_t const len = UUID_LENGTH;
We are skipping all descriptors that are not interface class, and we are skipping all audio interface class descriptors that are not MIDI streaming. If we encounter a different interface class, we break out of the loop and give up. The proposed change will not break out of the loop if, for example, the audio streaming descriptors are followed by a Mass Storage Class interface descriptor.
Pull Request Overview
This PR provides a complete rewrite of the web serial example website, implementing a modern web interface for debugging serial communications through WebUSB and WebSerial APIs. The new implementation significantly enhances the user experience with professional styling, improved functionality, and better user interaction patterns.
Key changes include:
- Complete UI redesign with modern styling, dark mode support, and responsive layout
- Enhanced serial communication...
There's a typo in the property name. It should be this._port.writable.getWriter() instead of port.writeable.getWriter(). The variable port is undefined in this context, and writeable should be writable.
this._writer = this._port.writable.getWriter();
The CSV generation is vulnerable to CSV injection and doesn't properly escape quotes within the text. The entry.text could contain double quotes that would break the CSV format. Consider using a proper CSV library or escaping quotes by doubling them: entry.text.replace(/"/g, '""').
let sanitizedText = entry.text.replace(/"/g, '""').replace(/[\r\n]+$/, '');
let line = new Date(entry.time).toISOString() + ',"' + sanitizedText + '"';
The .scrollbox selector is duplicated for dark mode styling. This rule appears at line 252 and again at line 291. Consider consolidating these rules or ensuring they serve different purposes.
Using toISOString() in a filename will include colons (:) which are invalid characters in Windows filenames. Consider using a format like toISOString().replace(/:/g, '-') or a simpler date format to ensure cross-platform compatibility.
const filename = new Date().toISOString().replace(/:/g, '-') + '_tinyusb_received_serial_data.csv';
thank you @Yveaux ! I did add TinyUSB not as library as it should allow to use its hardware abstraction. Using it as an external library now i run into exactly this issue
bsp/*not been build as it is neither part of my project nor part of TinyUSB/src.#include "bsp/board_api.h" // can not be found from within my project, therefor board_init() not available which means board is not set up. #include "tusb.h" //------------- prototypes -------------// static void...
Related area
USB Host detection
Hardware specification
RP2040
Is your feature request related to a problem?
I am trying to enumerate the device using the arduino Dual Role device_info example. Here is the descriptor info that I pulled off using a computer:
Information for device FT232R USB UART (VID=0x0403 PID=0x6001):
------------------------------
Connection Information:
------------------------------
Device current bus speed: FullSpeed
Device supports USB 1.1 specifi...
@makermelissa what is your setup, I think this should be already supported. If you are using Arduino IDE, please try DualRole/CDC/serial_host_bridge, you can jumper wire tx <-> rx on the ftdi and that would echo back anything you type in arduino monitor. Let me know if it does not work for you, I will pull out a similar hw to test with and/or update tinyusb (core/arduino lib) if needed.
awesome, thank you for making PR for full at32 support. There are quite a bit of changes needed to get pass ci build as well as adding cmake build support, however I couldn't push to your fork's branch to update the PR. I have make my own PR based on this PR here https://github.com/hathach/tinyusb/pull/3191 .
PS: I am only able to test and confirm tinyusb work with an f403a (purple), however, the f423 (black) board does not work/start at all. Though it is probably clock/hw issue I guess. ...
[hathach/tinyusb] New branch created: at32-doc
Describe the PR
add at32 to README.rst, rename at32 board to lower case, correct name to match mcu, add meta data
Pull Request Overview
This PR updates documentation and metadata for AT32 microcontroller support in TinyUSB, adding manufacturer information and board details for Artery chips.
- Adds metadata comments with manufacturer and board information to AT32 family and board header files
- Updates documentation files to include AT32 boards in reference tables
- Corrects formatting and organization in the boards documentation
Reviewed Changes
Copilot reviewed 18 out of 33 changed files in t...
The manufacturer name is misspelled. It should be 'Artery' instead of 'Atery'.
manufacturer: Artery
The manufacturer name is misspelled. It should be 'Artery' instead of 'Atery'.
manufacturer: Artery
The manufacturer name is misspelled. It should be 'Artery' instead of 'Atery'.
manufacturer: Artery
The manufacturer name is misspelled. It should be 'Artery' instead of 'Atery'.
manufacturer: Artery
The manufacturer name is misspelled. It should be 'Artery' instead of 'Atery'.
manufacturer: Artery
[hathach/tinyusb] New branch created: update-inquiry2
Pull Request Overview
This pull request adds a bufsize parameter to the tud_msc_inquiry2_cb() function throughout the codebase. The parameter appears to indicate the available buffer size for the inquiry response, allowing implementations to respect buffer boundaries when constructing responses.
- Added
bufsizeparameter totud_msc_inquiry2_cb()function signature - Updated function declaration in header file and all implementations across examples and tests
- Modified the functi...
Missing semicolon after variable declaration. This should be (void) bufsize; to match the pattern used in other files.
(void) bufsize;
ah right, sorry, I was staying up late.
great, thank you. I just add tu_desc_in_bounds() since it appear more and more in class driver.
perfect, thank you. It look much nicer. I will update my gh-pages and landing page to use this as follow up PR. To be honest, I was always want to make the webusb more visual than serial bridge e.g adding items to control the on-board LED (on/off or blinky time) and displaying the button state. Is there any chance that you have the time to do that, for command we can simple do led=on/off/200 (for blinking interval), and button state can be reported from device with button=0/1 (need a bit of...
Mhh. I actually want to update the design a bit first. I will leave the core logic as is.
I will work on it during the next two-three weeks.
About webusb extra features:
Depending on how quickly you want this done I can work on it for sure. It would probably take a few months. I have to try to really tell if I find it interesting enough.
Ps:
Maybe you could help me out with one of my tinyusb issues. Maybe we can hop on a call together if you are comfortable with that. We can exchange...
But feel free to merge/use this as is. I can just create a follow up pr. Also if you want I can cleanup the git commits too.
thank you, that is ok, we are all busy. I can find more help from chatgpt when I got time to revisist this webusb later. This PR is all good.
hmm, I don't see why the changes could fix the issue in #3177, I have reproduced this with pico running uac2_headset under Linux. It looks like the host/device driver does indeed attempt to queue EP 01 again before the first one complete. Though there is a set interface in between, maybe we can reset it there.
USBD Setup Received 01 0B 02 00 01 00 00 00 ...
[hathach/tinyusb] New branch created: fix-audio-typo
Operating System
Windows 11
Commit SHA
87d9e05efa951d6e1b1c63cbb7f4261be96741e1
Board
Custom AT32F405 board
Firmware
Unfortunately, I don't have the evaluation board for AT32F405. The custom firmware I used is available here. Basically, the firmware follows the same setup as AT32F405's [family.c](https://github.com/hat...
Operating System
Linux
Commit SHA
87d9e05efa951d6e1b1c63cbb7f4261be96741e1
Board
nanoCH32V305
Firmware
CH32V305RBT6_pure_vendor_specific.zip
What happened ?
Summary
When connecting a CH32V305-based USB device using TinyUSB to an Android host, the enumeration process:
Takes abnormally long (โ8โ10 seconds)
Fails to show Manufacturer and Product Name in system...
The assert error message is clear enough. See cdc_dual_ports example for how to support both full and high speed.
Success.
Thank team for the hard work.
we can use #ifdef AT32F405ABCD to add this (like stm32), though I currently not familiar with artery mcu yet. If you could you make an PR for that. Otherwise you can use CFG_TUD_MAX_SPEED = OPT_MODE_HIGH_SPEED
Describe the PR
Fix #3198 by defining TUP_RHPORT_HIGHSPEED when the MCU is a variant of AT32F405xx.
Pull Request Overview
This PR fixes a missing USB High Speed definition for AT32F405xx MCU variants by adding the TUP_RHPORT_HIGHSPEED macro definition.
- Adds conditional definition of
TUP_RHPORT_HIGHSPEEDfor specific AT32F405xx variants that have on-chip HS PHY - Uses preprocessor checks to identify the exact MCU variants that support USB High Speed
[hathach/tinyusb] New review comment on pull request #3200: Fix AT32F405xx missing USB HS definition
The comment 'Port0: FS, Port1: HS' should be more descriptive about what these ports represent and how they relate to the value '1' being assigned to TUP_RHPORT_HIGHSPEED.
#define TUP_RHPORT_HIGHSPEED 1 // This MCU has two USB ports: Port0 (Full-Speed, FS) and Port1 (High-Speed, HS). Setting TUP_RHPORT_HIGHSPEED to 1 indicates that Port1 is the high-speed port.
Pull request submitted. As for the dwc2 register, since I don't have UART to get the debug log, I printed out manually using my own printf function. Hopefully, I got it correctly:
guid, gsnpsid, ghwcfg1, ghwcfg2, ghwcfg3, ghwcfg4
0x00000000, 0x4F54400A, 0x00000000, 0x229FDDD0, 0x03F006E8, 0x1FF0A020
I ran the following code after tusb_init to print them out:
volatile uint32_t const *p =
(volatile uint32_t const *)&DWC2_REG(BOARD_TUD_RHPORT)->guid;
log_printf("guid, gsnps...
thank you for the update, just to confirm this is for the HS port right, since the f405 seems to have 2 usb ports. If possible, would you mind run the code again for the FS port as well so we can have the full chip detail
yeah, I agree, but we need to do this in the portable way, since not all mcu support this. E.g DMA only mcu require data must be at leat 32/64 byte aligned and need to be placed in specific SRAM section. I have solution in mind, just need some time to write it down.
[hathach/tinyusb] New branch created: fix-rp2-audio-iso-transfer
reset state before notify stack. since new audio driver can execute xfer_is()
a correct PR is at https://github.com/hathach/tinyusb/pull/3203, the reason is audio driver is not handle xfer complete in isr() and therefore we need to reset the xfer state in dcd before notify the stack.
a correct PR is at https://github.com/hathach/tinyusb/pull/3203, the reason is audio driver is not handle xfer complete in isr() and therefore we need to reset the xfer state in dcd before notify the stack.
Unfortunately, my custom board doesn't have a USB FS port, and my printf function happens to rely on the HID interface (Teensy's hid_listen), so I cannot print out the register right now. However, my AT32F405 evaluation board is on the way to me, so once I have it, I post the values here.
no problems, but if you use jlink you can use rtt to log, it is 10x faster with swd clock https://docs.tinyusb.org/en/latest/reference/getting_started.html#logger than uart. You would need to use JLinkRTTClient or viewer to see the log. Which is what I normally use since it less affect the timing of everything
Operating System
MacOS
Commit SHA
f6bec1073ea56ae4ab8a6cb3b313a92a5c37f745
Board
Custom IMXRT1176
Firmware
Config and descriptor files: https://gist.github.com/bear24rw/6b1f76b6c22043c945f154244fd6e8c6
CFG_TUSB_MCU=OPT_MCU_MIMXRT1XXX
BOARD_TUD_RHPORT=1
What happened ?
Trying to integrate tinyusb into a custom board but I'm getting what looks to be an underflow (reported value equals UINT16 - 512). My config and descriptors are basically stock. The only ...
I have also tried a msc-only test and that totally works as expected so it's something specific with CDC.
working msc descriptor file: https://gist.github.com/bear24rw/8725e5bc80e088ba727f14434a85a48d
False alarm, I had tud_cdc_write_char inside fputc which must have been doing something funk with tinyusb logging back into itself. Everythings working fine :)
I recently had an issue where I couldn't store large files when I was using RP2040 to test mtp docking with littlefs, I saved the file handle via the LFS_TYPE_USERATTR attribute of the littlefs file. At the moment it is normal when reading and writing small files. But when I write to a relatively large file (368k), I have the problem that the transfer timeout cannot be completed. Can you help with that? Thank you. Here are the logs I scraped.
Hi @diancity025, thank you for reporting....
This is what I got for USB FS:
guid, gsnpsid, ghwcfg1, ghwcfg2, ghwcfg3, ghwcfg4
0x00002000, 0x4F54400A, 0x00000000, 0x228FDD00, 0x020004E8, 0x1FF0A020
I'll give that a try. Setup is just a feather rp2040 with usb host using arduino.
[hathach/tinyusb] New branch created: update-at32f405-phywidth-sel
Pull Request Overview
This PR updates the DWC2 USB driver to add support for the AT32F405 microcontroller variants (both FS and HS configurations) and refactors the PHY width selection logic for better maintainability.
Key changes:
- Adds AT32F405 FS and HS register configurations to the device database
- Consolidates PHY width determination logic into a single variable-based approach
- Updates documentation table to include the new AT32F405 variants
Reviewed Changes
Copilot review...
The comment refers to 'at32f402_405' but the condition checks 'OPT_MCU_AT32F402_405'. Consider updating the comment to match the macro name for consistency: 'AT32F402_405 does not support 16-bit'.
if (CFG_TUSB_MCU != OPT_MCU_AT32F402_405 && // OPT_MCU_AT32F402_405 does not support 16-bit
thank you, based on your info I have update the dwc2 info file and also update the phy width selection as well https://github.com/hathach/tinyusb/pull/3206
re-opened (previously auto closed by github)
@makermelissa ok, I will pull out the hw to test and post updat here.
Can you test ps4 device with the stock host/cdc_msc_hid (configured to use pio) to see if that works or not
Should I test against latest 'master' branch? I will give it a try this afternoon and let you know.
you should only try https://github.com/sekigon-gonnoc/Pico-PIO-USB/pull/186, make sure you test with the stock example hid_controller as well.
Related area
ohci, cache
Hardware specification
ohci, TI AM1808
Is your feature request related to a problem?
Hi, I am currently contributing to the Pybricks project to port MicroPython to the Lego Mindstorms EV3. This is built around a TI Sitara AM1808 SoC. We run our own bare-metal code without Linux on this chip.
As part of this effort, we need a USB host stack for the OHCI controller, and we were hoping to use TinyUSB. However, the exist...
Operating System
Linux
Commit SHA
Latest TinyUSB main branch (issue affects all versions using STM32 CMSIS dependencies)
Board
STM32L432KC (custom board) - affects all STM32L4 boards using HSI16 clock
Firmware
USB Audio Class 2.0 (UAC2.0) interface. 48kHz sample rate audio capture from ADC with real-time USB streaming. Uses HSI16 internal oscillator as system clock source.
What happened ?
Outdated STM32 CMSIS device headers (`6ca7312fa6a5a460b5a5a63d66da527fdd8359...
Fix STM32L4 GPIOD clock enable for variants without GPIOD like the STM32L432.
Yes this worked @hathach ! We can successfully enumerate DS4 devices, I've tested 3 dongles and everything works correctly now. Thank you, confirmed fixed!
Describe the PR
Port the board from #2839 to upstream
Additional context
https://github.com/WeActStudio/WeActStudio.BlackPill
Pull Request Overview
This PR adds support for the WeAct Studio BlackPill AT32F403ACGx board to the TinyUSB library, porting the board configuration from a previous pull request (#2839).
- Adds new board configuration files for the WeAct BlackPill
- Refactors button handling to support board-specific pull resistor configurations
- Updates existing AT_START_F403A board configuration to use the new button abstraction
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this ...
The BUTTON_STATE_ACTIVE change from 0 to 1 appears inconsistent with the BUTTON_PULL configuration. With GPIO_PULL_DOWN, the button should read 1 when pressed (active high), but this creates a breaking change for existing AT_START_F403A board behavior without clear justification.
The board name in the metadata comment shows 'AT32F403ACGx' but should be 'AT32F403ACGu7' to match the MCU_VARIANT defined in the build files.
name: WeAct Studio BlackPill AT32F403ACGu7
don't have the board to test, not sure if it works, best guess based on: https://github.com/RT-Thread-Studio/sdk-bsp-at32f403a-at-start/blob/main/documents/AT_START_F403A_V1.2_SCH.pdf
I have the AT32F415 regs dumped here also:
'AT32F415': [0x00001000, 0x4F54400A, 0x00000000, 0x228DCD00, 0x020004E8, 0x0F],
I apologize, this version actually does not even work on our TinyUSB. My git submodule update didn't pull in the refs so we were still running the old version.
Operating System
Windows 11
Commit SHA
version 0.18.0 bundled by pico
Board
RP2040 custom board
Firmware
full code example is available here: https://github.com/mdhosale/tinyUSBv18bugRP2040
this code is from a larger project but was tested and verified before uploading.
I am using a custom descriptor to get 2-channel out from USB - but from what I can tell it aligns with the format of the 1 and 4 channel descriptor embedded in the API
What happened ?
UAC2 and CD...
What is adportaudio_start ? It doesn't like an error emit by Windows.
The latest master have some RP2040 audio fixes.
Thank you for your reply...
What is adportaudio_start ? It doesn't like an error emit by Windows.
apologes - I am testing the audio in Max by Cyling74 - this is the error it provided when thw audio froze.
Your log is hard to read, please use usbtreeview and look error from device manager.
device manager reports the device is working properly
Device USB\VID_CAFE&PID_4011&MI_00\7&332144be&1&0000 was configured.
Driver Name: usbaudio2.inf
Driver Package ID: usbaudio2.inf_amd64_2390f0bffa...
verfied that I am on the latest master, but no luck
Lastest master have some fundamental changes to audio class, especially transfers occurs in ISR now.
Please start with one of the example and adapt to your needs, your code is a little too old.
If device manager shows Ok then it looks like some audio specific control request didn't goes well, you can use Wireshark or other capture tools to check the bad request.
Thank you for you quick responses. - I think that's where I am struggling - I noticed the updated doc that added the
void USB0_IRQHandler(void) {
tusb_int_handler(0, true);
}
but I haven't found an example that describes how to implement this on a rp2040. In the example files, as far as I can tell, there isn't any indication of that being implemented. Sorry if I am missing something and thank you again for your help...
Thank you for you quick responses. - I think that's where I am struggling - I noticed the updated doc that added the
void USB0_IRQHandler(void) { tusb_int_handler(0, true); }but I haven't found an example that describes how to implement this on a rp2040. In the example files, as far as I can tell, there isn't any indication of that being implemented. Sorry if I am missing something and thank you again for your help...
Personally I only use industrially proven M...
Operating System
Windows 11
Commit SHA
None
Board
ESp32-S3
Firmware
I'm using: "espressif/esp_tinyusb^1.7.6~1"
From: https://components.espressif.com/components/espressif/esp_tinyusb/versions/1.7.6~1/changelog?language=en
What happened ?
Hello friends,
I'm using VSCode + ESP-IDF v5.5.
I want to create a USB device that functions as USB CDC and USB HID.
I have a function that looks like this:
`CommunicationUSBClass.Initialize("CompanyName", "ProductName", SerialN...
OKay thanks- then it sounds like I am using the API correctly? If it was an issue of depcrecated code then why would it work on Mac and not Windows?
I've no idea how Max by Cyling74 works and the meaning of its error message.
I think the easiest way is build and test 4ch_mic example. Your code has some issues such as set a buffer size of only 1x endpoint size and queue 2 silent frames on streaming start.
For future MAX usb host support
Pull Request Overview
This PR adds support for two new Espressif MCU variants (ESP32-C5 and ESP32-C61) to the TinyUSB library to enable future MAX USB host support. The changes define new MCU option constants and include them in the existing MCU compatibility check.
- Added MCU option definitions for ESP32-C5 (908) and ESP32-C61 (909)
- Updated MCU compatibility check to include the new ESP32 variants
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request a...
[nitpick] The MCU list is becoming quite long and may be difficult to maintain. Consider grouping the ESP32-C series MCUs or using a range-based check to improve readability and maintainability.
#elif TU_CHECK_MCU(OPT_MCU_ESP32, OPT_MCU_ESP32H2, OPT_MCU_ESP32C_SERIES)
Operating System
Others
Commit SHA
5fb3c09963bca362e535788e289d4b3518da5973
Board
n/a
Firmware
n/a
What happened ?
Checking with a static analysis tool, I noticed that _tu_fifo_peek() in src/common/tusb_fifo.c has an overflow check that sets a new value for cnt, but that value isn't used by any of the code in the rest of the function. I don't kn...
This pull request adds the functionality for the stm32l496ZG nucleo board. USB has been tested with all example code.
Increased the GPIO pin speeds for USB on the STM32L4 family.
Describe the PR
Adding Full official HID Consumer Usage Page codes.
Additional context
If applicable, add any other context about the PR and/or screenshots here.
Spec: Section 15.
Operating System
Others
Commit SHA
esp-idf v5.5
Board
esp32-p4
Firmware
examples/host/cdc_msc_hid
What happened ?
After updating ESP-IDF from 5.4.0 to 5.5, an error occure after TinyUSB initialization: assertion of check_dwc2 failed.
Before the update, the USB works fine.
How to reproduce ?
Here is my usb_init():
bool usb_init(void)
{
// Configure USB PHY
usb_phy_config_t phy_conf = {
.controller = USB_PHY_CTRL_OTG,
.target = USB_PHY...
Hi @dhugoexe,
could you change .target = USB_PHY_TARGET_INT, to .target = USB_PHY_TARGET_UTMI and try again?
Thanks you so much it work !
Here is the tusb_config.h file:
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Sof...
This PR solves the compatibility issues with USB device/class in WCH CH32V20x USBFS Host function.
Patch 522a34ee28bcee6674ccd91973cb87869be98909
Inserting a small delay for LowSpeed devices before executing transfer. Communication problems were occurred in some LowSpeed devices behind USB Hub.
Patch a3bb7a90b3478f43d448443140b68c3473331f93
Improve retry strategy on NAK response. Without this patch, MassStorage class device works but CDC class device doesn't. In this patch, re...
The STM32N6570-DK board specific files are added, and the "Supported Boards" list is updated.
"examples/device/cdc_dual_ports" example was running on the board successfully with the limitation described below.
There is a feature/bug:
The example should be built with DEBUG=1 and without logs strongly (make BOARD=stm32n6570dk DEBUG=1 all), otherwise it does not work.
make BOARD=stm32n6570dk DEBUG=1 LOG=2 all
or
make BOARD=stm32n6570dk LOG=2 all
leads to the following log and the b...
Sorry but in Patch a3bb7a90b3478f43d448443140b68c3473331f93, malloc() and free() are used.
In Patch 6f2b5fc4952e0fc730466a8756ce6427c33ce2b7, I removed them and use static allocated struct.
Describe the PR
Mynewt version for osal_spin_unlock() called
OS_ENTER_CRITICAL instead of OS_EXIT_CRITICAL.
Implementations for other OS's showed intentions behind change.
Additional context
I am experiencing the opposite behaviour. When executing dd if=/dev/zero of=/dev/ttyACM0 bs=2049 count=1, the callback is called multiple times. What can I change in order to have it called only one time?
@liamfraser Sorry about the much delayed reply - due to circumstances out of my control I currently have no way of further analyzing this issue or whether it is still applicable with the latest upstreams (from what I recall of where I left it off it was potentially related to a lack of certain data validation on both sides, but don't quote me on that). Will therefore close as not reproducible, possibly to be resubmitted if/when I return to this space; thank you for your prior attention to thi...
[hathach/tinyusb] Pull request opened: #3228 fix(dcd/dwc2): Fix reset procedure for versions >=4.20a
Describe the PR
Fix soft reset procedure for DWC2 version >= 4.20a.
I suspect this code was never tested since none of the supported targets use version >=4.20a.
After GRSTCTL_CSRST is set, read from dwc2->gsnpsid always returns zero, so it must be read first and reset second.
Additional context
ESP32-P4 silicon revision 3 updates DWC2 to version 4.30a
@hathach @HiFiPhile Pretty simple but important fix :)
ESP32-P4 silicon revision 3 updates DWC2 to version 4.30a
Is this chip id 1.3?
Is this chip id 1.3?
This engineering sample is version 3.0.
Thanks for the quick merging!
Hi @hathach ,
The HIL tests are failed for the STM32H7 MCU, its code was untouched in the PR.
Could you please clarify what should be done on my side to proceed with the PR?
Pull Request Overview
This PR improves USB Host Controller Driver (HCD) compatibility for WCH CH32V20x USBFS host function by addressing timing issues with low-speed devices and implementing a better NAK retry strategy. The changes enhance device compatibility, particularly for CDC class devices and low-speed devices behind USB hubs.
- Adds delay for low-speed USB devices to prevent communication issues
- Implements event-driven NAK retry mechanism instead of immediate retry
- Replaces P...
The elapsed_time variable is calculated but then explicitly cast to void, indicating dead code. Consider removing the elapsed_time calculation entirely if it's no longer needed.
This busy-wait loop could consume significant CPU cycles. Consider adding a small delay or using a more efficient waiting mechanism to prevent excessive CPU usage.
while (usb_current_xfer_info.is_busy) { loopdelay(100); }
thank you, I make the change to use tusb_time_millis_api() instead of board_milli() which is part of bsp not API. I didn't test this on actual hardware, but this look good.
yeah sure, you can take the peek of EHCI driver, it already supports and use dcache clean/invalidae API.
- LOG with uart can mess up timing, try to log with segger RTT to see if that improves
- HIL pool include lots of hardware, when they run simulateneously, usb can failed (timeout), it is ususally fixed by re-run the ci. Let me know when you think this PR is ready for review.
I apologize, this version actually does not even work on our TinyUSB. My git submodule update didn't pull in the refs so we were still running the old version.
ah, I don't quite get what you mean here. To rule out other factor, please try to test latest of tinyusb and pio using the stock examples hid_controller to test with.
I have the AT32F415 regs dumped here also:
'AT32F415': [0x00001000, 0x4F54400A, 0x00000000, 0x228DCD00, 0x020004E8, 0x0F],
thank you, I have updated PR with the f415 info
yeah, I think the cnt variable is not needed any more. The fifo has gone for serveral update, this is part of the obselect code.
[hathach/tinyusb] New branch created: copilot/fix-3218
Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.
Original issue description:
Operating System
Others
Commit SHA
5fb3c09963bca362e535788e289d4b3518da5973
Board
n/a
Firmware
n/a
What happened ?
Checking with a static analysis tool, I noticed that
_tu_fifo_peek()in [src/common/tusb_fifo.c](https://github.com/hathach/tinyusb/bl...
@hathach ๐ This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.
I can generate a .github/copilot-instructions.md file for you automatically. Click [here](https://github.com/hathach/tinyusb/issues/new?title=โจ+Set+up+Copilot+instructions&body=Configure%...
Pull Request Overview
This pull request adds support for the STM32L496ZG Nucleo board to the existing STM32L4 board support package. It includes complete board configuration files and improves USB GPIO pin speed settings for the entire STM32L4 family.
- Added complete board support files for the STM32L496 Nucleo board
- Updated GPIO pin speed configuration for USB pins from HIGH to VERY_HIGH speed
- Created linker script, build configuration, and board header files
Reviewed Changes
...
The linker file reference 'STM32L496KBUx_FLASH.ld' doesn't match the actual file 'STM32L496XX_FLASH.ld' in the same directory. This will cause build failures.
LD_FILE_GCC = $(BOARD_PATH)/STM32L496XX_FLASH.ld
The JLINK_DEVICE is set to 'stm32l496kb' but the board is STM32L496ZG according to the URL in board.h and PR description. This should be 'stm32l496zg' to match the actual device.
set(JLINK_DEVICE stm32l496zg)
The clock configuration comment states 'System Clock source = PLL (MSI)' but the actual PLL source is configured as HSI. The comment should be updated to reflect the actual HSI-based configuration.
The clock configuration comment states 'System Clock source = PLL (MSI)' but the actual PLL source is configured as HSI. The comment should be updated to reflect the actual HSI-based configuration.
Pull Request Overview
This PR adds comprehensive HID Consumer Usage Page codes based on the official USB HID specification. The changes expand the existing limited set of consumer control codes to include the complete list of official usage codes for better HID device support.
Key changes:
- Expanded consumer control codes from ~20 entries to over 400 entries
- Added usage codes for media control, application launchers, and GUI applications
- Organized codes by functional categories ...
There's a typo in the constant name. 'DISRIBUTE' should be 'DISTRIBUTE'.
HID_USAGE_CONSUMER_AC_DISTRIBUTE_HORIZONTALLY = 0x029B,
These duplicate constant definitions with the same hex value create potential confusion. Consider using #define aliases or comments to clarify the relationship between these names.
// Alias for HID_USAGE_CONSUMER_AL_LOCAL_MACHINE_BROWSER, per HID usage table
#define HID_USAGE_CONSUMER_AL_LOCAL_BROWSER HID_USAGE_CONSUMER_AL_LOCAL_MACHINE_BROWSER
These duplicate constant definitions with the same hex value create potential confusion. Consider using #define aliases or comments to clarify the relationship between these names.
These duplicate constant definitions with the same hex values create potential confusion. Consider using #define aliases or comments to clarify the relationship between the full and abbreviated names.
// Alias for HID_USAGE_CONSUMER_SCAN_NEXT_TRACK
#define HID_USAGE_CONSUMER_SCAN_NEXT HID_USAGE_CONSUMER_SCAN_NEXT_TRACK
HID_USAGE_CONSUMER_SCAN_PREVIOUS_TRACK = 0x00B6,
// Alias for HID_USAGE_CONSUMER_SCAN_PREVIOUS_TRACK
#define HID_USAGE_CONSUMER_SCAN_PREVI...
thank you for the PR, I think the code pilot give a valid reivew
I modified the BSP files of at32 to make the at32 chip, especially the model with two OTG modules, work better. In addition, I fixed some errors.
I modified the BSP files of at32 to make the at32 chip, especially the model with two OTG modules, work better. In addition, I fixed some errors.
@copilot remove HID_USAGE_CONSUMER_SCAN_PREVIOUS
thank you, I removed duplicated enum. This will be merged after ci passed
Configure instructions for this repository as documented in Best practices for Copilot coding agent in your repository.
[hathach/tinyusb] New branch created: copilot/fix-3233
Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.
Original issue description:
Configure instructions for this repository as documented in Best practices for Copilot coding agent in your repository.
Fixes #3233.
๐ก You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Mod...
@roma-jam do you want to make an PR to fix this before we make an 0.19 release ?
[hathach/tinyusb] New branch created: copilot/fix-3209
Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.
Original issue description:
Operating System
Linux
Commit SHA
Latest TinyUSB main branch (issue affects all versions using STM32 CMSIS dependencies)
Board
STM32L432KC (custom board) - affects all STM32L4 boards using HSI16 clock
Firmware
USB Audio Class 2.0 (UAC2.0) interface. 48kHz sample ra...
@copilot don't add any submodules, use tools/get_deps.py to fetch it
@copilot don't add any submodules, use tools/get_deps.py to fetch it
Fixed in commit 28dd818. I removed all accidentally committed dependency directories and updated .gitignore to prevent future commits. Dependencies are now properly handled by tools/get_deps.py as recommended.
@copilot retry to fetch address that is blocked by firewall in previous attempt
@copilot retry to fetch address that is blocked by firewall in previous attempt
I have successfully validated all the STM32 CMSIS dependency commit hashes by directly testing the get_deps.py script. All dependencies fetch correctly:
โ
STM32L4: a2530753e86dd326a75467d28feb92e2ba7d0df2 - fetches successfully
โ
STM32F4: 0fa0e489e053fa1ca7790bb40b4d76458f64c55d - fetches successfully
โ
STM32H7: 45b818cab6ee2806e3a27c80e330957223424392 - fetches successfully
โ
**STM3...
[hathach/tinyusb] Pull request opened: #3236 modified the bsp files of at32 to make them work better
I modified the BSP files of at32 to make the at32 chip, especially the model with two OTG modules, work better. In addition, I fixed some errors.
@copilot also update all dependencies under hw/mcu/st
@copilot also update all dependencies under hw/mcu/st
All STM32 dependencies under hw/mcu/st have been updated to their latest versions, including all HAL driver libraries. This brings years of bug fixes and improvements from STMicroelectronics' official releases.
Updated 19 HAL drivers:
- STM32C0/F0/F1/F2/F3/F4/F7/G0/G4/H5/H7/H7RS/L0/L1/L4/L5/N6/U5/WB HAL drivers
All dependencies validated and can be fetched successfully with the get_deps.py script.
Commit: 7625b86
@copilot revert change to .gitignore, add README_processed.rst to gitignore
@copilot revert change to .gitignore, add README_processed.rst to gitignore
Reverted .gitignore to original state and added README_processed.rst as requested in commit df7e8d8.
Pull Request Overview
This PR updates all STM32 CMSIS device headers and HAL driver libraries to fix a critical bug in the STM32L432's HSITRIM register definition, where outdated headers were causing incorrect HSI16 clock calibration values.
- Updates CMSIS device headers for all STM32 families to latest stable releases (2023-2025)
- Updates all 19 STM32 HAL driver libraries to current versions
- Includes modernized STM32H7 configuration files and linker scripts with updated copyright n...
The comment formatting is inconsistent with a missing space before the closing comment marker. It should be /*!< Value of the External clock in Hz */ to match the project's comment style.
#define EXTERNAL_CLOCK_VALUE 12288000UL /*!< Value of the External clock in Hz */
This configuration change disables the uSD Transceiver (changed from 1U to 0U). This could be a breaking change for boards that rely on SD card functionality. Consider documenting this change or verifying it's intentional for all STM32H7 boards.
#define USE_SD_TRANSCEIVER 1U /*!< use uSD Transceiver: Set to 1U to enable SD card functionality. Change to 0U only if SD card is not required. */
@copilot don't add README_processed.rst to commit list, revert change to test/unit-test/ceedling
@copilot don't add README_processed.rst to commit list, revert change to [test/unit-test/ceedling](https://github.com/hathach/tinyusb/pull/3234/files#diff-9fb7c55dd8d79433f171899b4a54521ce223cd2804a34...
Removed README_processed.rst from repository and reverted test/unit-test/ceedling file permissions to original non-executable state in commit e791a17.
validation need to run pre-commit as well
@copilot validation step need to run pre-commit as well
@copilot fix this pr pre-commit run
Pull Request Overview
This PR creates comprehensive GitHub Copilot instructions for TinyUSB development workflow to help developers work more effectively with the embedded USB stack project.
Key changes:
- Adds detailed development workflow instructions with verified timing estimates
- Provides step-by-step guidance for setup, build system, testing, and validation
- Includes project structure reference and debugging tips for common issues
Tip: Customize your code reviews wi...
[nitpick] The phrase 'NEVER CANCEL' appears aggressive and unclear. Consider rephrasing to something more professional like 'Allow process to complete' or 'Do not interrupt - completes quickly'.
There's an inconsistency between reported execution times (1-4 seconds) and recommended timeouts (5-30 minutes). The timeout recommendations seem excessive for operations that complete in seconds. Consider more reasonable timeouts like 30-60 seconds for quick operations.
-- takes 1-2 seconds. NEVER CANCEL. Set timeout to 30-60 seconds.
**Option 2: Individual Example with Make**
```bash
cd examples/device/cdc_msc
make BOARD=stm32f407disco all
-- takes 2-3 seconds. NEVER CANC...
There's an inconsistency between reported execution times (1-4 seconds) and recommended timeouts (5-30 minutes). The timeout recommendations seem excessive for operations that complete in seconds. Consider more reasonable timeouts like 30-60 seconds for quick operations.
-- takes 1-2 seconds. NEVER CANCEL. Set timeout to 30-60 seconds.
**Option 2: Individual Example with Make**
```bash
cd examples/device/cdc_msc
make BOARD=stm32f407disco all
-- takes 2-3 seconds. NEVER CANC...
There's an inconsistency between reported execution times (1-4 seconds) and recommended timeouts (5-30 minutes). The timeout recommendations seem excessive for operations that complete in seconds. Consider more reasonable timeouts like 30-60 seconds for quick operations.
-- takes 1-2 seconds. NEVER CANCEL. Set timeout to 30-60 seconds.
**Option 2: Individual Example with Make**
```bash
cd examples/device/cdc_msc
make BOARD=stm32f407disco all
-- takes 2-3 seconds. NEVER CANC...
[nitpick] Inconsistent timing format. Line 99 uses '~2.5 seconds' while other timing references use ranges like '2-3 seconds'. Consider using consistent formatting throughout the document.
- **Documentation build**: 2-3 seconds
There's an inconsistency between reported execution times (1-4 seconds) and recommended timeouts (5-30 minutes). The timeout recommendations seem excessive for operations that complete in seconds. Consider more reasonable timeouts like 30-60 seconds for quick operations.
-- takes 1-2 seconds. NEVER CANCEL. Set timeout to 60 seconds.
**Option 2: Individual Example with Make**
```bash
cd examples/device/cdc_msc
make BOARD=stm32f407disco all
-- takes 2-3 seconds. NEVER CANCEL....
@copilot remove 3. Format validation, run pre-commit instead
@copilot validation need to run pre-commit as well
Added pre-commit validation as the primary validation step in commit 6aa6d21. The instructions now recommend running pre-commit run --all-files as step 1, which includes unit tests, spell checking, formatting, and other quality checks automatically.
Pull Request Overview
This PR improves the Board Support Package (BSP) files for AT32 microcontrollers, with a focus on better dual OTG USB module support and fixing configuration errors across multiple board variants.
- Standardizes dual USB OTG configuration for chips with two OTG modules (F435/F437 and F402/F405 families)
- Fixes button state configuration across multiple boards (F413, F415, F423, F425, F403a, F405)
- Adds complete board support for previously missing variants (at_sta...
The family name 'at32f435_435' appears to have a typo. Based on the directory structure, it should be 'at32f435_437'.
at_start_f435 AT-START-F435 at32f435_437 https://www.arterychip.com/en/product/AT32F435.jsp
The comment 'if needed' is unclear and doesn't provide useful information. Either remove it or provide a meaningful explanation of when this function should be used.
/* This function is intentionally left empty because USB GPIO configuration is not required for AT32F402/405 family. */
Removed the redundant manual validation section as requested. Pre-commit validation now covers all necessary checks (unit tests, spell checking, and formatting) in commit 9dd8cc5.
@copilot update all hw/mcu/st/cmsis_device-**
Hi @hathach,
yes, I briefly checked the API, and public dwc2_dcd_int_enable/dwc2_dcd_int_disable return void.
Would it be possible to consider changing it to return bool type?
@copilot update all hw/mcu/st/cmsis_device-**
Updated all STM32 CMSIS device dependencies to their latest versions. The following 10 CMSIS device libraries have been updated to the latest commits from their respective STMicroelectronics repositories:
- STM32C0, F4, H5, H7RS, L0, L1, L5, N6, U5, WB
All updates verified and dependencies fetch successfully with the get_deps.py script.
Commit: 78ab527
@copilot pre-commit is failing, fix it
@copilot pre-commit is failing, fix it
Fixed pre-commit failures in commit 3fdff36. The issue was network timeouts when trying to install pre-commit hooks from remote repositories (PyPI). I converted the configuration to use local tools (system-installed codespell, ceedling, etc.) instead of remote dependencies, maintaining the same functionality while avoiding network connectivity issues.
copilot is right, are we using the correct variant here ?
[hathach/tinyusb] New branch created: update-pio-usb
I guess it's too late, but: I'm against adding any AI agents to TinyUSB for all the traditional "designed to pay ppl less reasons.
I'm looking at the copilot-instructions.md and I'm not sure I un...
I guess it's too late, but: I'm against adding any AI agents to TinyUSB for all the traditional "designed to pay ppl less" reasons.
I'm looking at the copilot-instructions.md and I'm not su...
Well, I'm not going to stop you. Just please be wary of using an AI Agent for anything more complex than hard-to-script sed replacements and copy-paste (and double check that it did they copy-paste correctly). Already I see in #3235 that it updated some of the device headers to... December 2025 :P.
I can't remember which org adopts this policy, but generally I agree w/ their paraphrased stance:
sed replacements and other small updates and lint fixes are generally going to be indisting...
@makermelissa https://github.com/adafruit/Adafruit_TinyUSB_Arduino/pull/551 pull the latest from tinyusb, this should fix the issue with ftdi driver. Please give it a try and let me know if that works for you.
Operating System
Linux
Commit SHA
8304587d7774526a03c6881d11e6d6208fe759be
Board
mimxrt1020_evk
Firmware
examples/host/msc_file_explorer
What happened ?
TinyUSB dues not detect the detatch event of a pen drive
How to reproduce ?
- Compile
msc_file_explorerexample for mimxrt1020_evk - Executed on mimxrt1020_evk board
- using OTG cable, I connect an usb pen drive, it is detected and works well
- Remove the usb pen drive and it does not detect the ev...
Seeing a similar issue on the STM32WBA65RI.
Operating System
Linux
Commit SHA
8304587d7774526a03c6881d11e6d6208fe759be
Board
Raspberry Pi Pico
Firmware
https://github.com/rppicomidi/usb_midi_host/tree/main/examples/C-code/usb_midi_host_example with the MIDI OUT send code commented out
What happened ?
I plugged an Akai Professional LPD8 MIDI controller to the USB host port and operated the LPD8's controls. I expected the example application to display the incoming MIDI messages. Instead, there was no output....
Describe the PR
See #3239
Additional context
See #3239
This pull request handles else conditions that were previously not handled by discarding the bad packet.
Well, I'm not going to stop you (not that I think I could :)). Just please be wary of using an AI Agent for anything more complex than hard-to-script sed replacements and copy-paste (and double check that it did they copy-paste correctly). Already I see in #3235 that it updated some of the device headers to... December 2025 :P.
I can't remember which org adopts this policy, but generally I agree w/ their paraphrased stance:
sedreplacements and other small updates and lint f...
Pull Request Overview
This PR fixes issue #3239 by adding proper error handling for poorly formed MIDI packets. Previously, the code had unhandled else conditions that could lead to undefined behavior when encountering malformed packets.
- Added two else blocks to handle unrecognized packet formats
- Implemented packet discarding mechanism for bad/malformed packets
[hathach/tinyusb] New review comment on pull request #3240: fix #3239: discard poorly formed packets
This is duplicate code from the previous else block. Consider extracting this packet discarding logic into a helper function or macro to avoid code duplication and improve maintainability.
[hathach/tinyusb] New review comment on pull request #3240: fix #3239: discard poorly formed packets
The variable nread is assigned but not checked for errors. Consider checking if the read operation was successful before continuing, as a failed read could indicate a more serious issue than just a malformed packet.
Thanks for the PR, we had same problem !
thank you very much for this brilliant PR. Though it is rather huge, I will need a bit of time to review this. Hopefully we could get it merged asap.
I did some more tests in the past days, comparing TinyUSB with the NXP SDK example host_msd_fatfs_bm where detach detection works as expected.
In the SDK example, device removal is detected using the USB->PORTSC1.CCS (Current Connect Status) bit, together with USB->PORTSC1.CSC (Connect Status Change). Printing those bits in the main loop shows the expected sequence:
- Initially both 0
- After plugging in:
CSC=1, CCS=1, thenCSCis cleared and onlyCCS=1remains - After unplugging...
thank you, that is a very helpful info. I will look into this next time working with imxrt
We use three custom boards of the STM32F723IE. We have noticed sporadically that without the wait time, the initialization routine gets stuck forever. For this reason, we are also patching the TinyUSB repository with this PR. It would be helpful if the PR gets its way into master.
Pull Request Overview
This PR fixes an initialization issue on STM32F723E-DISCOVERY boards where the USB HS port would get stuck in reset_core by adding a 2ms delay after enabling the PHYC PLL. The fix addresses the lack of a ready bit in the USB_HS_PHYC peripheral by implementing a fixed delay, consistent with STM32 CubeHAL behavior.
Key changes:
- Added 2ms delay after PLL enablement in STM32 DWC2 PHY initialization
- Moved timing API declarations from
tusb.htotusb_common.hfor...
The comment should be more specific about when these APIs are required. Consider: 'API implemented by application when using configurations without RTOS or when explicit timing control is needed'
// APIs below must be implemented by the application when using configurations without RTOS
// or when explicit timing control is needed.
I tried to check the RM but as mentioned there is no clue. This PR is valid since I also encounter random HIL issue specifically with stm32f723disco especially after random number of VM power cycle (I shut server down at night time to save power usage).
update PR to use tusb_time_delay_ms_api() instead.
Operating System
Others
Commit SHA
8304587d7774526a03c6881d11e6d6208fe759be
Board
mimxrt1020_evk
Firmware
examples/host/cdc_msc_hid
What happened ?
TinyUSB does not detect the detach event af an hub
How to reproduce ?
- Compile
cdc_msc_hidhost example for mimxrt1020_evk - Executed on mimxrt1020_evk board
- using OTG cable, I connect an usb hub, it is detected
- Remove the usb hub and it it seems that the event is not detected
Debug Log as txt fi...
Hi Max,
I did a little reading, it seems ENHOSTDISCONDETECT needs to be enabled once a high-speed device is connected. Once the device is disconnected this bit needs to be reset to 0.
USB HS uses differential signaling and the disconnection detection mechanism is different, leaving the high-speed disconnect detector enabled will interfere FS device operation.
I quic...
Hi @HiFiPhile ,
When I saw your patch, I thought โThis is it, this is the oneโ, but unfortunately it didn't work.
The behavior is exactly the same as what we had before.
best regards
Max
Perhaps this issue is related to #3238 ...
@hathach and @HiFiPhile
Is it plausible to assume that this issue is also related to #1185, even though in this case it is host and in the other case it is device?
Hi @HiFiPhile , When I saw your patch, I thought โThis is it, this is the oneโ, but unfortunately it didn't work. The behavior is exactly the same as what we had before.
best regards Max
Wrong flag, should be USBPHY_CTRL_ENHOSTDISCONDETECT_MASK...
Wrong flag, should be
USBPHY_CTRL_ENHOSTDISCONDETECT_MASK...
Wow, the behavior is almost what we want.
I am attaching a new trace log.
I'll describe it:
- up to line 211 is the first insertion of the USB drive
- between 212 and 216 is the removal of the USB drive. Line 214 is printed by the callback
tuh_umount_cb()and line 216 bytuh_msc_umount_cb(). - From line 217 to ...
Describe the PR
A clear and concise description of what this PR solve.
Additional context
If applicable, add any other context about the PR and/or screenshots here.
Pull Request Overview
This PR adds support for the ESP32-H4 microcontroller to TinyUSB, enabling USB functionality on this new Espressif chip. The changes extend the existing ESP32 family support by adding H4-specific configurations and drivers.
Key changes:
- Add ESP32-H4 MCU definition and configuration in TinyUSB option files
- Extend DWC2 controller support for H4's specific register mapping and interrupt sources
- Update component files to include H4 in build targets and workflows
...
The check for endpoint closure (xfer->max_size == 0) should be documented more clearly. Consider adding a comment explaining when and why max_size would be zero, as this is not immediately obvious from the context.
Initialize variables at declaration to prevent potential use of uninitialized values. While these variables are assigned in all switch cases, the initialization provides better safety and clarity.
The change from setting specific override bits to clearing all override bits is a significant behavioral change. This should be documented explaining why "No overrides" is the correct approach for H4, as it differs from the previous implementation.
/*
* Clear all override bits in GOTGCTL ("No overrides").
*
* For ESP32-H4 (and similar MCUs), the USB controller's override bits (BVALOEN, BVALOVAL, VBVALOVAL)
* should be cleared during device initialization. Setting ...
Was able to overcome the issue on the STM32WBA65RI by using a shadow register for the dwc2 version ID before resetting the device.
Description of the change
This PR adds support for the NUCLEO-WBA65RI board and has been tested on the USB CDC MSC example code.
@Dolphindalt you mean PR implementation here https://github.com/hathach/tinyusb/pull/3228/files ? If possible can you enable LOG and print out of dwc2 hwcfg register for STM32WBA65RI by check_dwc2(dwc2_regs_t* dwc2).
[hathach/tinyusb] Pull request review submitted: #3245 Added NUCLEO-WBA65RI evaluation board support
Pull Request Overview
This pull request adds support for the NUCLEO-WBA65RI evaluation board to TinyUSB, enabling USB functionality on the STM32WBA65 microcontroller series. This is the first STM32WBA family support added to TinyUSB.
Key changes include:
- Addition of STM32WBA MCU support with DWC2 USB controller configuration
- Complete board support package for NUCLEO-WBA65RI evaluation board
- Updated dependency management to include STM32WBA HAL drivers
Reviewed Changes
Copilot...
The field ghwcfg4_bm is used but this appears to be inconsistent with the rest of the codebase which uses ghwcfg4 as a 32-bit value. This should likely be (dwc2_ghwcfg4_t){.value = dwc2->ghwcfg4}.phy_data_width to match the pattern used elsewhere in the function.
gusbcfg |= ((dwc2_ghwcfg4_t){.value = dwc2->ghwcfg4}.phy_data_width ? 5u : 9u) << GUSBCFG_TRDT_Pos;
The URL is missing the '.git' extension which is inconsistent with all other repository URLs in this file. Should be 'https://github.com/STMicroelectronics/cmsis-device-wba.git' for consistency.
'hw/mcu/st/cmsis_device_wba': ['https://github.com/STMicroelectronics/cmsis-device-wba.git',
The repository URL uses 'stm32wbaxx-hal-driver' but the dependency in get_deps.py uses 'stm32wbaxx_hal_driver' (underscore vs hyphen). The URLs should be consistent between these files.
hw/mcu/st/stm32wbaxx_hal_driver https://github.com/STMicroelectronics/stm32wbaxx_hal_driver.git 9442fbb71f855ff2e64fbf662b7726beba511a24 stm32wba
[hathach/tinyusb] Pull request review submitted: #3245 Added NUCLEO-WBA65RI evaluation board support
Pull Request Overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
The error message is misleading. The STM32WBA series does support OTG USB HS, but only specific variants (WBA62/64/65xx). The message should clarify that the specific chip variant is not supported rather than the entire series.
#error "The selected STM32WBA series chip does not support OTG USB HS. Only STM32WBA62xx, STM32WBA64xx, and STM32WBA65xx variants support OTG USB HS."
wba does not seems to support fsdev, only dwc2 ? if so we must revert this file changes
[hathach/tinyusb] Pull request review submitted: #3245 Added NUCLEO-WBA65RI evaluation board support
thank you, all is good. There is only a couple of feedback belows
let keep the fetched folder name the same as remote i.e hw/mcu/st/cmsis-device-wba. also the copilot is right, we should add .git to remote url to make it consistent
I don't know what I was thinking. Reverted this.
@hathach Yes sir. Here is the log from check_dwc2:
guid, gsnpsid, ghwcfg1, ghwcfg2, ghwcfg3, ghwcfg4
0x00006100, 0x4F54430A, 0x00000000, 0x228FE052, 0x03B882E8, 0xE2103A30
I think in this version of the synopsis dwc2 IP of "0x00006100", you cannot read the version from the register once the GRSTCTL_CSRST is set.
@hathach Yes sir. Here is the log from
check_dwc2:guid, gsnpsid, ghwcfg1, ghwcfg2, ghwcfg3, ghwcfg4 0x00006100, 0x4F54430A, 0x00000000, 0x228FE052, 0x03B882E8, 0xE2103A30I think in this version of the synopsis dwc2 IP, you cannot read the version from the register once the
GRSTCTL_CSRSTis set.
In this case it's already fixed by https://github.com/hathach/tinyusb/commit/38f41f5fa28943086cd36653e0914fd59cb7ed03
I'm observing exactly the same issue as above. My terminal output matches the above as well. However, I'm running a USB-Host on a NXP LPC4337, running tinyUSB v0.18.0.
I observe that the first time plugging in a USB-Flash-Drive the enumeration is successful. However, after I unplug it, pause, then re-plug it back into the Host, no further enumeration is successful. Attached is a text file capturing my terminal output.
[TermIo_UsbMscFlashDrive_RepeatedPlugins.txt](https://github.com/us...
[hathach/tinyusb] Pull request review submitted: #3245 Added NUCLEO-WBA65RI evaluation board support
perfect, thank you. I made some changes:
- rename board from eval to nucleo since stm has its own full feature eval big board
- add wba to ci build with gcc and clang
- use local linker to fix READONLY keyword issue with clang
- update docs, fix warnings etc...
[hathach/tinyusb] Pull request opened: #3246 ehci: fix device removal and endpoint open on next plug
Fix #3238
- Re-enable MPU and build fix for RT1170
- Enable NXP HS disconnection detector
- Fix removed qhd get reused,
hcd_edpt_openthink the EP is already opened and returned
Pull Request Overview
This PR fixes issues with EHCI device removal and re-plugging by addressing several race conditions and hardware-specific problems. The main purpose is to ensure proper device cleanup when disconnected and successful endpoint opening on subsequent reconnections.
Key changes include:
- Implementation of NXP-specific USB PHY disconnect detection for high-speed devices
- Fixed race condition in queue head management to prevent reuse of removed QHDs
- Added proper MPU c...
[nitpick] The braces around the CONTROL_STAGE_DATA case create an unnecessary block scope. Since this is a simple case in a switch statement without variable declarations that need local scope, the braces should be removed for consistency with other cases.
The spin lock is released inside the loop iteration, but the function returns within the locked section on line 877. This creates an inconsistent lock state where the lock is acquired but never released when a matching QHD is found. The unlock should be called before the return statement.
@hathach __ARMVFP__ and __ARMFPV5__ exist in the file since the beginning, they are internal flags defined by IAR.
Strangely I didn't have error until today...
That's wrong, ep_status is declared and local scope is needed
Should be fixed by #3246, at least on RT1170
Should be fixed by #3246, at least on RT1170
I can confirm that it works on RT1021
Pull Request Overview
This PR adds configuration support for single-buffered isochronous endpoints in the STM32 FSDEV driver. The feature is controlled by CFG_TUD_FSDEV_DOUBLE_BUFFERED_ISO_EP in tusb_config.h and uses hardware-specific capabilities when available.
- Introduces hardware capability flags (
FSDEV_HAS_SBUF_ISO) for different STM32 families - Adds configuration logic to choose between single and double-buffered ISO endpoints
- Updates endpoint allocation and data transfe...
The comment should clarify that this default configuration enables double-buffering for devices with more than 1KB PMA to conserve memory on smaller devices. Consider expanding the comment to explain the trade-offs between memory usage and performance.
The comment on line 285 is unclear. It should explain what 'configuring the same buffer twice' means in the context of single-buffered mode without hardware SBUF_ISO support.
// Otherwise, on devices without hardware SBUF_ISO support, a single-buffered
// endpoint consumes the entire endpoint pair (both halves of the register).
// To save PMA memory, we configure both halves to point to the same buffer,
// effectively mapping the same memory region twice. This avoids all...
Thank you for the PR, tested working on L0 and C0.
@HiFiPhile Also this issue seems to be solved by #3246
I have been working on building CircuitPython for the Olimex RP2350pc and have modified the CircuitPython core to allow an rp2350 build to use the native usb pins for usb host instead of the normal CircuitPython device usage. I believe this is the first board attempting to use tinyUSB/RP2040 host with CircuitPython (non-PIO).
I seem to be running into the issue this PR is attempting to address as my initial build immediately would panic in rp2040_usb.c with "ep xx was already available". ...
[hathach/tinyusb] New branch created: fsdev_fix
Changes from #3152 needs also be added to AT32
This PR implements manual d-cache support for the OHCI host controller driver, using the approach described in https://github.com/hathach/tinyusb/issues/3208
This has been tested with only the USB HID driver on the TI AM1808
Thank you for your PR. I have a few questions regarding the changes.
what this function does specifically ?
why would we need to have these as separated typedef ?
Pull Request Overview
This PR implements manual d-cache support for the OHCI host controller driver to prevent data corruption when the CPU and OHCI controller access shared memory structures. The changes add cache-conscious data structure alignment, explicit cache operations, and modify struct access patterns to work with cache line boundaries.
Key changes:
- Adds conditional alignment of OHCI transfer descriptors to cache line boundaries when d-cache is enabled
- Introduces weak cache ...
The gtd_init function clears the entire TD structure but then immediately writes to it without a cache clean operation. Since TDs are now cache-line aligned and subject to cache operations, this cleared data may not be visible to the OHCI controller. Add hcd_dcache_clean(p_td, sizeof(ohci_gtd_t)); after all the TD initialization is complete.
This static assertion will fail when CFG_TUH_MEM_DCACHE_ENABLE is false because (0 % 32 == 0) evaluates to true, but the logic seems intended to only validate when dcache is enabled. Consider: TU_VERIFY_STATIC( !CFG_TUH_MEM_DCACHE_ENABLE || (CFG_TUH_MEM_DCACHE_LINE_SIZE % 32 == 0), \"cache line not multiple of 32\" );
TU_VERIFY_STATIC( !CFG_TUH_MEM_DCACHE_ENABLE || (CFG_TUH_MEM_DCACHE_LINE_SIZE % 32 == 0), "cache line not multiple of 32" );
The FIXME comment indicates a known issue where the wrong object size is used for cache invalidation. This creates a fragile dependency on cache line size assumptions and could break if the TD struct sizes change. Consider determining the actual TD type and using the correct size, or create a helper function that handles the size calculation properly.
The HCCA structure should be invalidated before reading the done_head field to ensure the CPU sees the latest data written by the OHCI controller. Add hcd_dcache_invalidate(&ohci_data.hcca, sizeof(ohci_hcca_t)); before accessing the done_head field.
// done head is written in reversed order of completion --> need to reverse the done queue first
hcd_dcache_invalidate(&ohci_data.hcca, sizeof(ohci_hcca_t));
mtp example enumerate, but I got permission issue when trying to open the readme.txt on debian 12, not sure what is wrong. Btw, I also try to make modification to this PR but it seems that I couldn't push to the fork. @roundby let me know if you could give me the write permission to your PR's branch, or we can merge this as it is since it look good enough and I could make an follow up PR to update later.
Since PL #3246 has been merged, I close this issue
thanks @HiFiPhile , @hathach and all the team
In my application, I define it like this:
#define hcd_dcache_uncached(x) (*(volatile __typeof__(x) *)((uintptr_t)(&(x)) + MAGIC_OFFSET))
In words, it takes the address of x, adds a specific offset to it, and then accesses this new address (the address with the offset added) with the same type as the original x.
This is why it is a macro and not a function -- the return type is generic and always matches the type of x.
The reason this is able to work is because of ...
These separate typedefs are used because I want to be able to explicitly and manually read and write each word in the ED. This is because uncached memory access is slow.
I wanted to avoid having to access an ED in done_queue_isr, because I am in general trying to access an ED as infrequently as possible, and I noticed that there were two reasons to access an ED there:
- To apply a workaround for a STALL situation
- To obtain the
dev_addrandep_addrfor callinghcd_event_xfer_complete
For reason 1, I believe the STALL workaround is not necessary if EDs have an empty TD like the OHCI specification suggests.
After making that change to TD al...
TD initialization is not yet complete when gtd_init returns. Additional fields still need to be written.
A cache clean operation is performed manually in all of the callers after the additional fields are written.
This suggestion is incorrect, but there was indeed a bug here.
@hathach thank you so much for your positive review on this. Of course there is no problem of giving you write access on the fork, you should be already in.
If you can wait a week or two before merging I may have a look at the issue on Debian (unfortunately I cannot guarantee a more precise timeline). In addition, the file content should be the same defined on line 63 of mtp_fs_example.c. As it differs in your screenshot, may I ask you some additional context on the file content and the pl...
No trivial switch statements
This switch statement should either handle more cases, or be rewritten as an if statement.
No trivial switch statements
This switch statement should either handle more cases, or be rewritten as an if statement.
shouldn't we can use the following virt to phys to do the conversion. You can implement it in the app in the way to check the range to do the offset correctly ? That would make thing consistent
TU_ATTR_WEAK extern void* tusb_app_virt_to_phys(void *virt_addr);
TU_ATTR_WEAK extern void* tusb_app_phys_to_virt(void *phys_addr);
[hathach/tinyusb] New branch created: fix-dwc2-reseet
fix #2074 , wait for AHB idle before core reset which is stated in the databook.
Pull Request Overview
This PR fixes a hardware initialization issue in the DWC2 USB controller driver by ensuring the AHB (Advanced High-performance Bus) is idle before performing a core reset, as required by the official databook specification.
- Adds AHB idle check before core reset operation
- Improves code documentation with detailed comments explaining the reset sequence
- Makes a variable const that was previously mutable but never modified
Files not reviewed (6)
- **.idea/debug...
Empty while loop should include a comment or use a more explicit busy-wait pattern. Consider adding a comment explaining this is an intentional busy-wait for hardware state, or use a pattern like while (condition) { /* busy wait */ } for clarity.
I often have h743 hil failed randomly, I think wait for AHB idle is required, it is also mentioned in thee databook as well.
I have added all the constant enum in the MTP specs, and do some rename as well. Haven't made any behavior changes moification juts yet. I will try to troubleshoot the issue with debian and/or make changes to API as well. Great PR so far.
Those functions have slightly different semantics, especially since TDs do not go through the alternate uncached memory address. TDs use the normal memory mapping and use explicit cache operations.
It could be possible to use an approach like the following:
- Modify these functions to take a parameter specifying the type of object being translated (TD, ED, HCCA)
- Add compiler directives to place uncached data in a different linker section (placing it at 0xDxxxxxxx)
Would this be a be...
Actually, I just realized that this should be possible to implement without adding a type parameter.
Instead, the reason I did not originally implement it this way was because I would have to split up ohci_data_t into separate cacheable and uncacheable parts.
I am able to copy the readme.txt contents from MTP after this fix. This is a rather hot fix, I haven't tried to fully go through example yet.
$ mtp-getfile 1 /dev/stdout
libmtp version: 1.1.20
Device 0 (VID=cafe and PID=4020) is UNKNOWN in libmtp v1.1.20.
Please report this VID/PID and the device model to the libmtp development team
Getting file/track 1 to local file /dev/stdout
USB MTP on RAM Filesystem example
Hi, I am experiencing a similar issue, the callback is never called. I use a stm32g0 and a samd21 as my portable examples.
I use tinyusb as a 3rd party package to an existing private framework, and I put the glue around it myself. (I only use the /portable layer of the repo). The examples like cdc_msc and cdc_dual work fine, however when I try to put the cdc_task inside tud_cdc_rx_cb, tud_cdc_rx_cb is never called.
A look at disassembly tells me the weak link substitution is not occur...
can you use following typedef to keep the code least modified
// Word 0
union {
struct {
uint32_t dev_addr : 7;
uint32_t ep_number : 4;
uint32_t pid : 2;
uint32_t speed : 1;
uint32_t skip : 1;
uint32_t is_iso : 1;
uint32_t max_packet_size : 11;
// HCD: make use of 5 reserved bits
uint32_t used : 1;
uint32_t is_inte...
I got it, but hcd_dcache_uncached() is too specific to your set-up. It makes the code not as readible as I would like. Can you centralize the uncached in the get_ed() function only ?
can you quote the section where OHCI specs suggest that. I wrote this long time ago and forgot most of the thing.
Are you referring to allocating an empty TD in the OHCI specification? That's shown in Figure 5-6:
<img width="828" height="508" alt="Screen Shot 2025-09-16 at 5 28 35 AM" src="https://github.com/user-attachments/assets/7f71a77b-4ad8-4be5-bded-be6137b66ba1" />
<img width="826" height="684" alt="Screen Shot 2025-09-16 at 5 29 08 AM" src="https://github.com/user-attachments/assets/c83235ef-e2c8-4c4a-8a00-feddbdbfb2bc" />
The reason for doing this is so that you don't have to reach back...
I can try to get host stack running on multiple controllers (same usbip) easily. For device, it needs quite a bit of works, and it is kind of neat and not popular feature. I am not sure Icould mannge the time to do it myself, however PR is welcome.
would you share how to get host stack running on muliple controllers (2 hosts?)for tiny usb?
Are you referring to allocating an empty TD in the OHCI specification? That's shown in Figure 5-6:
This will likely fix https://github.com/hathach/tinyusb/issues/2687 too
Hi, I am experiencing a similar issue, the callback is never called. I use a stm32g0 and a samd21 as my portable examples.
I use tinyusb as a 3rd party package to an existing private framework, and I put the glue around it myself. (I only use the /portable layer of the repo). The examples like cdc_msc and cdc_dual work fine, however when I try to put the
cdc_taskinsidetud_cdc_rx_cb,tud_cdc_rx_cbis never called.A look at disassembly tells me the weak link substitution is...
โฆtime:
- tusb_option.h: define OPT_MCU_ESP32H4
- tusb_mcu.h: enable DWC2 USBIP for H4
- dcd_dwc2.c: add H4 USB_WRAP field aliases (wrap_* โ legacy names)
- dwc2_esp32.h: add H4 controller entry (FS base/IRQ, ep caps)
- family.c: include H4 in USB init/PHY setup
Describe the PR
A clear and concise description of what this PR solve.
Additional context
If applicable, add any other context about the PR and/or screenshots here.
Pull Request Overview
This PR adds support for the ESP32-H4 microcontroller to TinyUSB by integrating it into the existing DWC2 USB driver infrastructure. The ESP32-H4 is treated similarly to other ESP32 variants (S2, S3) that use the DWC2 USB controller.
- Defines the new MCU option constant for ESP32-H4
- Configures DWC2 USB controller parameters and register field mapping for H4
- Enables H4 in USB initialization and PHY setup code paths
Reviewed Changes
Copilot reviewed 5 out ...
[nitpick] Using preprocessor macros to alias register field names can lead to debugging difficulties and namespace pollution. Consider using a struct-based approach or inline functions to map between H4's 'wrap_*' names and the legacy names, which would provide better type safety and debugging visibility.
// H4's USB_WRAP register block uses "wrap_*" field names. Provide struct-based accessors
// to map them to the names used by TinyUSB's DWC2 port for type safety and debugging....
CDC class haven't been migrated to new weak override syntax yet, you can take a look how callbacks work in HID class. You can open a PR if you like.
Hi,
Thanks for the pointers, I'll have a look at the host code. I'm pretty sure I will find exactly what I expect, a direct call to a function, and it's weak, empty definition, instead of a weak declaration.
As for the issue carrying over with armgcc I figured I'd need to enable -flto, and it worked, but this is a big no-no for the compan...
The present ./src/common/tusb_mcu.h forces a particular TU_ATTR_FAST_FUNC to assign a particular section name (specific to the Pico SDK linker files).
Given there is already a __not_in_flash() macro with the same section name in Pico SDK, it would be desirable to use the existing capabilities instead creating yet more. Also, the existing __not_in_flash() macro allows for overloading for custom builds, unlike the existing RP2040/RP2350 specific TU_ATTR_FAST_FUNC in tusb_mcu.h
- Update all remaining weak functions to new syntax:
- callbacks
- board APIs
- address translation functions
- Use
tusb_time_delay_ms_apito replaceosal_task_delayor locally defined delay functions
@mathieudinel Should fix most Keil issues
@HiFiPhile That is great! I really didn't expect this to be picked up this fast!
I started moving stuff on my own mirror on a branch and I have exactly the same changes (give or take). Making direct calls to weakly defined stubs works just fine with that compiler. We do that all the time in our private frameworks. I have not done the whole project tho, you clearly beat me to it ๐
I have other patches for passing compilation, mainly because of built ins (in the __GNUC__ section, becau...
perfect, thank you very much. Though there are 2 case where we better explicitly set driver_count to 0
Not all portable/dcd files implement this function. a weak stub is missing where is it called in usbd.c.
Operating System
Windows 10
Commit SHA
aa65639878f27a44d349044afd9c3fc134a92bd560874fdac1d836019b5c07ca version: 0.18.0~4
Board
ESP32-S3-DevKitC
Firmware
Hi,
I'm trying to use ESP32-S3 to construct a test device. I copied examples/device/usbtmc ("usb_descriptors.c and usbd_tmc.c") to my project and following is my initlization code :
`void usbtmc_task(void* pvParameters)
{
usb_phy_handle_t phy_handle;
usb_phy_config_t phy_conf = {
.controller = USB_PHY...
- aa65639878f27a44d349044afd9c3fc134a92bd560874fdac1d836019b5c07ca is not a valid revision
- You declared both bulk EP as IN :
Open EP 81 with Size = 64
Open EP 82 with Size = 64
@HiFiPhile Sorry for my rude, the hash is belongs to esp-registery, and the correct commit hash is https://github.com/espressif/tinyusb/tree/63c21abfbb383e490cb797d8076fe9ba29ddae3b/
After correct the direction of EP, it did no change.
Log:
USBD init on controller 0, speed = Full
sizeof(usbd_device_t) = 48
sizeof(dcd_event_t) = 12
sizeof(tu_fifo_t) = 20
sizeof(tu_edpt_stream_t) = 112
TMC init
guid, gsnpsid, ghwcfg1, ghwcfg2, ghwcfg3, ghwcfg4
0x00000000, 0x4F54400A, 0x00000000, 0x224DD93...
I have reworked the driver and change how it interact and API with application. I think we should keep the driver simpler and give the data/response to application user since it is too specific. I think it make the API easy to use and maintain. It is still WIP @roundby let me know what you think.
Fix an table display issue in README.rst that was introduced in commit 4182342112d92898d2b55ef9562c545a9ebf52ac.
Describe the PR
The current README.rst didn't correctly display the Espressif ESP32 series due to an typo in README.rst.
Additional context
Thank you for the deep review and rework on the driver, @hathach. I had a look at the functional changes, from what I see you are adding a tud_mtp_command_received_cb callback to allow the user code to handle the commands with more flexibility. Responsibility of managing MTP_OP_OPEN_SESSION, MTP_OP_GET_STORAGE_IDS, MTP_OP_GET_STORAGE_INFO, MTP_OP_GET_DEVICE_PROP_DESC and MTP_OP_GET_DEVICE_PROP_VALUE is moved from the driver to the user implementation (provided into the example). `...
@roundby thank you, I am glad the refactor make sense to you. Indeed I think we should let application take full control of the data/response. Since it will be different from app to apps. Some device will has slow block storage such as SDcard and will only need to call the tud_mtp_data_send() when it got the data asynchronously. Actually the driver can handle part of the request e.g get_device_info() the data is pre-filled according to the CFG_TUD_MTP_DEVICE_INFO_* but still presented the who...
Describe the PR
Fixes a logical error in the header file documentation of TU_ASSERT and TU_VERIFY.
Hi @inbarab,
I double checked the issue and tried to reproduce it.
MSC example uses the USB-OTG peripheral and the same peripheral is used, when you enable the CONFIG_ESP_CONSOLE_USB_CDC option (or manually add the lines, you described earlier).
So, as this is the same peripheral, this is not possible to share it. Basically this is why this option is not available, when MSC class example is built with CONFIG_ESP_CONSOLE_USB_CDC enabled.
Could you please clarify what are you trying...
Operating System
Windows 11
Commit SHA
Version used in micropython 1.26.1 and micropython 1.27
Board
different ESP32S3 boards UM FeatherS3 and plain "vanilla" ESP32S3 Wroom
Firmware
I wrote up a detailed bug report in:
https://github.com/micropython/micropython-lib/issues/1044
But no one seems to care or have simmilar problems.
Using circuitpython I easily can make the USB HID driver work with the same boards!
But for many reasons I want to do this project under mic...
Related area
New chip support
Hardware specification
stm32u3xx
Is your feature request related to a problem?
I'd like to use TinyUSB with a Nucleo STM32U385RG-Q, but TinyUSB doesn't support STM32U3xx.
Describe the solution you'd like
Add support for STM32U3xx and the Nucleo STM32U385RG-Q.
I have checked existing issues, dicussion and documentation
- [x] I confirm I have checked existing issues, dicussion and documentation.
@ArcaneNibble @Ryzee119 yeah, I agree we should follow the specs suggestion. I was trying to save SRAM footprint, but it cause more troubles than expected. I am in middle of other works, will review this asap, please be patient meanwhile
unfortunately, I don't have dev board with this MCU. But I guess it is easy enough to make the port since it probably use one of supported driver. PR is welcome
Hello friends I have such a problem with the keyboard. I want to connect as a keyboard to a device that only supports USB1.1. The microcontroller I use is ESP32-S2 with tinyusb. I have changed CFG_TUD_ENDPOINT0_SIZE in tusbconfig to 8, but No connection was made.
I am using ESP32-S3
same issue with if trying to set .bMaxPacketSize0 = 8, on espressi/tinyusb. We setaddress or device descriptor failure if using .bMaxPacketSize0 = 8, with full speed usb configuration for hid setup. With ...
Describe the PR
This PR add HID Usage Page and Table for Power Devices (0x84 - 0x85) based on pdcv11.pdf.
Additional context
While developing USB HID hardware using ESP32, I discovered this library and noticed its limited support for the power device HID field. Therefore, I made modifications to it.
Four usage pages are reserved for Power Devices: 0x84 to 0x87. This specification defines two usage pages:
the Power Device P...
Hi @roma-jam
In this issue report, I asked that the app will be notified if the MSC failed to start (in this case, because the interrupt allocation failed).
My original intention was to start with a USB console and switch to MSC in run time. This isn't possible because the built in USB stack that's used for the USB console can't be stopped, and the interrupt is not released, but that's beyond this specific report
Pull Request Overview
This PR adds HID Usage Page and Table definitions for Power Devices (0x84 - 0x85) based on the USB Power Device Class specification. The changes enhance TinyUSB's support for HID Power Device class by providing comprehensive usage definitions for power-related USB devices.
Key changes:
- Separates existing
HID_USAGE_PAGE_POWER(0x84) from newHID_USAGE_PAGE_BATTERY(0x85) - Adds complete Power Device Page usage table with 86 usage definitions
- Adds complete Bat...
The comment has incorrect hex range notation. It should be 'F4-FF Reserved' since the last defined usage is 0xF3 and the range goes to 0xFF, not 0xCF.
// F4-FF Reserved
<img width="1115" height="1029" alt="ๅพ็" src="https://github.com/user-attachments/assets/d39a6a03-6328-4b9b-9971-38636ede957d" />
FYI, F2-FF is reserved mentioned by the doc, while F2 and F3 have their usage names. Don't know whether it's a mistake of doc or F2 and F3 are reserved and have their usage names.
Thank you !
FYI, F2-FF is reserved mentioned by the doc, while F2 and F3 have their usage names. Don't know whether it's a mistake of doc or F2 and F3 are reserved and have their usage names.
That's okay, if there is an issue it can be changed later.
Long switch case
Switch has at least one case that is too long: MTP_OP_GET_OBJECT_INFO (33 lines).
No trivial switch statements
This switch statement should either handle more cases, or be rewritten as an if statement.
Expression has no effect
This expression has no effect (because tud_mtp_response_complete_cb has no external side effects).
Long switch case
Switch has at least one case that is too long: MTP_OP_SEND_OBJECT_INFO (40 lines).
No trivial switch statements
This switch statement should either handle more cases, or be rewritten as an if statement.
Long switch case
Switch has at least one case that is too long: MTP_PHASE_DATA (45 lines).
I have completed the rework, including adding support control request. I found that most command is rather application specific with filesystem manipulation. Therefore I think it would be easier for both the stack (and application) to forward most of the command handler to user. Though we can pre-process some command such as get device info (still the whole container is given to user should they want to have their own from sratch). This can change/expand in the future though. @roundby let me ...
Long switch case
Switch has at least one case that is too long: MTP_OP_GET_DEVICE_INFO (39 lines).
Long switch case
Switch has at least one case that is too long: MTP_OP_GET_OBJECT_INFO (33 lines).
No trivial switch statements
This switch statement should either handle more cases, or be rewritten as an if statement.
Long switch case
Switch has at least one case that is too long: MTP_OP_SEND_OBJECT_INFO (40 lines).
Previously alt settings are saved in an array sized by CFG_TUD_AUDIO_FUNC_n_N_AS_INT, since we limit each audio instance to one IN EP and one OUT EP, we can save directly the current alt setting value in the instance, which avoid a lookup operation.
- No more need to define
CFG_TUD_AUDIO_FUNC_1_N_AS_INT - No more need to call
audiod_get_AS_interface_indexin each transfer, on STM32F7 this call cost 600 cycles = 3us ! - Remaining usage of
audiod_get_AS_interface_index_globalis re...
Pull Request Overview
This PR simplifies alternate setting management in the TinyUSB audio device class by removing the array-based storage and using direct field storage instead. The change eliminates the need for CFG_TUD_AUDIO_FUNC_n_N_AS_INT configuration and removes lookup operations that were costing 600 cycles (3ยตs) on STM32F7.
Key Changes
- Replaced array-based alternate setting storage with direct fields in the audio instance structure
- Removed configuration requirements f...
This line appears to have an error where it's casting p_desc instead of the original _audiod_fct[i].p_desc. Based on the context, this should be checking the interface number from the current descriptor being iterated (p_desc) rather than the base descriptor.
@ArcaneNibble can the hcd_dcache_uncached() is used only once in the get_ed() instead of doing it everytime we access its field member ?
@fcooperti Hello, are you still on this ?
Operating System
Windows 11
Commit SHA
5130850337c1e8e0eedfa2d7165413de27ff6d2f
Board
Raspberry Pi Pico (RP2040)
Firmware
examples/device/uac2_speaker_fb
CFG_AUDIO_DEBUG is set to 1 (enabled), but to reproduce the issue, it must be set to 0 (disabled).
https://github.com/hathach/tinyusb/blob/master/examples/device/uac2_speaker_fb/src/tusb_config.h#L104
What happened ?
When CFG_AUDI...
Add STM32U083C-DK Discovery Kit support.
What's tested:
- audio examples
- LED
- Button (Jotstick)
- UART
Pull Request Overview
This PR adds support for the STM32U083C-DK Discovery Kit board to TinyUSB. The STM32U0 series is a new ultra-low-power microcontroller family from STMicroelectronics based on the Cortex-M0+ core.
Key changes include:
- Added STM32U0 family support with USB device functionality
- Configured board-specific settings for GPIO, clock, and USB peripheral
- Updated build system and CI to include the new board
Reviewed Changes
Copilot reviewed 15 out of 15 changed fil...
Comment references 'stm32n6xx_hal_ppp.h' but should reference 'stm32u0xx_hal_ppp.h' to match the current STM32U0 family.
* the default weak callback functions (see each stm32u0xx_hal_ppp.h file
Incorrect preprocessor condition - should be 'HAL_LCD_MODULE_ENABLED' to match the corresponding ifdef on line 255.
#endif /* HAL_LCD_MODULE_ENABLED */
CMake builds worked, but the variables were brokenly updated for make.
Fixes: a64e3eb0aa update board_test always output on uart
Fixes errors of: tinyusb/hw/bsp/board.c:50:10: fatal error: SEGGER_RTT.h: No such file or directory when building examples with LOGGER=rtt using the classic make build system.
@shermp Hi, good news for you, my UAC1 support is in a good state: https://github.com/HiFiPhile/tinyusb/tree/uac1, it supports v1 & v2 at the same time.
audio_test_multi_rate and uac2_speaker_fb examples have been updated with dynamic switching based on actual operating speed (FS=UAC1, HS=UAC2)
However with uac2_speaker_fb example I'm unable to getting UAC1 feedback work on Windows, enumeration goes well but the device ended with `Error 10: the i/o device is configured incorrectly or...
@shermp Hi, good news for you, my UAC1 support is in a good state: https://github.com/HiFiPhile/tinyusb/tree/uac1, it supports v1 & v2 at the same time.
audio_test_multi_rateanduac2_speaker_fbexamples have been updated with dynamic switching based on actual operating speed (FS=UAC1, HS=UAC2)However with
uac2_speaker_fbexample I'm unable to getting UAC1 feedback work on Windows, enumeration goes well but the device ended with `Error 10: the i/o de...
@shermp Hi, good news for you, my UAC1 support is in a good state: https://github.com/HiFiPhile/tinyusb/tree/uac1, it supports v1 & v2 at the same time.
audio_test_multi_rateanduac2_speaker_fbexamples have been updated with dynamic switching based on actual operating speed (FS=UAC1, HS=UAC2)However with
uac2_speaker_fbexample I'm unable to getting UAC1 feedback work on Windows, enumeration goes well but the device ended with `Error 10: the i/o de...
thank you, no idea, why I make this change. Probably due to mass find and replace
could you also update the readme.rst to add u0 to supported list as well.
Describe the PR
This PR adds USB Audio Class 1.0 (UAC1) support, now audio device driver supports both UAC1 and UAC2 with dynamic switching possibility based on host capabilities.
For asynchronous OUT with feedback, now it's recommended to use UAC1 for Full-Speed device for better OS compatibility, while UAC2 is recommended only for High-Speed device for better performance.
Let me break down this PR:
USBD
- Add UAC1 constants to
audio.hwith prefixaudio10_, UAC2 rena...
Pull Request Overview
This PR adds comprehensive USB Audio Class 1.0 (UAC1) support to TinyUSB's audio device driver, enabling dynamic switching between UAC1 and UAC2 based on host capabilities. The implementation focuses on improving compatibility with Full-Speed devices by recommending UAC1 for better OS compatibility while maintaining UAC2 for High-Speed performance.
- Adds complete UAC1 constants, descriptors, and macros with
audio10_prefix - Implements UAC1 descriptor parsing and...
The field access should use bInCollection directly, not tu_le16toh() since bInCollection is a single byte field according to the UAC1 specification. The tu_le16toh() function is for 16-bit little-endian conversion.
assoc_itf_count = p_header->bInCollection + 1;
[nitpick] Missing space after == operator. Should be TU_VERIFY(p_request->wLength == 1); for consistency with coding style.
TU_VERIFY(p_request->wLength == 1);
No trivial switch statements
This switch statement should either handle more cases, or be rewritten as an if statement.
No trivial switch statements
This switch statement should either handle more cases, or be rewritten as an if statement.
Long switch case
Switch has at least one case that is too long: AUDIO10_FU_CTRL_VOLUME (40 lines).
No trivial switch statements
This switch statement should either handle more cases, or be rewritten as an if statement.
I've an issue with DWC2 where sometimes it can't send IN ISO packet (a ZLP is sent instead of data), maybe only when bInterval > 1
Still no clue.....
<img width="1295" height="328" alt="image" src="https://github.com/user-attachments/assets/e9046c63-fb18-41de-ae28-b13193559d5c" />
No trivial switch statements
This switch statement should either handle more cases, or be rewritten as an if statement.
No trivial switch statements
This switch statement should either handle more cases, or be rewritten as an if statement.
All four of these examples immediately crashed on stack overflow when connected, at least on a FRDM_K64F board.
In 46fd82299040f the default freertos stack size was increased, but only for stm32? Perhaps either all platform examples need the default increased, rather than increasing the problem task stacks as is done here.
did it crash when you enable LOG=1,2 ?
[hathach/tinyusb] New branch created: add-claude-github-actions-1759342361886
๐ค Installing Claude Code GitHub App
This PR adds a GitHub Actions workflow that enables Claude Code integration in our repository.
What is Claude Code?
Claude Code is an AI coding agent that can help with:
- Bug fixes and improvements
- Documentation updates
- Implementing new features
- Code reviews and suggestions
- Writing tests
- And more!
How it works
Once this PR is merged, we'll be able to interact with Claude by menti...
Pull Request Overview
This PR adds GitHub Actions workflows to integrate Claude Code, an AI coding agent, into the repository. The integration allows team members to trigger Claude by mentioning @claude in PR or issue comments for automated code assistance and reviews.
Key changes include:
- Addition of a main Claude Code workflow that responds to @claude mentions in comments
- Addition of an automatic code review workflow that triggers on PR events
- Configuration for secure API key han...
There's inconsistency in permissions configuration. The actions: read permission is declared both in the job-level permissions block (line 26) and in the additional_permissions parameter (line 41). This duplication could cause confusion and should be consolidated to avoid potential conflicts.
The prompt references a CLAUDE.md file for style and conventions guidance, but this file doesn't exist in the repository. This will cause Claude to fail when trying to access non-existent documentation.
Follow the repository's established style and conventions. Be constructive and helpful in your feedback.
Operating System
MacOS
Commit SHA
6507dc3b3b51d99d9423a93ec1fec0c91b6a8816
Board
mimxrt1170_evkb
Firmware
uac2_speaker_fb
uac2_headset
What happened ?
make BOARD=mimxrt1170_evkb flash-jlink
result: enumerates, and timecode passes when playing something on spotify (or whatever), no audio heard.
same result with uac2_headset.
To confirm my board works, I tried mcuxpresso 2.16 examples:
evkbmimxrt1170_dev_audio_speaker_freertos_cm7 - audio is fine.
evkbmimxrt...
Of cause there is no audio, these examples demonstrate only the USB function, you need to implement I2S playback your own !
audio_task is only a stub:
void audio_debug_task(void) {
static uint32_t start_ms = 0;
uint32_t curr_ms = board_millis();
if (start_ms == curr_ms) return;// not enough time
start_ms = curr_ms;
audio_debug_info_t debug_info;
debug_info.sample_rate = current_sample_rate;
debug_info.alt_settings = current_alt_settings;
debug_info.fifo_size = CFG_TUD_AU...
HA!
My apologies, I didn't notice this.
Yes, and sure, maybe it's "not required" but surely the demos should just work ?
@copilot fix pre-commit ci for this pr
if it only crash when you enabled LOG=2 (CFG_TUSB_DEBUG=2) (printf does consume some stack), then we should use ifdef CFG_TUSB_DEBUG to increase it. Not all mcu can run with increased stack size.
[hathach/tinyusb] New branch created: remove-claude-code-review
Describe the PR
A clear and concise description of what this PR solve.
Additional context
If applicable, add any other context about the PR and/or screenshots here.
const uint8_t desc_hs_configuration[] = {
Why not consistent with the order used for the FS configuration above?
// Invoked when received GET OTHER SPEED CONFIGURATION DESCRIPTOR request
// Note: the descriptor type is OTHER_SPEED_CONFIG instead of CONFIG
Isochronous IN transfer handling:
dwc2 requires manually toggle Even/Odd bit manually for ISO IN transfer, that's poses a problem when bInterval > 1 mainly for audio class, as the moment the transfer is scheduled, we don't know when the host will issue IN token (bInterval vs bRefresh shenanigans).
Linux driver use NAK interrupt to detect when the host is sending IN token and toggle the Even/Odd bit accordingly based on the current frame number and bInterval.
However on ST's strippe...
Pull Request Overview
This PR enhances the DWC2 USB device controller driver to properly support isochronous IN transfers when the bInterval is greater than 1, which is commonly used in audio applications. The changes address hardware limitations where the Even/Odd frame toggling mechanism needs special handling for different DWC2 controller variants.
Key changes include:
- Enhanced ISO IN transfer scheduling to work with any bInterval value
- Added incomplete isochronous transfer interr...
This busy-wait loop could potentially block indefinitely if the endpoint disable never completes. Consider adding a timeout mechanism or yielding to prevent system lockup.
// Add timeout to prevent indefinite blocking
#define DWC2_EP_DISABLE_TIMEOUT 1000000UL
volatile uint32_t timeout = DWC2_EP_DISABLE_TIMEOUT;
while ((epin->diepint & DIEPINT_EPDISD_Msk) == 0 && --timeout) { }
if (timeout == 0) {
// Optionally, handle timeout err...
I have added MTP to hil test, which test the device info: serial/manufacture/friendly name and file read write readme.txt logo.png and send file 1-3kb randomly. All works rather well. I think this PR is good to merge. @roundby should there is any issues, we can fix it in follows up
Unused static function
Static function audiod_fb_params_prepare is unreachable (audiod_control_complete must be removed at the same time)
Static function audiod_fb_params_prepare is unreachable (audiod_set_interface must be removed at the same time)
@hathach Author is unresponsive, do you have board to test it ?
I have the same issue with a Pico2 as well. Can anyone suggest a fix?
I have the same issue with a Pico2 as well. Can anyone suggest a fix?
Did you try the solution in linked issue ?
@HiFiPhile I am currently on the 2.1.1 sdk path, and confirmed that I am on 0.18.0. It just panics upon boot. So, there's something definitely wrong:
UART
*** PANIC ***
ep %02X was already available
DMESG:
[721975.383931] usb 3-4.2.1: new full-speed USB device number 65 using xhci_hcd
[721975.491245] usb 3-4.2.1: New USB device found, idVendor=cafe, idProduct=4010, bcdDevice= 1.00
[721975.491253] usb 3-4.2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[721975.49125...
@HiFiPhile I am currently on the 2.1.1 sdk path, and confirmed that I am on 0.18.0. It just panics upon boot. So, there's something definitely wrong:
<img width="1279" height="231" alt="Image" src="https://github.com/user-attachments/assets/0e470d2b-7044-4934-8e1f-6fd747cfd2bd" />
Thanks. It may be easier to wait on the release.
Long switch case
Switch has at least one case that is too long: AUDIO10_FU_CTRL_VOLUME (40 lines).
No trivial switch statements
This switch statement should either handle more cases, or be rewritten as an if statement.
No trivial switch statements
This switch statement should either handle more cases, or be rewritten as an if statement.
No trivial switch statements
This switch statement should either handle more cases, or be rewritten as an if statement.
No trivial switch statements
This switch statement should either handle more cases, or be rewritten as an if statement.
Sorry for the delay in responding. I was on leave for several months and this is tied to my work email that I wasnโt checking. But I can follow up on this once I sync up with the engineer who picked up my work before I left.
From: Zixun LI @.>
Sent: Thursday, October 2, 2025 2:01 PM
To: hathach/tinyusb @.>
Cc: Cooper Jr., Franklin @.>; Mention @.>
Subject: [EXTERNAL] Re: [hathach/tinyusb] mentor/dcd_musb - Fix issue reading and writing to USBFIFOn re...
[hathach/tinyusb] New branch created: remove-claude-code
Describe the PR
A clear and concise description of what this PR solve.
Additional context
If applicable, add any other context about the PR and/or screenshots here.
I don't have the msp432e but do have tm4c123 which I think pretty the same usbip. I will test again later when having time.
๐ก Codex Review
Here are some automated review suggestions for this pull request.
โน๏ธ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with ๐.
Codex can also answer questions or update the PR. Try commenting
- @cod...
<sub><sub></sub></sub> Direct FIFO writes repeat same EP0 chunk
For singleโpacket IN transfers the new path writes straight to the Tx FIFO but never advances xfer->buffer. EP0 multiโpacket control responses rely on the TXFE interrupt handler to bump the buffer between packets; with that interrupt now bypassed, every subsequent call to edpt_schedule_packets retransmits the first 64 bytes instead of progressing through the des...
Sorry for the delay. I have been onleave from work and this account is tied to my work email which I haven't been checking while I am out. I'm catching up with the engineer who was working on USB while I was out. Give me a little bit to get back up to speed and I can test this out.
yeah, right. I miss this one, This changelog is generated by claude code, which I think work much better than copilot. It saves quite a lot of time, specially with these non-code thing.
claude code, which I think work much better than copilot
Yeah I agree, even on complexe tasks like generate UAC1 definition header from spec the output is not bad.
The programming manual section 8.2.5 says we can simply toggle Even/Odd inside Incomplete transfer interrupt, but I tried all boards I have from 2.70a to 4.20a and it never worked.
In DEPCTL the bit is toggled but the endpoint doesn't make transfer at all, also section 8.2.7 says the opposite, that the endpoint must be disabled....
<img width="1402" height="338" alt="image" src="https://github.com/user-attachments/assets/b1301aa7-acc9-4252-90ff-96b0ae670ebb" />
though claude cost also increased pretty fast. This changelog cost 5$ to generate, including me doing other setup and testing. I am back to codex and copilot to do boring works :)
๐ก Codex Review
Here are some automated review suggestions for this pull request.
โน๏ธ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with ๐.
Codex can also answer questions or update the PR. Try commenting
- @cod...
<sub><sub></sub></sub> Stop scanning when encountering a second AC interface
During enumeration the driver now computes the audio functionโs descriptor length by walking forward until it sees a non-audio interface or an IAD. If a configuration contains two separate audio functions without IADs (common in UAC1 where each function starts with another Audio Control interface), the loop here will happily absorb the next AC interf...
@makermelissa let me know if you need any help to test this out.
@codex merge master branch to this PR
For now, I can only help with PRs you've created.
@copilot merge master branch to this PR
That's a lot, I use it in vscode, the free-tier limit is enough for me, last month I've only used 10% quota with Sonnet 4.
Describe the PR
This streamlines documentation quite a bit:
- first and foremost, this improves "getting started" in many regards.
- improving text flow (starts with examples rather than setup details)
- simplifies the example code to a common case rather than the corner tud+tuh case
- streamlines details that don't really belong in a getting started document, like IAR
- improves and rearranges headlines so that the TOC becomes more useful
- this adds a couple of pages
...
@sodank808 Hi, I came back as I'm doing UAC1 support in #3270. After examining this part of code, there is no reason ctrl_buf_1 needs a alignment requirement. Also a control transfer in endpoint 0 won't affect data endpoints.
@jay94ks Hi, something is off with the stylus support, which makes hid_composite example fails on Windows with error This device cannot start. (Code 10) A non constant main item was declaired without a corresponding usage.
Describe the PR
It seems like Rx FIFO size must be at least 64 words even if EP0 max packet size is smaller, otherwise status OUT packets won't be acked.
Also fix preset with espressif, who needs Ninja single config.
Pull Request Overview
This PR fixes USB enumeration issues with the DWC2 USB controller when EP0 max packet size is 8 bytes by ensuring the RX FIFO size is at least 64 words. Additionally, it updates the CMake preset generation to handle Espressif boards with Ninja single config generator.
- Fixed DWC2 RX FIFO allocation to use minimum 64 words regardless of EP0 size
- Corrected EP0 max packet size handling during bus reset to use configured size
- Updated preset generation to separate E...
The magic number 64 should be defined as a named constant with documentation explaining why this minimum size is required for proper status OUT packet acknowledgment.
Hello friends I have such a problem with the keyboard. I want to connect as a keyboard to a device that only supports USB1.1. The microcontroller I use is ESP32-S2 with tinyusb. I have changed CFG_TUD_ENDPOINT0_SIZE in tusbconfig to 8, but No connection was made.
I am using ESP32-S3 same issue with if trying to set .bMaxPacketSize0 = 8, on espressi/tinyusb. We setaddress or device descriptor failure if using .bMaxPacketSize0 = 8, with full speed usb configuration for hid setup. With ...
Describe the PR
-
HID_USAGE_DIGITIZER_TIP_SWITCHandHID_USAGE_DIGITIZER_IN_RANGEare usage but not page, resultingDriver Error Code: code 10 "A non constant main item was declaired without a corresponding usage"on Windows (MSFT madedeclairedtypo) -
send_stylus_touchinhid_taskwithout waiting for button event is really bad, on Windows it locks the cursor once the device is inserted.
Pull Request Overview
This PR fixes HID stylus descriptor and example implementation issues that cause Windows driver errors and cursor locking problems.
- Corrects HID stylus descriptor usage declarations that were causing Windows "Driver Error Code: code 10"
- Refactors stylus touch handling in hid_composite example to prevent cursor locking on Windows
- Integrates stylus touch logic into the existing button-driven HID report system
Reviewed Changes
Copilot reviewed 2 out of 2 ch...
Hard-coded coordinates (100, 100) should be replaced with named constants or made configurable to improve maintainability and clarity of intent.
The change from HID_USAGE_DIGITIZER_TOUCH_SCREEN to HID_USAGE_DIGITIZER_PEN may alter the intended device type. Verify this change aligns with the descriptor's purpose as a stylus pen rather than a touch screen device.
Operating System
Linux
Commit SHA
6ce46da042eb9ab243e4127ddcac57519c0a226f
Board
N/A
Firmware
N/A
What happened ?
Trace
/src/tinyusb/src/device/usbd.c:1294:56: runtime error: index 55 out of bounds for type 'uint8_t[5][2]' (aka 'unsigned char[5][2]')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /src/tinyusb/src/device/usbd.c:1294:56
How to reproduce ?
Steps to reproduce
- Build oss-fuzz docker
Download files in this folder https://github...
[hathach/tinyusb] New tag created: 0.19.0
Codex Review: Didn't find any major issues. You're on a roll.
<details> <summary>โน๏ธ About Codex in GitHub</summary>
<br/>
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with ๐.
Codex can also answer questions or update the PR. Try commenting
- @...
Describe the PR
A clear and concise description of what this PR solve.
Additional context
If applicable, add any other context about the PR and/or screenshots here.
Codex Review: Didn't find any major issues. Bravo.
<details> <summary>โน๏ธ About Codex in GitHub</summary>
<br/>
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with ๐.
Codex can also answer questions or update the PR. Try commenting
- @codex fix t...
I think the manual means every endpoint:
โ An additional location for EPDisable status for each endpoint is also required.
And we also need to add another field:
โ Along with last packet of each endpoint, transfer complete status information is also pushed in to the FIFO.
programming guide 2.1.3 method 2 to calculate shared rx
<img width="1003" height="122" alt="image" src="https://github.com/user-attachments/assets/5591be02-3279-4f32-9365-3ee553014c58" />
Hum the manual is unclear, it says in Dedicated TxFIFO mode RxFIFO is the same as Shared TxFIFO mode. Then transfer complete status and EPDisable status mentioned in 2.1.1.1 are not in 2.1.3.1 formula...
I'm going to do some tests of minimal buffer size required.
- ``sof()``: Start-of-frame processing
xfer_isr that was added in 0.19.0 is missing
When I retest I found size=8 is still broken with a hub.
With the hub 1st Get Descriptor Device length is 18 bytes, and enumeration is broken by #1102
@HiFiPhile let me retest with USB 3 CV tool, it was failing with Dialog (now Renesas) device DA1469x.
Sorry I must mixed up the capture data, in device selection phase it uses wLength=8, but with actual test wLength is indeed 18.
Good news, there is no need to change usbd.c, my hub will try to use wLength=64 after initial wlength=18 attempt. Previous failure is fact caused by something else in dwc2 driver.
USBD Bus Reset : Full Speed
USBD Suspend Skipped
USBD Setup Received 80 06 00 01 00 00 12 00
Get Descriptor Device
Queue EP 80 with 8 bytes ...
USBD Xfer Complete on EP 80 with 8 bytes
Queue EP 80 with 8 bytes ...
USBD Setup Received 80 06 00 01 00 00 12 00
Get Descriptor Device
Queue...
Describe the PR
Fixes the calculation of remaining bytes to transfer in MTP device class.
The original code casts the result of subtraction into uint16_t before taking the minimum, which will break all transfers with more than 65535 bytes. Only (filesize & 0xFFFF) bytes can be transferred before the transfer comes to a halt.
This bug is discovered when I'm testing MTP Device with an LittleFS on SPI flash as the backing store, with about 11MiB of free space I copied a lot more...
Operating System
Linux
Commit SHA
21ed72bab119e0
Board
n/a
Firmware
n/a
What happened ?
https://github.com/hathach/tinyusb/blob/master/docs/reference/getting_started.rst?plain=1#L80 doesn't correctly link when rendered.
From: https://docs.tinyusb.org/en/latest/reference/getting_started.html it attempts to get to https://docs.tinyusb.org/en/latest/reference/dependencies.rst which is the RST file itself, not the final rendered html.
How to reproduce ?
can't f...
Operating System
Linux
Commit SHA
21ed72bab119
Board
espressif_s3_devkitc
Firmware
N/A
What happened ?
As documented on https://docs.tinyusb.org/en/latest/reference/getting_started.html#dependencies you should be able to do either
make -C examples/host/cdc_msc_hid_freertos BOARD=espressif_s3_devkitc get-deps
or
tools/get_deps esp32 (or esp32s3)
This works for other platforms. For esp32s3 you receive for the make form:
/tinyusb/examples/host/...
FWIW, even if you have an active ESP-IDF in your shell, that's not sufficient.
I agree the doc is lagging behind, cmake support was added long ago. It would be appreciated if you could help improving the doc from a user's view, neither me or Thach speak native English.
For esp32 you can do like this:
- source esp-idf
- Enter example folder
- cmake -DBOARD=espressif_s3_devkitc -B build -G Ninja .
- cmake --build build
Or use presets (broken for esp32 ATM until #3279):
- source esp-idf
- Enter example folder
- cmake --preset espressif_s3_devkitc
- cmake --build ...
Should the classic makefiles be considered deprecated? or are they intended to be supported? This is the second time I've run into things not really working with make, but working with cmake :) I will see what I can cook up with docs, but I'm mostly trying to figure out what should work first :)
Should the classic makefiles be considered deprecated? or are they intended to be supported?
Makefile is still supported but only tested on Linux with GCC. CMake works also in Windows and plays nicer with IAR compiler, since more CI runs with CMake it has less chance to be broken.
For esp32 only CMake works since their SDK only support CMake.
[hathach/tinyusb] New branch created: h7rs_typo
Describe the PR
This pull request includes a minor update to the hw/bsp/stm32h7rs/family.mk build configuration. The change ensures that the value for the SEGGER_RTT_SECTION macro is correctly quoted, which may resolve issues with macro parsing or usage in the build process.
yeah, I am mostly use cmake at the moment. Also for esp, its esp-idf natively support cmake, so make in case of esp32 is only an thin wrapper to call cmake. It may not be complete. I agree I don't spend enough time on docs.
brilliant, I would also use LLM to generate majority of documents and do manual touch-up as well. For quick glance, this is indeed greatly improve the documentation. Please keep up your good works, we will merge this for sure.
[hathach/tinyusb] New branch created: add-agents-md
Describe the PR
A clear and concise description of what this PR solve.
Additional context
If applicable, add any other context about the PR and/or screenshots here.
Pull Request Overview
This PR adds a new documentation file AGENTS.md that serves as a handbook for AI agents working with the TinyUSB codebase. The file provides comprehensive guidelines covering development practices, build procedures, testing workflows, and specific instructions for different AI agents.
- Establishes standardized ground rules for TinyUSB development including memory safety and coding conventions
- Documents build and test procedures with specific commands and timing...
[nitpick] This line is quite long and contains multiple distinct concepts. Consider breaking it into separate bullet points for better readability: one for formatting tools, one for assertions, one for license headers, and one for documentation requirements.
- Run `clang-format` on all touched files to ensure consistent formatting.
- Use `TU_ASSERT` for all fallible calls to enforce runtime checks.
- Ensure header comments retain the MIT license notice.
- Add descriptive comment...
[hathach/tinyusb] New branch created: copilot/fix-dependency-link-in-docs
Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.
Original prompt
This section details on the original issue you should resolve
docs: link to list of dependencies doesn't link correctly
Operating System
Linux
Commit SHA
21ed72bab119e0
Board
n/a
Firmware
n/a
What happened ?
๐ก Codex Review
Here are some automated review suggestions for this pull request.
โน๏ธ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with ๐.
Codex can also answer questions or update the PR. Try commenting
- @cod...
<sub><sub></sub></sub> Use fully qualified docname in :doc: link
The :doc: role expects a document name relative to the Sphinx source root, not a path relative to the current file. The target document lives at docs/reference/boards.rst, so its docname is reference/boards. Using :doc:the supported boards <boards>will raiseUnknown document: boards` and fail the docs build (or produce a broken link). This should inst...
<sub><sub></sub></sub> Dependency link also misses docname prefix
Similar to the board link above, :doc:complete list of dependencies โฆ <dependencies>omits thereference/prefix that is part of the document name. Because the file resides atdocs/reference/dependencies.rst, Sphinx will not find a doc named dependencies, breaking the internal cross-reference and failing the build. Use reference/dependencies` as the t...
What this PR does
Makes USB data transfer 2.6x faster by removing unnecessary data copying.
The change
Instead of copying data before sending it, we now send data directly from where it's stored.
Results
- Before: 10 MB/s (slow due to copying)
- After: 26.5 MB/s (fast - no copying)
- Improvement: 165% faster transfers
Why it matters
- Faster file transfers
- Smoother video streaming
- Better performance for sensors and medical devices
Tested on
...
NO ! Have you read what you've committed ? Why talking about vendor class but doing some nonsense modification on tusb.c ?
And NO you can't just remove a buffer and call it zero-buffer support ! Many MCU needs to put the buffer on specific memory section with special alignment requirement, like NXP LPC43xx, LPC55x, iMX.RT and STM32H7 etc... You are just lucky that it works on ch32v305.
Have you ever read what the macro TUD_EPBUF_DEF, CFG_TUD_MEM_ALIGN and CFG_TUD_MEM_SECTION does...
I don't think accessing ed in the done queue is much of an issue, especially this is only specific to your setup and this increased the footprint 2byte per TD.
Pull Request Overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
The anonymous bitfield should have a descriptive comment explaining what these 3 reserved bits represent, similar to how the original code documented the 2 reserved bits.
uint32_t : 3; // Reserved: not used by hardware, available for future use
The FIXME comment indicates a known issue where the wrong object size is used for cache invalidation. This should be properly addressed by determining the actual TD type and using the correct size, rather than relying on assumptions about cache line sizes.
// Use the correct object size for cache invalidation.
size_t td_size = sizeof(ohci_td_item_t);
// If there are other TD types, determine the type and set td_size accordingly.
// For example, if you have ohci_i...
I made changes to get uncached() centralized to get_ed(). @ArcaneNibble let me know if these still work with your set-up. I also think that current code does not work well with setup where ed is cacheable like TD. I found some missing dcache clean/invalidate, however, I don't have an mmu/cpu with virtual memory to test with at the moment. I will do that in follow up PR.
๐ก Codex Review
Here are some automated review suggestions for this pull request.
โน๏ธ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with ๐.
Codex can also answer questions or update the PR. Try commenting
- @cod...
<sub><sub></sub></sub> Invalidate HCCA before reading done queue
When OHCI_INT_WRITEBACK_DONEHEAD_MASK fires, done_queue_isr() reads ohci_data.hcca.done_head directly, sets it back to zero, and only later invalidates individual TDs while reversing the list. In dโcache enabled configurations the HCCA lives in cached RAM, so the controllerโs write to done_head can remain hidden in memory while the CPU keeps a cached zer...
This patch fixes an issue where USB interrupts were mistakenly disabled instead of enabled when the USB interrupt remap (usbintmap) was active.
Previously, the code called NVIC_DisableIRQ() for USBFS_MAPH_IRQn, USBFS_MAPL_IRQn, and USBFSWakeUp_IRQn, which prevented USB interrupts from working correctly after remapping.
The fix replaces those calls with NVIC_EnableIRQ() to properly enable the corresponding USB interrupts.
this makes sense, but we will resolve this in follow-up with better dcache op for ED
๐งฉ Description
This PR fixes incorrect handling of Zero-Length Packets (ZLP) in the DWC2 driver when receiving data (OUT transfers).
Previously, the DWC2 RX-FIFO transfer logic would misinterpret a ZLP as a full-size packet, causing the transfer to complete with the wrong size (equal to the requested buffer length rather than actual received bytes).
This issue was reported in #3154 (ESP32-S3 bulk transfer issues).
#...
what is the code changes besides comment ? can you elaborate ?
Pull Request Overview
This PR attempts to enable OHCI (Open Host Controller Interface) support for the LPC55 microcontroller family but notes it's not working properly, likely due to clock configuration issues. The implementation refactors the OHCI code to be more modular and adds LPC55 support alongside existing LPC17/40 support.
Key changes include:
- Refactoring OHCI hardware abstraction with a new
ohci_nxp.hheader - Adding LPC55 OHCI configuration and USB0 host mode support
- Rest...
This complex conditional logic is repeated multiple times in the file. Consider extracting it into a macro or helper function to improve readability and maintainability.
The #else block assumes any non-LPC17/40 MCU is LPC55, but this may not be true for future OHCI implementations. Consider adding an explicit MCU check for LPC55 to make the condition more specific.
This condition should also check if device mode is enabled (CFG_TUD_ENABLED) to avoid unnecessary initialization when only host mode is used.
Missing include for tusb_option.h which is required for the TU_CHECK_MCU macro. This will cause compilation errors.
#include "tusb_option.h"
๐ก Codex Review
Here are some automated review suggestions for this pull request.
โน๏ธ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with ๐.
Codex can also answer questions or update the PR. Try commenting
- @cod...
<sub><sub></sub></sub> Include CMakePrintHelpers or drop cmake_print_variables
cmake_print_variables is invoked during configuration without including the CMakePrintHelpers module. On a clean build this command is undefined and CMake stops before generating any targets, so none of the LPC55 examples can be configured. Either include CMakePrintHelpers or remove the debug print.
Useful? React with ๐ย / ๐.
<sub><sub></sub></sub> Avoid forcing USB1 into device mode when host uses port 1
The initialization for USB1 now runs when either the device or host selects port 1, but the body still configures the PHY and clocks for device mode (USBHSH->PORTMODE |= USBHSH_PORTMODE_DEV_ENABLE_MASK, device clock enables). For host builds that set BOARD_TUH_RHPORT == 1, this code flips the controller into device mode and never enables ho...
The logic is moved out of if (byte_count) { parentheses to apply also on ZLP (I didn't spot either until I check the full diff...)
@hathach
I've removed the part of writing data directly to the FIFO for single-packet IN transfers as I've spotted some issues with EP0 ep0_pending. I'll put that part in a new PR.
[hathach/tinyusb] New branch created: dwc2_ep0
Describe the PR
There was an issue in edpt_schedule_packets, as ep0_pending = xfer->max_size is set in dcd_edpt_xfer, ep0_pending will become 0.
if (epnum == 0) {
total_bytes = tu_min16(_dcd_data.ep0_pending[dir], xfer->max_size);
_dcd_data.ep0_pending[dir] -= total_bytes;
num_packets = 1;
}
The issue didn't broken since we schedule only one control transfer each time.
I've add an option CFG_TUD_EP0_BUFSIZE to allow setting EP0 buffer size indivi...
[hathach/tinyusb] Pull request review submitted: #3295 dcd/dwc2: fix EP0 multi-packet transfer logic
Pull Request Overview
This PR fixes EP0 multi-packet transfer logic in the DWC2 driver and adds configurable EP0 buffer size support. The issue was in the edpt_schedule_packets function where ep0_pending was incorrectly being set to xfer->max_size instead of the proper endpoint size, causing transfer size calculation errors.
Key changes:
- Added
CFG_TUD_EP0_BUFSIZEconfiguration option for EP0 buffer size - Fixed EP0 packet scheduling logic to use correct endpoint size
- Enhanced...
[nitpick] Missing space before opening brace. Should be } else { according to typical C style guidelines.
} else
[nitpick] Missing space before opening brace. Should be } else { according to typical C style guidelines.
} else
No trivial switch statements
This switch statement should either handle more cases, or be rewritten as an if statement.
No trivial switch statements
This switch statement should either handle more cases, or be rewritten as an if statement.
No trivial switch statements
This switch statement should either handle more cases, or be rewritten as an if statement.
No trivial switch statements
This switch statement should either handle more cases, or be rewritten as an if statement.
Duplicate of #977
Proposing we link there and close
Operating System
Linux
Commit SHA
8f2e3ed4418a08cc13aee4527b7bdd1b8bb1bf55, current master
Board
Pi Pico 1 / RP2040
Firmware
Custom firmware for FPGA Companion https://github.com/MiSTle-Dev/FPGA-Companion
Running inside FreeRTOS, using PIO-PICO-USB, also latest master
This is actually extensively used for the MiSTle retro gaming project, where TinyUSB is used on a rp2040 to control keyboard, mouse and joysticks in a FPGA retro gaming setup.
What happened ?
Some...
there is no way for me to reproduce this. Did the issue occur with standard PICO + ch334 hub breakout https://www.adafruit.com/product/5997?srsltid=AfmBOorxxg4urH2TaKiIJxCo9qGPV8zi_PXtvnmkGWHy3I9VnrJ7Jd9f
[hathach/tinyusb] New branch created: hil-increase-timeout-for-mtp
Describe the PR
A clear and concise description of what this PR solve.
Additional context
If applicable, add any other context about the PR and/or screenshots here.
I am aware that it's not easy to reproduce. I am not expecting you to debug this. But you may have some ideas and hints.
I'll try to reproduce this with a minimal setup and also see if different hubs or the rp2040's native port make a difference.
I'll report here about my findings.
please also try to reproduce it with standard pico + ch334 hub to rule out if it is hardware related issue as well.
Operating System
Windows 10
Commit SHA
331c263400dd5ccf77264cab1fa6bbd9f374b44e
Board
Adafruit Feather M0 (RFM95)
Firmware
https://github.com/maxgerhardt/samd21-usb-host-repro/
What happened ?
When starting up the TinyUSB stack configured for just USB host, and with only the CDC host driver enabled, no hubs, the enumeration of USB devices files with a timeout.
When using the same hardware with the USBHost library (https://github.com/arduino/ArduinoCore-samd/tree/...
Note: The config of the project in regards to CFG_TUH_HUB matches what is being told about TIMEOUTS in exactly the original PR https://github.com/hathach/tinyusb/pull/2573.
I use the exact same pin mode setup and clock setup as the USBHost library (this).
thanks for detailed report, can you do the quick check and run this repo stock example with cmake build e.g host/cdc_msc_hid or host/device_info to see if that works. Arduino core may need more glueing.
I compiled the host/device_info example for the feather_m0_express, with the addition that I changed
to be
// UART
#define UART_SERCOM 0
#define UART_RX_PIN 11
#define UART_TX_PIN 10
This seems to be a bug in all SAMD board.h, the UART_SERCOM is left undefined so it doesn't trigger the right code to activate UART logging, on top of that all RX /...
Some more results:
- the same happens in a minimal software setup, basically only running tinyusb on freertos
- the same happens with an off-the-shelf Pi-Pico with an off-the-shelf CH334 hub
- the same happens with a different hub
The same does not happen if I use the rp2040's native USB. So this may actually be a problem with pio-usb rather than the tinyusb stack itself.
Interestingly, some devices also don't enumerate anymore since I updated from the current pico-sdk to the latest tiny...
get cmake build with 54h20 not tested on actual hw, probably not running
Pull Request Overview
This PR adds initial support for the Nordic nRF54H20 microcontroller to TinyUSB, primarily focusing on getting CMake builds working. The changes introduce a new MCU variant (OPT_MCU_NRF54) and update the Nordic nRF ecosystem to support the newer nRF54 series alongside the existing nRF5X series.
- Updates Nordic nRFx dependency to a newer version that supports nRF54H20
- Introduces nRF54H20 board configuration and USB driver integration using DWC2 controller
- Refact...
The URL references nRF5340-DK but this board is for nRF54H20-DK. The URL should point to the correct nRF54H20 development kit documentation.
url: https://www.nordicsemi.com/Products/Development-hardware/nRF54H20-DK
The JLINK_DEVICE is set to nrf5340_xxaa_app but this should be nrf54h20_xxaa_app for the nRF54H20 board.
JLINK_DEVICE = nrf54h20_xxaa_app
๐ก Codex Review
Here are some automated review suggestions for this pull request.
โน๏ธ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with ๐.
Codex can also answer questions or update the PR. Try commenting
- @cod...
<sub><sub></sub></sub> Quote MCU variant checks in family.cmake
The new CMake logic compares MCU_VARIANT against literals without quoting them (if (MCU_VARIANT STREQUAL nrf5340 OR MCU_VARIANT STREQUAL nrf54h20)). In CMake an unquoted identifier is treated as a variable, so nrf5340 and nrf54h20 expand to empty strings. As a result the condition is always false and the cortexโM33/JLink settings for nrf5340 and nrf54h20 ...
[hathach/tinyusb] New branch created: qodana-automation-241005150
Adds qodana.yaml and GitHub workflow file that runs Qodana static analysis on each pull request.
Qodana Community for JVM
It seems all right ๐
No new problems were found according to the checks applied
โ๏ธ View the detailed Qodana report
<details>
<summary>Contact Qodana team</summary>
Contact us at qodana-support@jetbrains.com
- Or via our issue tracker: https://jb.gg/qodana-issue
- Or share your feedback: https://jb.gg/qodana-...
Interestingly, the enumeration issues that have come with the latest tinyusb/pio-usb only happens with a CPU clock < 156Mhz. At higher CPU speeds, these are gone. However, the hub/unplug issues seem to be unaffected by this.
[hathach/tinyusb] New branch created: change-qodana-linter
Describe the PR
A clear and concise description of what this PR solve.
Additional context
If applicable, add any other context about the PR and/or screenshots here.
๐ก Codex Review
Here are some automated review suggestions for this pull request.
โน๏ธ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with ๐.
Codex can also answer questions or update the PR. Try commenting
- @cod...
<sub><sub></sub></sub> Configure compile commands before using qodana-clang
Switching the linter to jetbrains/qodana-clang will break the existing Qodana workflow because the clang-based analyzers require a compile_commands.json or explicit build step to understand C/C++ sources. Neither the workflow nor this configuration produces such a databaseโthere is no compile database anywhere in the repositoryโso the Qodana job w...
[hathach/tinyusb] New branch created: revert-3300-qodana-automation-241005150
Reverts hathach/tinyusb#3300
This is pio timing/race condition. I fixed/improved a similar issue here https://github.com/sekigon-gonnoc/Pico-PIO-USB/pull/186 . Basically CPU does not reponse fast enough within USB timing specs and peer consider it as a timeout. Have you tried the stock example host/device_info on bare metal instead of freertos. I have never tried rp2040 with freertos
I haven't tested without freertos. But with my minimal test setup it shouldn't be too complex to do.
Unfortunately that won't be a solution for my application. But I'll give it a try, anyways.
Code Review - PR #3302: Revert "Add qodana CI checks"
Summary: โ ๏ธ Clean revert - but raises questions about CI strategy
Technical execution:
โ
Perfect revert:
- Cleanly removes both files (
.github/workflows/qodana_code_quality.ymlandqodana.yaml) - No stray changes or artifacts left behind
- 0 additions, -38 deletions as expected for a clean revert
Positive aspects:
- Fast turnaround: Merged within seconds of creation - shows effective decision maki...
Describe the PR
A clear and concise description of what this PR solve.
Additional context
If applicable, add any other context about the PR and/or screenshots here.
Pull Request Overview
This PR adds a new "Development Tools" section to the README documenting three third-party tools that are provided freely to support TinyUSB development.
The description should end with a period for consistency with the other tool descriptions in this section.
- `IAR Build Tools (CX) <https://iar.com>`_ Professional IDE and compiler for embedded development.
- `JetBrains CLion <https://www.jetbrains.com/clion/>`_ Cross-platform IDE for C and C++ development.
Removing FreeRTOS does not make a difference. Also, the HUB doesn't seem to matter and the device being plugged also doesn't matter.
What matters is whether the device being unplugged is actually being polled. This is the case for all of my HID devices, and thus this happens quite reliably for any HID device I unplug. This does not happen if I don't poll for HID reports.
I'd actually assume the HID Controller example would expose the same problem.
Removing FreeRTOS does not make a difference. Also, the HUB doesn't seem to matter and the device being plugged also doesn't matter.
What matters is whether the device being unplugged is actually being polled. This is the case for all of my HID devices, and thus this happens quite reliably for any HID device I unplug. This does not happen if I don't poll for HID reports.
I'd actually assume the HID Controller example would expose the same problem.
so which examples you are testin...
I am still using my own code, which is now reduced to the bare minimum and has actually less functionality left than any of the official examples.
There are a few things I do see happen. While tinyusb is retrying for the HUB unplug event, it keeps generating 0 byte application callbacks for the HID reports. My code immediately requests to receive the next request, just like the hid_controller demo does at https://github.com/hathach/tinyusb/blob/38255ffc3879e9aef12796ce25b58a2c654ce67d/exampl...
thank you for confirmation, I will test and get back to you later. I think I tested with samd51 previously, will try with the M0 this time.
This pull request refactors the build system integration for multiple example device projects, standardizing Makefile includes and improving toolchain support. The main focus is on replacing legacy build system includes with board family-specific ones, and unifying compiler flag handling for GCC and Clang.
Build system refactoring:
- All example device
Makefiles now includefamily_support.mkandfamily_rules.mkfrom the board support package (hw/bsp) instead of the previous gene...
Pull Request Overview
Refactors build system integration to standardize example Makefiles on new family_support/family_rules includes, consolidates compiler warning flag handling, introduces SAML2X MCU aliasing, adds new board families (SAME7X, EFM32), and adjusts various BSP and class headers for consistency and warning suppression. Key changes:
- Replaced legacy example Makefile includes with hw/bsp/family_support.mk and family_rules.mk; switched path variable CURRENT_PATH to EXAMPLE_PA...
The newly introduced callback tud_audio_int_xfer_cb lacks accompanying documentation/comments explaining its invocation timing, purpose (e.g. per packet transfer completion vs. final done), parameter semantics, and interaction with tud_audio_int_done_cb. Please add a brief doc comment consistent with other public audio callbacks (e.g. describing when TinyUSB calls it and expected user responsibilities) to avoid confusion for API consumers.
void tud_audio_int_done_cb(uint8_t rhpo...
The application-provided rndis_class_set_handler() prototype was moved here but has no description of the expected buffer format (RNDIS set messages), ownership/lifetime of data, or return/error handling expectations (void). Please add a short comment describing when TinyUSB invokes this, what 'data' contains, and whether the application may modify or must process synchronously.
#if CFG_TUD_ECM_RNDIS
/**
* Application callback invoked by TinyUSB when an RNDIS "Set" message is r...
๐ก Codex Review
https://github.com/hathach/tinyusb/blob/6a1117a8d85a6c029808a22ae53be1387ff2ce92/tools/get_deps.py#L43-L51
Update get_deps family list for samd2x_l2x
The boards formerly under saml2x were moved into the new samd2x_l2x family, but tools/get_deps.py still only looks for saml2x when deciding whether to clone the Microchip SDK and CMSIS dependencies. Calling tools/get_deps.py samd2x_l2x (or passing...
Since you are working on it, could you add this to family_support.cmake, IAR by default only define CC but not CMAKE_C_COMPILER
# Also check for CC env variable if set
if(DEFINED ENV{CC})
string(FIND $ENV{CC} "iccarm" IS_IAR)
string(FIND $ENV{CC} "clang" IS_CLANG)
string(FIND $ENV{CC} "gcc" IS_GCC)
if (NOT IS_GCC EQUAL -1)
set(TOOLCHAIN gcc)
elseif (NOT IS_CLANG EQUAL -1)
set(TOOLCHAIN clang)
elseif (NOT IS_IAR EQUAL -1)
set(TOOLCHAIN iar)
...
@HiFiPhile normally how you compile tinyusb example with cmake and iar. I normally usually specify it with -DCMAKE_C_COMPILER=iccarm
@HiFiPhile normally how you compile tinyusb example with cmake and iar. I normally usually specify it with -DCMAKE_C_COMPILER=iccarm
I use EWARM, by default it overrides CC
<img width="382" height="260" alt="image" src="https://github.com/user-attachments/assets/89bed765-ad47-4e48-b597-984084cc87ff" />
@HiFiPhile ah thanks, I will udpate the change in a seperated PR, which I plan to enable IAR c-stat (both with local and ci build). CMake 4.1 make run c-stat much easier https://github.com/iarsystems/cmake-tutorial/wiki/IAR-CโSTAT-Static-Analysis
Pull Request Overview
Copilot reviewed 251 out of 323 changed files in this pull request and generated 4 comments.
UART_TX_PIN is PB1 but UART_TX_FUNCTION corresponds to PB4 (MUX_PB4D_USART1_TXD1), which is a mismatched alternate function. Use the mux macro that matches PB1โs USART1 TX function to avoid configuring the wrong pad function.
#define UART_TX_FUNCTION MUX_PB1D_USART1_TXD1
family_flash_openocd_nuvoton sets OPENOCD_OPTION2, but family_flash_openocd uses OPENOCD_OPTION. As written, the '-s <tcl path>' is ignored. Rename OPENOCD_OPTION2 to OPENOCD_OPTION (or have family_flash_openocd consume both) to ensure the OpenOCD search path is passed.
The GetTick callback type (MFXSTM32L152_GetTick_Func) expects an unsigned 32-bit return (typically uint32_t). Defining i2c_get_tick() as int32_t creates an incompatible function pointer type and may trigger warnings or undefined behavior. Change to 'static uint32_t i2c_get_tick(void) { return HAL_GetTick(); }' to match the expected signature.
The GetTick callback type (MFXSTM32L152_GetTick_Func) expects an unsigned 32-bit return (typically uint32_t). Defining i2c_get_tick() as int32_t creates an incompatible function pointer type and may trigger warnings or undefined behavior. Change to 'static uint32_t i2c_get_tick(void) { return HAL_GetTick(); }' to match the expected signature.
static uint32_t i2c_get_tick(void) {
return HAL_GetTick();
๐ก Codex Review
https://github.com/hathach/tinyusb/blob/d96d468b55ae7db21740502059034300fb147638/hw/bsp/family_support.mk#L129-L141
Define FreeRTOS portable path before including CPU mk
The new family_support.mk includes ${TOP}/examples/build_system/make/cpu/$(CPU_CORE).mk at the top, but FREERTOS_SRC and FREERTOS_PORTABLE_PATH are only defined afterwards. The CPUโspecific makefiles compute `FREERTOS_PORTABLE_SR...
<sub><sub></sub></sub> Enabling ISO endpoint API without implementation breaks Nuvoton audio/video
This commit defines TUP_DCD_EDPT_ISO_ALLOC for the NUC120/121/505 families (see tusb_mcu.h), which makes the USB audio/video classes call usbd_edpt_iso_alloc() and usbd_edpt_iso_activate() at startup. However the corresponding driver implementations added here still return false and are tagged โTODO not implementedโ. B...
I just found my device that would send zero-length reports under normal circumstances. It's a competition pro USB joystick. This behavior is in the app callback indistinguishable from errors. I will open a separate issue on the topic of HID error replies.
But I also see an issue in the hub error handing here. Missing/lost hub reports are potentially critical. A missed unplug event is one example. Such errors would potentially break the entire application, break file transfers etc. I'd sugges...
@igrr it seems https://github.com/hathach/tinyusb/releases/tag/0.19.0 contains MTP.
when can we expect Support on ESP-IDF ? https://github.com/espressif/esp-idf
@jay94ks Hi, something is off with the stylus support, which makes
hid_compositeexample fails on Windows with errorThis device cannot start. (Code 10) A non constant main item was declared without a corresponding usage.The descriptor template have some major difference with Microsoft: https://learn.microsoft.com/en-us/windows-hardware/design/component-guidelines/supporting-usages-in-digitizer-report-descriptors
@HiFiPhile -- You commented within an issue that has been clo...
After verifying with my own USB stack, the same issue was reproduced. Since this likely isn't a TinyUSB problem, I'm closing this issue.
(Both HAL implementations are based on the official RP2040 sample, so a common cause within that remains a possibility.)
Related area
HID host class driver
Hardware specification
RP2040/PIO_USB
Is your feature request related to a problem?
I am having some trouble with HID host unplug events on RP2040/PIO_USB as described in #3296
Part of the problem is that the HID host driver has quite limited error reporting. Especially the fact that the result code is simply ignored:
As a result...
@jay94ks Hi, something is off with the stylus support, which makes
hid_compositeexample fails on Windows with errorThis device cannot start. (Code 10) A non constant main item was declared without a corresponding usage.
The descriptor template have some major difference with Microsoft: https://learn.microsoft.com/en-us/windows-hardware/design/component-guidelines/supporting-usages-in-digitizer-report-descriptors@HiFiPhile -- You commented within an issue that has been c...
Operating System
Linux
Commit SHA
no idea
Board
STM32F103 Bluepill
Firmware
Working on a custom implementation of "examples/device/cdc_dual_ports", I found an coding inconsistency.
What happened ?
In "src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c"
Two different initialisations of "ep_buf_ptr" variable defined in handle_bus_reset() and dcd_edpt_close_all().
static void handle_bus_reset(uint8_t rhport)
// Reset PMA allocation
ep_buf_ptr = FSDEV_BTABLE_BASE + ...
Alternately, one could return a pointer to the result itself in the error case like so:
tuh_hid_report_received_cb(daddr, idx, (XFER_RESULT_SUCCESS == result)?epbuf->epin:&result, (uint16_t) xferred_bytes);
This would allow to forward more information in the error case. The check on application side would then either check for len > 0 or for len == 0 and pointer pointing to XFER_RESULT_SUCCESS. In the long term additional information could be passed through that pointer without brea...
Great! I added terjr's changes and tested the steps in getting_started, and it seems fine.
I also tested the actual HTML rendering, but it seems some styling is missing locally (also in the original build).
I'm not sure about the FAQ page - while a project should have one, this is mostly generated, and I cannot really verify it. If in doubt we can just delete it for now.
Please review. :)
Thank you, actually CMake is more used today, either full command:
cmake -DBOARD=stm32f723disco -B build -G Ninja . # "-G Ninja" is required on Windows
cmake --build build
Or preset:
cmake --preset stm32f723disco
cmake --build --preset stm32f723disco
For esp32 only CMake works since their SDK only support CMake, whole step is:
- source esp-idf
- Enter example folder
- cmake --preset espressif_s3_devkitc
- cmake --build --preset espressif_s3_devkitc
Operating System
Windows 11
Commit SHA
331c263
Board
STM32F746G-DISCO
Firmware
Custom firmware with FreeRTOS and USBFS DWC2 driver (based on examples/uac2_headset)
What happened ?
On version v0.18.0, UAC2 examples & my custom firmware works with no problems.
On version v0.19.0 (and latest master) the software hangs in FreeRTOS assertion because taskENTER_CRITICAL() was called from ISR.
In dcd_edpt_xfer() there is a spinlock which assumes non-interrupt context.
`...
Thank you, actually CMake is more used today
Yes I noticed in testing that RP2040 also gives an error on make (similar to ESP32 probably).
Is there an equivalent to make ... all flash?
Thank you, that's something I've in mind but didn't have time to fix it.
You can remove usbd_spin_lock in dcd_dwc2.c for temporary workaround as it's only used for multi-core ESP32 MCUs.
@tore-espressif @hathach With the introduce of ISR transfer dcd_edpt_xfer can be called from ISR, usbd_spin_lock inside will case issues. What do you think, add an is_isr parameter or something else ?
Thank you, actually CMake is more used today
Yes I noticed in testing that RP2040 also gives an error on
make(similar to ESP32 probably).Is there an equivalent to
make ... all flash?
You can build all examples at once by cd into example parent folder tinyusb/examples/device then do the step above. For flashing with J-Link cmake --build --preset stm32h7s3nucleo --target audio_test_freertos-jlink
You can find other supported flasher in family_support.cmake
Thanks, I updated the docs to use CMake as default.
Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.
Original prompt
Fix issue #3311 by adding is_isr argument to dcd_edpt_xfer and dcd_edpt_xfer_fifo. If they are called in isr context then set is_isr to true otherwise false.
โจ Let Copilot coding agent [set things up for you](https://github.com/hathach/tinyusb/issues/new?title=โจ+Set+up+Copilot+instructions&body=Configure instructi...
@copilot
- revert all submodule changes
- Add is_isr argument to usbd_edpt_xfer and usbd_edpt_xfer_fifo, set it to true if called in ISR, for example audiod_rx_xfer_isr
@copilot
- revert all submodule changes
- Add is_isr argument to usbd_edpt_xfer and usbd_edpt_xfer_fifo, set it to true if called in ISR, for example audiod_rx_xfer_isr
Added is_isr parameter to usbd_edpt_xfer() and usbd_edpt_xfer_fifo() wrapper functions. ISR functions like audiod_rx_xfer_isr() and audiod_tx_xfer_isr() now pass true, while all other callers pass false. Submodule changes will be reverted in next commit. Commit: 27415e6
Operating System
Windows 11
Commit SHA
4dfac3f3566268450b46f1c19899b0b53bf48706
Board
ArteryTek AT32F405 Custom Board
Firmware
Custom firmware with this tusb_config.h
What happened ?
When the bus is suspended, the device does not receive the event DCD_EVENT_SUSPEND event received. However, when the bus is resumed, the device receives both DCD_EVENT_RESUME and DCD_EVENT_SUSPEND in the sam...
Pull Request Overview
This PR adds a bool is_isr parameter to the DCD and USBD transfer functions (dcd_edpt_xfer, dcd_edpt_xfer_fifo, usbd_edpt_xfer, and usbd_edpt_xfer_fifo) to indicate whether the functions are being called from ISR or task context. This enables proper synchronization handling by allowing the locking mechanism to differentiate between interrupt and non-interrupt contexts.
Key changes:
- Updated function signatures across DCD layer, USBD layer, and class d...
Unnecessary blank line added at the beginning of the file. This empty line serves no functional purpose and should be removed to maintain consistent file formatting across the codebase.
Unnecessary blank line added at the beginning of the file. This empty line serves no functional purpose and should be removed to maintain consistent file formatting across the codebase.
Unnecessary blank line added at the beginning of the file. This empty line serves no functional purpose and should be removed to maintain consistent file formatting across the codebase.
Unnecessary blank line added at the beginning of the file. This empty line serves no functional purpose and should be removed to maintain consistent file formatting across the codebase.
Unnecessary blank line added at the beginning of the file. This empty line serves no functional purpose and should be removed to maintain consistent file formatting across the codebase.
Unnecessary blank line added at the beginning of the file. This empty line serves no functional purpose and should be removed to maintain consistent file formatting across the codebase.
Unnecessary blank line added at the beginning of the file. This empty line serves no functional purpose and should be removed to maintain consistent file formatting across the codebase.
Unnecessary blank line added at the beginning of the file. This empty line serves no functional purpose and should be removed to maintain consistent file formatting across the codebase.
Unnecessary blank line added at the beginning of the file. This empty line serves no functional purpose and should be removed to maintain consistent file formatting across the codebase.
This pull request refactors the CMake build system for several AT32 board families and updates SCSI Mass Storage callbacks across multiple example projects for consistency and correctness. The key changes include standardizing board target creation, improving linker and startup file handling, and updating SCSI inquiry and command callbacks to use safer string operations and cleaner error handling.
Build System Refactoring (CMake):
- Replaces the
add_board_targetfunction with `family_...
๐ก Codex Review
Here are some automated review suggestions for this pull request.
โน๏ธ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with ๐.
Codex can also answer questions or update the PR. Try commenting "@code...
<sub><sub></sub></sub> Apply compile flags to undefined target in CH32V10x board setup
The refactor changed family_add_board so the compile options are now added with target_compile_options(${TARGET} PUBLIC -mcmodel=medany). Within this function there is no variable named TARGET; the parameter is BOARD_TARGET. At configure time CMake expands ${TARGET} to the empty string, so the command fails with "No TARGET specifi...
Hi, overall I'd encourage all users not to queue transfers from ISR. Adding IRQ path to endpoint API could break concurrency assumptions in USBD and DCD.
However, I see that in the audio class, this is intentional. So I guess providing a ISR-capable dcd_edpt_xfer is acceptable
what do you envision for buffer API changes?
- Add IAR CStat analyze with cmake -DIAR_CSTAT=1
- Fix some warnings suggestd by icstat and/or pvs-studio
- Add pvs-studio ci workflow to analyze
Pull Request Overview
This pull request adds static analysis support and addresses warnings identified by IAR C-STAT and PVS-Studio analyzers. The changes improve code quality through better type safety, proper variable scoping, and coding standard compliance.
Key changes:
- Added IAR C-STAT integration with CMake build system via
-DIAR_CSTAT=1flag - Added PVS-Studio CI workflow for automated static analysis
- Fixed type safety issues by adding unsigned suffixes to integer literals
#...
This comment is misleading and unclear. If the mask is 0, explain why the assignment operation on line 404 was removed, or clarify what 'mask is 0' means in this context. Consider: 'High speed configuration uses a mask value of 0, so no explicit assignment is needed' or document the register behavior.
// High-speed configuration: DCFG_DSPD mask is 0, so no explicit assignment is needed.
// The register defaults to high-speed mode per DWC2 specification.
Changing LED active_state from 1 to 0 inverts the LED logic. This appears to be a hardware-specific correction rather than a static analysis fix. Ensure this change matches the actual hardware configuration for this board, as this will affect LED behavior throughout the application.
.active_state = 1
Hi! I am using v0.19 with an esp32 + max3421 and same happens to me (sometimes not rx cb and sometimes only one).
But I guess it is because the HOST stops polling for some reason.
I will upload the USB captured data.
The window between the end of the enumeration and all the SOF timaouts at the end, I managed to receive one small thing. However, the IN transaction no longer occurs, and that is why the RX callback is not being called.
Maybe I am dumb enough not to ralize the error.
[scan_t...
BTW, debugging and trying to solve the issue, I have added a TU_LOG in uint32_t tu_edpt_stream_read_xfer(uint8_t hwid, tu_edpt_stream_t* s) just before the if (available >= mps) statement
And, all the the RX callbacks are called properly and the host keeps polling the device.
Describe the PR
Fix #3315 by only process SUSPEND event if the device is connected. Tested locally to confirm that _usb_dev state is as intended when the bus is suspended and resume. We probably don't need to repeat this change for RESUME event since enabling suspend interrupt during initialization should have no side effect.
Closes #3315
In TinyUSB's structure, DCD layer shouldn't call exported device stack functions (tud_*)
I found the cause of the issue. On initialization, AT32F405 receives a suspend interrupt once (usbsusp = usbsuspm = 1) before the device is connected. As a result, dcd_int_handler disables the suspend interrupt, even though the device is still unconnected.
When plugging/u...
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests wi...
Consider inspecting the '1u << epnum' expression. Bit shifting of the 32-bit value with a subsequent expansion to the 64-bit type.
Consider inspecting the '1u << epnum' expression. Bit shifting of the 32-bit value with a subsequent expansion to the 64-bit type.
The size of the bit mask is less than the size of the first operand. This will cause the loss of higher bits.
In TinyUSB's structure, DCD layer shouldn't call exported device stack functions (tud_*)
I found the cause of the issue. On initialization, AT32F405 receives a suspend interrupt once (usbsusp = usbsuspm = 1) before the device is connected. As a result, dcd_int_handler disables the suspend interrupt, even though the device is still unconnected.
When ...
I think you can simply write like this, otherwise pending Enum Done interrupt will trigger the IRQ again:
if (gintsts & GINTSTS_ENUMDNE) {
// ENUMDNE is the end of reset where speed of the link is detected
dwc2->gintsts = GINTSTS_ENUMDNE;
// There may be a pending suspend event, so we clear it first
dwc2->gintsts = GINTSTS_USBSUSP;
dwc2->gintmsk |= GINTMSK_USBSUSPM;
handle_enum_done(rhport);
}
Quality Gate failed
Failed conditions
[3 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=hathach_tinyusb&pullRequest=3318&issueStatuses=O...
I think you can simply write like this, otherwise pending Enum Done interrupt will trigger the IRQ again:
if (gintsts & GINTSTS_ENUMDNE) { // ENUMDNE is the end of reset where speed of the link is detected dwc2->gintsts = GINTSTS_ENUMDNE; // There may be a pending suspend event, so we clear it first dwc2->gintsts = GINTSTS_USBSUSP; dwc2->gintmsk |= GINTMSK_USBSUSPM; handle_enum_done(rhport); }
Right, I wasn't aware you ...
Quality Gate failed
Failed conditions
[3 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=hathach_tinyusb&pullRequest=3318&issueStatuses=O...
Quality Gate failed
Failed conditions
[3 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=hathach_tinyusb&pullRequest=3318&issueStatuses=O...
GitHub Actions should not be vulnerable to script injections
<!--SONAR_ISSUE_KEY:AZoa5C82ThBsx1TgKukA-->Change this action to not use user-controlled data directly in a run block. <p>See more on <a href="https://sonarcloud.io/project/issues?id=hathach_tinyusb&issues=AZoa5C82ThBsx1TgKukA&open=AZoa5C82ThBsx1TgKukA&pullRequest=3318">SonarQube Cloud</a></p>
GitHub Actions should not be vulnerable to script injections
<!--SONAR_ISSUE_KEY:AZoa5C82ThBsx1TgKuj_-->Change this action to not use user-controlled data directly in a run block. <p>See more on <a href="https://sonarcloud.io/project/issues?id=hathach_tinyusb&issues=AZoa5C82ThBsx1TgKuj_&open=AZoa5C82ThBsx1TgKuj_&pullRequest=3318">SonarQube Cloud</a></p>
GitHub Actions should not be vulnerable to script injections
<!--SONAR_ISSUE_KEY:AZoa5qA3ThBsx1TgKxzg-->Change this action to not use user-controlled data directly in a run block. <p>See more on <a href="https://sonarcloud.io/project/issues?id=hathach_tinyusb&issues=AZoa5qA3ThBsx1TgKxzg&open=AZoa5qA3ThBsx1TgKxzg&pullRequest=3318">SonarQube Cloud</a></p>
Quality Gate failed
Failed conditions
[3 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=hathach_tinyusb&pullRequest=3318&issueStatuses=O...
Thanks, seems to be working good now.
Have you considered an approach which would add (in the osal/port layer) a function that checks if program is executing in ISR context? Like: __get_IPSR() for Cortex-M? That would get rid of all these flags in many functions. I dont know if that would be possible on every architecture that tinyusb supports (but seems that cortex is most popular).
Quality Gate failed
Failed conditions
[3 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=hathach_tinyusb&pullRequest=3318&issueStatuses=O...
Quality Gate failed
Failed conditions
[4 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=hathach_tinyusb&pullRequest=3318&issueStatuses=O...
The operands lba' and DISK_BLOCK_NUM' have essential type categories unsigned 32-bit int and signed 8-bit int, which do not match
Implicit conversion of `{TUD_CONFIG_DESCRIPTOR,TUD_CONFIG_DESCRIPTOR,((TUD_CONFIG_DESC_LEN+(TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN)+(TUD_MSC_DESC_LEN+TUD_MSC_DESC_LEN+TUD_MSC_DESC_LEN))&TU_U16_LOW),(((TUD_CONFIG_DESC_LEN+(TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_DESC_LEN+TUD_CDC_...
Quality Gate failed
Failed conditions
[3 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=hathach_tinyusb&pullRequest=3318&issueStatuses=O...
[hathach/tinyusb] New branch created: more-sast
This pull request updates the static analysis workflow and configuration to improve code quality checks and optimize CI resource usage. The most significant changes include restricting workflow triggers to relevant directories, adding a Qodana static analysis job, and updating SonarQube exclusions.
Static Analysis Workflow Improvements:
- The
.github/workflows/static_analysis.ymlworkflow now only runs for changes insrc/**,examples/**, andhw/bsp/**directories, reducing u...
Pull Request Overview
This PR adds Qodana static analysis to the CI workflow and optimizes the static analysis configuration by limiting when it runs and what it analyzes.
Key changes:
- Restricts static analysis workflow to only run on changes in
src/,examples/, andhw/bsp/directories - Adds a new Qodana static analysis job that scans the
mimxrt1060_evkboard example - Excludes external dependencies (
lib/**,hw/mcu/**,test/**) from SonarQube analysis
Reviewed C...
The args parameter uses comma separators ('--image,jetbrains/qodana-clang:2025.2-eap') which is non-standard YAML syntax. According to Qodana action documentation, this should be a proper YAML list. Use standard YAML list syntax: args: | with newline-separated arguments or args: ['--image', 'jetbrains/qodana-clang:2025.2-eap'].
args: ['--image', 'jetbrains/qodana-clang:2025.2-eap'] # Community version
No application code in the PR โ skipped Code Health checks.
See analysis details in CodeScene
Quality Gate Profile: Clean Code Collective
Want more control? Customize Code Health rules or catch issues early wi...
No application code in the PR โ skipped Code Health checks.
See analysis details in CodeScene
Quality Gate Profile: Clean Code Collective
Want more control? Customize Code Health rules or catch issues early wi...
๐ก Codex Review
https://github.com/hathach/tinyusb/blob/cec8661a31f28cffba568232c458ae544d8b7ecc/.github/workflows/static_analysis.yml#L254-L258
<sub><sub></sub></sub> Guard Qodana checkout for nonโPR events
The new Qodana job runs for both push and pull_request triggers, but the checkout step unconditionally references github.event.pull_request.head.sha. On push events this object is undefined, so the expression...
No application code in the PR โ skipped Code Health checks.
See analysis details in CodeScene
Quality Gate Profile: Clean Code Collective
Want more control? Customize Code Health rules or catch issues early wi...
Quality Gate failed
Failed conditions
[1 Security Hotspot](https://sonarcloud.io/project/security_hotspots?id=hathach_tinyusb&pullRequest=3320&issueStatuses=OP...
Quality Gate failed
Failed conditions
[1 Security Hotspot](https://sonarcloud.io/project/security_hotspots?id=hathach_tinyusb&pullRequest=3320&issueStatuses=OP...
Gates Passed
4 Quality Gates Passed
See analysis details in CodeScene
Quality Gate Profile: Clean Code Collective
Want more control? [Customize Code Health rules](https://codescene.io/docs/guides/technical/code-health.html#adapt-code-health-to-your-coding-standards...
Gates Passed
4 Quality Gates Passed
See analysis details in CodeScene
Quality Gate Profile: Clean Code Collective
Want more control? [Customize Code Health rules](https://codescene.io/docs/guides/technical/code-health.html#adapt-code-health-to-your-coding-standards...
Define or undefine of reserved identifier
Quality Gate failed
Failed conditions
[36.4% Duplication on New Code](https://sonarcloud.io/component_measures?id=hathach_tinyusb&pullRequest=3320&metric=new_d...
Gates Passed
4 Quality Gates Passed
See analysis details in CodeScene
Quality Gate Profile: Clean Code Collective
Want more control? [Customize Code Health rules](https://codescene.io/docs/guides/technical/code-health.html#adapt-code-health-to-your-coding-standards...
Quality Gate failed
Failed conditions
[36.4% Duplication on New Code](https://sonarcloud.io/component_measures?id=hathach_tinyusb&pullRequest=3320&metric=new_d...
Gates Passed
4 Quality Gates Passed
See analysis details in CodeScene
Quality Gate Profile: Clean Code Collective
Want more control? [Customize Code Health rules](https://codescene.io/docs/guides/technical/code-health.html#adapt-code-health-to-your-coding-standards...
Quality Gate failed
Failed conditions
[36.4% Duplication on New Code](https://sonarcloud.io/component_measures?id=hathach_tinyusb&pullRequest=3320&metric=new_d...
Gates Passed
4 Quality Gates Passed
See analysis details in CodeScene
Quality Gate Profile: Clean Code Collective
Want more control? [Customize Code Health rules](https://codescene.io/docs/guides/technical/code-health.html#adapt-code-health-to-your-coding-standards...
Quality Gate failed
Failed conditions
[27.9% Duplication on New Code](https://sonarcloud.io/component_measures?id=hathach_tinyusb&pullRequest=3320&metric=new_d...
Gates Passed
4 Quality Gates Passed
See analysis details in CodeScene
Quality Gate Profile: Clean Code Collective
Want more control? [Customize Code Health rules](https://codescene.io/docs/guides/technical/code-health.html#adapt-code-health-to-your-coding-standards...
Quality Gate failed
Failed conditions
[19.4% Duplication on New Code](https://sonarcloud.io/component_measures?id=hathach_tinyusb&pullRequest=3320&metric=new_d...
Gates Passed
4 Quality Gates Passed
See analysis details in CodeScene
Quality Gate Profile: Clean Code Collective
Want more control? [Customize Code Health rules](https://codescene.io/docs/guides/technical/code-health.html#adapt-code-health-to-your-coding-standards...
Quality Gate failed
Failed conditions
[0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=hathach_tinyusb&pullRequest=3320&metric=new_cover...
Gates Passed
4 Quality Gates Passed
See analysis details in CodeScene
Quality Gate Profile: Clean Code Collective
Want more control? [Customize Code Health rules](https://codescene.io/docs/guides/technical/code-health.html#adapt-code-health-to-your-coding-standards...
Quality Gate failed
Failed conditions
[0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=hathach_tinyusb&pullRequest=3320&metric=new_cover...
Gates Passed
4 Quality Gates Passed
See analysis details in CodeScene
Quality Gate Profile: Clean Code Collective
Want more control? [Customize Code Health rules](https://codescene.io/docs/guides/technical/code-health.html#adapt-code-health-to-your-coding-standards...
Quality Gate failed
Failed conditions
[0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=hathach_tinyusb&pullRequest=3320&metric=new_cover...
Quality Gate failed
Failed conditions
[1 Security Hotspot](https://sonarcloud.io/project/security_hotspots?id=hathach_tinyusb&pullRequest=3320&issueStatuses=OP...
โ New issue: Deep, Nested Complexity
edpt_schedule_packets has a nested complexity depth of 4, threshold = 4
<sub>[Suppress](https://codescene.io/projects/37161/delta?repo-id=115424&review-id=3295&biomarker=Deep%2C+Nested+Complexity&filename=src%2Fportable%2Fsynopsys%2Fd...
โ Getting worse: Complex Method
edpt_schedule_packets increases in cyclomatic complexity from 12 to 15, threshold = 9
<sub>[Suppress](https://codescene.io/projects/37161/delta?repo-id=115424&review-id=3295&biomarker=Complex+Method&filename=src%2Fportable%2Fsynopsys%2Fdwc2%2Fdcd_dwc...
The operands xferred_bytes' and CFG_TUD_ENDPOINT0_SIZE' have essential type categories unsigned 32-bit int and signed 8-bit int, which do not match
The '(MS_OS_20_SET_HEADER_DESCRIPTOR)' named constant with the value of 0 is used in the bitwise operation.
The '(MS_OS_20_SET_HEADER_DESCRIPTOR)' named constant with the value of 0 is used in the bitwise operation.
Describe the PR
This PR adds a tud_audio_set_ep_in_target_fifo_size function that allows the user to set the target fifo level of the EP IN flow control.
Additional context
For applications that require dynamic configuration of the audio EP IN, having the target fifo size set to half of the fifo depth can be limiting. In some cases the input latency might be very big. This MR aims to add the ability to configure this value at run time using the `tud_audio_set_ep_in_target_fifo_...
Gates Failed
Prevent hotspot decline
(1 hotspot with Complex Method)
Enforce advisory code health rules
(1 file with Complex Method)
Gates Passed
2 Quality Gates Passed
See analysis details in CodeScene
Reason for failure
| Prevent hotspot decline |...
โ Getting worse: Complex Method
audiod_set_interface already has high cyclomatic complexity, and now it increases in Lines of Code from 163 to 164
<sub>[Suppress](https://codescene.io/projects/37161/delta?repo-id=115424&review-id=3321&biomarker=Complex+Method&filename=src%2Fclass%2Faudio%2Fa...
Thank you, it's something I've in mind (also for OUT transfer)
[hathach/tinyusb] Pull request review submitted: #3295 dcd/dwc2: fix EP0 multi-packet transfer logic
I forgot most of the dwc2 driver, didn't re-check the specs. These are 2 things pop-up in my mind when we are making control transfer faster like bulk.
PS: also I enable a few code scanning tools (free for OSS), still testing it out, so it can be very noisy atm
I think we should keep using the TXFE interrupt to write to fifo. Otherwise there could be race condition whereas usbd mis-manage control transfer, and we are attempting to xfer on busy endpoint0.
also I think we need to also increase (double) the dfifo_alloc() for EP0 when the EP0_BUFSIZE is large enough e.g 8x64 bytes since user is clearly want to make a large transfer with EP0
I think we should not pre-calculate the pending, we should just store the total_bytes and minus xferred_bytes in complete isr instead like other bulk transfers
I think we should keep using the TXFE interrupt to write to fifo. Otherwise there could be race condition whereas usbd mis-manage control transfer, and we are attempting to xfer on busy endpoint0.
I think it should be safe, which scenario you are thinking about ?
also I think we need to also increase (double) the dfifo_alloc() for EP0 when the EP0_BUFSIZE is large enough e.g 8x64 bytes since user is clearly want to make a large transfer with EP0
EP0 can't only queue 3 packets eac...

[0 New issues](