Commit Graph

434 Commits

Author SHA1 Message Date
fa1fee0a5f migrate NXP Kinetis khci to chipidea ci_fs driver (device + host)
Complete the khci -> chipidea ci_fs migration that was started for device
(commit d70403f1f "host is not yet"):

- device: switch kinetis_k/kl/k32l (Makefiles + k32l CMake) to dcd_ci_fs.c
- host: add hcd_ci_fs.c (port of hcd_khci.c onto ci_fs_regs_t) and switch all
  Kinetis families to it; remove src/portable/nxp/khci entirely
- enable host examples (device_info, cdc_msc_hid) for mcu:KINETIS_K
- README: merge the KL and K32L2 rows into a single "KL, K32L" ci_fs row

hcd_ci_fs.c also fixes two pre-existing host bugs found via HIL on frdm_k64f
(present in the old hcd_khci.c too):
- data toggle was flipped on a NAK in suspend_transfer; a NAK transfers no
  data so the toggle must be preserved, else the retried bulk packet is
  silently discarded by the device (MSC CBW/CSW hang). See comment in file.
- prepare_packets asserted and dropped a transfer when the single shared BDT
  was still owned by an in-flight transfer under concurrent activity; now it
  returns busy and resume_transfer defers/retries on the next SOF.

HIL verified on frdm_k64f: device 13/13, host cdc_msc_hid (CDC mount + echo +
MSC mount, through a hub).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ExGPLP5eU43LR7o6yYLpNi
2026-07-17 17:26:02 +07:00
ba32b46ebd docs: address Copilot review on the example READMEs
- Order CFG_TUH_DEVICE_MAX before CFG_TUH_HID in the host config snippets
  (cdc_msc_hid, hid_controller) so the documented snippet has no forward
  macro reference when copied into tusb_config.h.
- Fix stale `examples.rst` references: the generator now writes per-group
  `docs/examples/<group>/index.rst` pages, so update the conf.py comment and
  the build-doc SKILL.md accordingly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 10:42:41 +07:00
4b1c8d16f7 docs: add build-doc tooling and a README for every example
Documentation tooling:
- Add the `build-doc` skill and `tools/build_doc.py` wrapper for local
  Sphinx builds (clean / -W / open).
- Enable Markdown (MyST) in conf.py and auto-collect
  examples/{device,host,dual}/*/README.md into a 3-level Examples nav
  (Examples > Device/Host/Dual > example), noting each page's source
  location and normalizing headings to a single H1.
- Remove the stale `.claude/commands/build-doc.md`; point the AGENTS.md
  Documentation section at the skill.

Example docs:
- Add a README.md for every device/host/dual example: what it does, USB
  interface table, notable tusb_config.h settings, generic CMake + Make
  build steps, and how to try it.
- Fold each *_freertos variant into its base README, noting the FreeRTOS
  source path and any RTOS-specific behavior.

Generated docs/examples/ output is git-ignored. Builds clean with
`sphinx-build -W`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 10:16:25 +07:00
5145b67f79 Merge remote-tracking branch 'origin/master' into stm32c5
# Conflicts:
#	README.rst
2026-06-11 17:20:15 +07:00
fc933e341d midi2_host: silence IAR Pe550 for midi2_idx
The variable is set in mount/umount callbacks but not read elsewhere
in the example (rx_cb already receives idx as a parameter). IAR
treats Pe550 as an error under --warnings_are_errors. Tag it
TU_ATTR_UNUSED so the example still shows the pattern of tracking
the device index without erroring on unused-set.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-30 00:46:16 +07:00
0761df7420 midi2_host: drop unreachable return 0 for IAR Pe111
Same fix as midi2_device — IAR rejects the unreachable statement
after the while(1) superloop. Let int main fall off the end.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-30 00:42:14 +07:00
28beb0fe4d ci: fix IAR Pe111 and stm32h7s3 flash overflow
- examples/device/midi2_device/src/main.c: drop the unreachable
  `return 0;` after the `while(1)` superloop. IAR with
  --warnings_are_errors rejects Pe111 (statement is unreachable);
  C99 lets `int main` fall off the end, matching midi_test.

- examples/host/msc_file_explorer_freertos/skip.txt: skip
  stm32h7s3nucleo. The board has only 64 KB on-chip FLASH and the
  FreeRTOS + FatFS host MSC explorer now overflows by ~248 bytes
  after the async control queue refactor.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-30 00:11:19 +07:00
3be8226b18 Merge branch 'master' into usbh-add-control-queue 2026-05-29 23:55:25 +07:00
c954c8c4c7 remove sync() in tinyusb callback since it cause issue with RTOS when usbh task is blocking 2026-05-28 18:20:22 +07:00
44a897bff0 Fix typo in CDC stack size constant here too 2026-05-26 17:25:10 +02:00
d4aa0dd653 Merge remote-tracking branch 'tinyusb/master' into stm32c5
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2026-05-24 18:46:26 +02:00
116395a1b2 bsp: fix tcpp0203 lto uninit error
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2026-05-17 14:05:03 +02:00
2a58e8256e midi2: skip.txt comments 2026-05-16 22:54:25 -03:00
7cf579dd49 midi2: skip 3 more boards with same tcpp0203 BSP bug
stm32h573i_dk, stm32n657nucleo and stm32n6570dk have the same
pre-existing uninitialized io_ctx.GetTick in their board.h that we
already skip on stm32h7s3nucleo. Trips with Make+LTO; CMake passes.
2026-05-16 22:37:45 -03:00
7c214f9d4f midi2: add sources to TINYUSB_SRC_C, skip family
Make build was missing midi2_device.c/midi2_host.c from
src/tinyusb.mk. Skip stm32h7s3nucleo board which exposes a
pre-existing uninitialized warning in its board.h (board_init2)
under Make+LTO.
2026-05-16 21:35:21 -03:00
214de5181c midi2: fix CI matrix with only.txt and skip.txt
Restrict midi2_host build to MCUs with USB host support (cloned from
midi_rx) and skip SAMD11 from midi2_device (ROM overflow on link).
2026-05-16 20:39:20 -03:00
3efac1b28c midi2: host example - simplify and rename to midi2_host
Drop Feather-specific scaffolding (SSD1306 display, font, PIO-USB pin
override) and rename the directory to midi2_host. The example is now a
single main.c + tusb_config.h pair following the midi_rx pattern, with a
printf-only UMP decoder for Channel Voice messages.

Build-tested on adafruit_feather_rp2040_usb_host, daisyseed (stm32h7),
mimxrt1010_evk, stm32f407disco, raspberry_pi_pico2, b_u585i_iot2a,
portenta_c33, stm32h503nucleo, stlinkv3mini, feather_stm32f405.

Ref #3571
2026-05-16 13:00:30 -03:00
b4880761bc refactor: replace midi2_host (Waveshare) with midi2_host_feather
Remove the Waveshare RP2350-USB-A host example and board definition.
The Feather RP2040 USB Host is the TinyUSB reference board for
PIO-USB host and does not require the CFG_TUSB_DEBUG workaround
needed by the Waveshare (R13 pull-up issue).

One host example is sufficient for the PR. The Feather variant has
an improved display with splash, spinner, and 6-line live view.
2026-05-12 11:07:45 -03:00
c4847006db fix: skip midi2_host_feather build on non-RP2040 platforms
The Makefile was missing the FAMILY=rp2040 guard, causing CI failures
on stm32h7rs and other non-RP2040 targets. Matches the approach used
by midi2_host.
2026-05-12 11:07:44 -03:00
13c6f6a2c7 example: add MIDI 2.0 Host example for Adafruit Feather RP2040 USB Host
Board-specific variant of midi2_host targeting the Adafruit Feather
RP2040 with USB Type A Host (product 5723).

Hardware differences from the Waveshare RP2350-USB-A example:
- PIO-USB on GP16/GP17 (vs GP12/GP13)
- I2C1 via STEMMA QT on GP2/GP3 (vs I2C0 GP4/GP5)
- USB Host 5V power enable on GP18

Display uses three phases: splash screen, spinner while waiting for
a device, then live scrolling UMP message view with 6 visible lines.

Tested board-to-board: RP2040 Pico (Device) to Feather RP2040 (Host),
SSD1306 128x64 OLED showing decoded MIDI 2.0 messages in real time.
2026-05-12 11:07:44 -03:00
f8a5fc37f3 fix: CI build failures on non-RP2040 platforms
- Use UINT32_C(1) instead of 1u for bit shifts >= 16 in
  midi2_device.c to avoid shift-count-overflow on 16-bit
  platforms (MSP430)
- Add Makefiles for midi2_device and midi2_host examples with
  family guard (skip if FAMILY != rp2040). These examples
  require Pico SDK and board-specific hardware
- Restrict midi2_device CMakeLists.txt to rp2040 family
  (matching midi2_host)
2026-05-12 11:07:44 -03:00
fa9edeff9c fix: address PR review feedback for MIDI 2.0 drivers
Host driver (midi2_host.c):
- midih2_open() now returns actual parsed length instead of max_len,
  preventing composite device interface conflicts
- Parsers (alt0/alt1) refactored to return const uint8_t* end pointer
  following midi_host.c switch/case pattern
- Alt 1 CS Endpoint now parses MIDI 2.0 layout (bNumGrpTrmBlk at
  offset 3 with MIDI_CS_ENDPOINT_GENERAL_2_0 subtype check) instead
  of reusing MIDI 1.0 struct (bNumEmbMIDIJack)
- midih2_set_config() now issues SET_INTERFACE control request via
  tuh_interface_set() before completing configuration. Falls back to
  alt 0 if SET_INTERFACE fails
- Extracted midih2_set_config_complete() and midih2_set_interface_cb()
  for async SET_INTERFACE handling

Device driver (midi2_device.c):
- midi2d_open() skip loop now checks bInterfaceNumber, stopping at
  interfaces that belong to other functions in composite devices
- SET_INTERFACE handler now rejects alt > 1 (returns false/stall)
- Named constants for GTB descriptor types and MIDI protocol values

Descriptor macros (usbd.h):
- TUD_MIDI2_DESC_ALT1_HEAD: iInterface set to 0 (consistent with
  Alt 0), wTotalLength now uses TUD_MIDI2_DESC_ALT1_CS_LEN to cover
  all Alt 1 class-specific descriptors
- TUD_MIDI2_DESC_ALT1_EP: now accepts GTB ID list via variadic args,
  emitting complete CS endpoint descriptor

Host example:
- CMakeLists.txt restricted to rp2040 family (display.c requires
  Pico SDK headers)
- display.c: null terminator after strncpy in log scroll

Documentation:
- class_drivers.rst updated to reflect SET_INTERFACE behavior and
  auto-select with fallback

Addresses: Codex P1 (#1, #2, #3), Copilot (#4-#9)
2026-05-12 11:07:44 -03:00
d5c5ac586b example: add MIDI 2.0 Host example with display (midi2_host)
Add Host example that receives UMP from a MIDI 2.0 Device via PIO-USB
and displays received messages on a SSD1306 OLED (I2C, 128x64).

Features:
- Boot checklist on display (PWR, TinyUSB, USB bus, Device, Descriptor,
  Alt Setting UMP, Mount, Receiving)
- Decode and display all MIDI 2.0 Channel Voice messages
- PIO-USB Host on rhport 1 (GP12/GP13 for Waveshare RP2350-USB-A)
- SSD1306 display via I2C0 (GP4=SDA, GP5=SCL)

Also add board definition for Waveshare RP2350-USB-A.

Tested: Waveshare RP2350-USB-A (Host) receiving UMP from Raspberry Pi
Pico (Device) via USB cable, notes displayed on SSD1306 OLED
2026-05-12 11:07:44 -03:00
4242ef7ac6 Merge remote-tracking branch 'tinyusb/master' into stm32c5 2026-05-11 21:11:28 +02:00
5ea1979e29 add stm32c5 support
Signed-off-by: HiFiPHile <admin@hifiphile.com>
2026-05-10 14:17:00 +02:00
f61b99f479 Apply suggestions from code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-05 11:36:41 +02:00
db084551cf add msc_file_explorer_freertos example
Co-authored-by: Copilot <copilot@github.com>
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2026-05-03 20:25:40 +02:00
5da96a38f0 fix ci 2026-04-14 14:04:07 +07:00
b55786e43a refactor rp2040 family.cmake to use family_configure_example() and apply WARN_FLAGS to tinyusb sources and examples sources only (skip 3rd party library and mcu vendor) 2026-04-14 13:17:12 +07:00
44b0ee0539 get freertos working with rp2040 2026-04-14 10:51:20 +07:00
4c7a9fed96 remove IAR toolchain support from make build system
IAR is only supported with CMake. Remove all IAR-specific references
from the Make build system including toolchain files, SRC_S_IAR,
LD_FILE_IAR variables, and IAR toolchain detection.

Also fix GET_SECTOR_COUNT truncation in msc_file_explorer and
broken formatting in stm32f7 board_uart_write.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 11:17:34 +07:00
751f465a39 Merge pull request #3581 from non-bin/master
Update FatFS to R0.16
2026-04-05 13:39:29 +07:00
9368e5d40f fix issue with exmaple 2026-04-03 10:45:16 +07:00
134e14849b fix hil host cdc echo test with imxrt and other fast mcu 2026-04-03 10:45:13 +07:00
b77632ebff update FatFS to R0.16 via abbrev/fatfs dependency
- Add lib/fatfs to deps_mandatory in get_deps.py, pinned to R0.16
  (commit 30ca13c6) from github.com/abbrev/fatfs mirror
- Move TinyUSB custom ffconf.h to examples/host/msc_file_explorer/src/
  with project-specific settings: FF_CODE_PAGE=437, FF_USE_LFN=1,
  FF_FS_RPATH=2, FF_VOLUMES=4, FF_FS_NORTC=1
- get_deps.py removes stock ffconf.h after clone to avoid conflict
- Remove vendored fatfs source files from git tracking

FatFS R0.16 includes important fixes since R0.15:
- Fixed FAT32 FsInfo regression (forced full FAT scan on f_getfree)
- Fixed f_readdir infinite loop (from R0.15b)
- f_getcwd/.. now works on exFAT
- Added FF_FS_CRTIME support
2026-04-02 17:32:45 +07:00
78d34d5b64 reduce code size, use state to replace active + pending 2026-04-01 17:47:01 +07:00
15eef94df0 add rp2040 sof + stop_trans on nak. increase nak_poll fs/ls delay to 300 us to prevent xfer is ack while stopping. 2026-03-23 17:57:41 +07:00
3c2627e739 update host msc hil test 2026-03-23 15:43:47 +07:00
99d70e2990 Add dd command to MSC file explorer for sector read and speed reporting, adjust CLI configuration and HIL tests 2026-03-20 18:57:02 +07:00
45e80a1042 add hil test for host msc and cdc 2026-03-17 21:38:46 +07:00
7ce1e78204 actual build make/cmake for ft9xx 2026-03-13 18:11:59 +07:00
aa1535a226 add support for CH32F20X MCU and update board configuration 2026-03-13 12:18:27 +07:00
e658e23435 fix CI
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2026-03-06 17:19:05 +01:00
860f0e01f2 Merge remote-tracking branch 'tinyusb/master' into hcd_ip3516
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2026-03-06 15:23:32 +01:00
61e4b9ce3f add IAR warning flags to cmake build and fix them 2026-03-05 23:24:14 +07:00
8444c25ab6 replace board_millis() with tusb_time_millis_api() 2026-02-28 00:01:40 +07:00
64ca0b9d58 host device info print no serial as 0 instead of n/a 2026-01-08 16:06:58 +07:00
49a8529dcf clean up cmake, remove family_get_project_name() 2025-12-19 12:33:42 +07:00
abf27bfa37 Merge remote-tracking branch 'tinyusb/master' into support-nxp-rw612
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2025-12-16 20:47:37 +01:00
22534a6019 Merge remote-tracking branch 'tinyusb/master' into support-nxp-rw612
Signed-off-by: Zixun LI <admin@hifiphile.com>
2025-12-16 11:51:42 +01:00