USB_DISABLED (No USB) does not compile on Teensy 4.x since 1.59 — is it meant to be supported?

ORyomei

New member
Hi Paul,

Two questions about USB_DISABLED ("No USB") on Teensy 4.x:

1. Is it meant to be supported? It has not compiled since 1.59.
2. If yes, could https://github.com/PaulStoffregen/cores/pull/735 be merged? It fixes exactly this, and I have tested it on hardware.

What breaks (Teensy 4.1, TEENSYDUINO=162, PlatformIO framework-arduinoteensy 1.162.0):

Code:
cores/teensy4/yield.cpp:51:41: error: 'serialEvent' was not declared in this scope
startup.c:(.text.unused_interrupt_vector+0xfe): undefined reference to `usb_isr'

  • yield.cpp calls serialEvent(), but usb_serial.h only declares it when USB is enabled.
  • startup.c references usb_isr, but usb.c compiles to nothing without NUM_ENDPOINTS.

PR #735 adds the missing declaration and an empty usb_isr(). With those two changes applied, my build links and the board runs with a separate USB stack (TinyUSB device, CDC + MSC) on USB1. Without them I have to force-include the declaration and define a weak usb_isr myself, which will break with the next core change.

Why this went unreported: "No USB" is commented out in boards.txt for Teensy 4.x, so it only shows up with PlatformIO or an edited menu.

Why I need it: the core has no USB mass storage class, so for an SD card reader mode I switch the core's USB off and run TinyUSB. The port is here, workaround included: https://github.com/ORyomei/Teensy4TinyUSB

If the answer to the first question is "no", a note in the release notes or boards.txt would save the next person a few hours, and I will keep the workaround.

Thanks for all the work on Teensy.
 
Why I need it: the core has no USB mass storage class, so for an SD card reader mode I switch the core's USB off and run TinyUSB. The port is here, workaround included: https://github.com/ORyomei/Teensy4TinyUSB
Not sure if you are talking about a mass storage driver for the Teensy4x Host USB port? If you are then there is a driver for use with an SD card reader in the USBHost_t36 library for use with the Host USB port. Check out the Teensyduino 1.62 "USBHost_t36/examples/storage/" folder.
This is output from my Targus SD card reader:
Code:
Waiting for Drive to initialize...
Device Info:
       connected: 1
     initialized: 1
   USB Vendor ID: 058f
  USB Product ID: 6366
      HUB Number: 0
        HUB Port: 0
  Device Address: 1
Removable Device: YES
        VendorID: Multi   
       ProductID: Flash Reader   
      RevisionID: 1.00
         Version: 0
    Sector Count: 61091839
     Sector size: 512
   Disk Capacity: 31279021568 Bytes

Partition Table
        part,boot,bgnCHS[3],type,endCHS[3],start,length
FAT32:  1,0,0x82,0x3,0x0,0xC,0xFE,0xFF,0xFF,8192,61083648
pt_#0:  2,0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0,0
pt_#0:  3,0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0,0
pt_#0:  4,0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0,0

Volume name:
Volume type: FAT32
Cluster Size: 32768 bytes
Volume size: 31266439168 bytes
 Space used: 125108224 bytes  (467 ms to compute)

Files:
2026-10-08 10:43   32768000 32MEGfile.dat
2019-01-01 00:05   33554432 CPMDISK.SYS
2019-01-01 00:06   56863276 armaged.wav
2019-01-01 00:00          0 test1/
2019-01-01 00:00          0 test2/
  2019-01-01 00:01         33 location.h
  2019-01-01 00:01       2313 forwardDecs.h
  2019-01-01 00:01        160 imporIcons.ino
  2019-01-01 00:01      19223 weatherApp.ino
  2019-01-01 00:01      12089 weatherDashboard.ino
  2019-01-01 00:01       7969 weather_display_v5.ino
  2019-01-01 00:02          0 airy/
    2019-01-01 00:02      33025 dense-freezing-drizzle.h
    2019-01-01 00:02      33016 dense-drizzle.h
    2019-01-01 00:02      33016 partly-cloudy.h
    2019-01-01 00:02      33013 light-rain.h
    2019-01-01 00:02      35071 rime-fog.h
    2019-01-01 00:02         33 location.h
    2019-01-01 00:02      33012 snowflake.h
    2019-01-01 00:02      33025 thunderstorm-with-hail.h
    2019-01-01 00:02       2275 forwardDecs.h
    2019-01-01 00:02       9461 giga_weather_display_v4.ino
    2019-01-01 00:02      33015 thunderstorm.h
    2019-01-01 00:02      33017 heavy-snowfall.h
    2019-01-01 00:02      33019 moderate-drizzle.h
    2019-01-01 00:02       2553 imporIcons.ino
    2019-01-01 00:02      33025 light-freezing-drizzle.h
    2019-01-01 00:02      33022 light-freezing-rain.h
    2019-01-01 00:02      33016 moderate-rain.h
    2019-01-01 00:02      33013 heavy-rain.h
    2019-01-01 00:02      33015 mostly-clear.h
    2019-01-01 00:02      33008 clear.h
    2019-01-01 00:02      35066 fog.h
    2019-01-01 00:02      33016 light-drizzle.h
    2019-01-01 00:02      33018 slight-snowfall.h
    2019-01-01 00:02      33020 moderate-snowfall.h
    2019-01-01 00:02      33022 heavy-freezing-rain.h
    2019-01-01 00:02      33011 overcast.h
Done with this setup:
USB_SD_card_Reader.jpg

and the "USBHost_t36/storage/DriveInfo.ino" sketch.
This may help if I understood what you are after correctly...
 
Thanks Paul, that answers it. One correction: PlatformIO does not use those boards.txt lines; I added -DUSB_DISABLED myself, knowing it is not in the menu.

wwatson: thanks, but it is the other direction. The Teensy is the device, and the PC sees the Teensy's SD card as a USB drive. USBHost_t36 is for the host port.
 
Back
Top