I am trying to work with USB midi on the adafruit_feather_usb_host board, but it cannot compile most libraries due to a error with a undefined variable. Is it just not available on this board for some reason?
HI @macgufffin and welcome to the PlatformIO Community forum.
Please provide as much detailed information as possible so that someone from the forum can help you. This includes the complete error message and the content of your platformio.ini.
Sorry, got frustrated and went to bed right after posting.
Error message:
.pio\libdeps\adafruit_feather_usb_host\usb_midi_host\usb_midi_host.c:42:35: error: 'USBH_EPSIZE_BULK_MAX' undeclared here (not in a function); did you mean 'TUSB_EPSIZE_BULK_HS'?
42 | #define CFG_TUH_MIDI_RX_BUFSIZE USBH_EPSIZE_BULK_MAX
| ^~~~~~~~~~~~~~~~~~~~
.pio\libdeps\adafruit_feather_usb_host\usb_midi_host\usb_midi_host.c:56:19: note: in expansion of macro 'CFG_TUH_MIDI_RX_BUFSIZE'
56 | } midih_limits = {CFG_TUH_MIDI_RX_BUFSIZE, CFG_TUH_MIDI_TX_BUFSIZE, CFG_TUH_MAX_CABLES};
| ^~~~~~~~~~~~~~~~~~~~~~~
Compiling .pio\build\adafruit_feather_usb_host\src\main.cpp.o
*** [.pio\build\adafruit_feather_usb_host\libf67\usb_midi_host\usb_midi_host.c.o]
Platform.ini:
[env:adafruit_feather_usb_host]
platform = raspberrypi
board = adafruit_feather_usb_host
framework = arduino
lib_ignore = USBHost
build_flags =
-DUSE_TINYUSB
-I "${PROJECT_CORE_DIR}/packages/framework-arduino-samd-seeed/libraries/Adafruit_TinyUSB_Library/src/arduino"
lib_deps =
adafruit/Adafruit SH110X@^2.1.13
thomasfredericks/Bounce2@^2.72
rppicomidi/EZ_USB_MIDI_HOST@^2.2.0
How can this possibly work? It’s a raspberrypi based board and you’re including a file from an Atmel SAMD Arduino core.
Since the adafruit_feather_usb_host
board defined in my platform, I will have a look at it.
Are you trying to compile the PIO USB example? https://github.com/rppicomidi/EZ_USB_MIDI_HOST/blob/main/examples/arduino/EZ_USB_MIDI_HOST_PIO_example/EZ_USB_MIDI_HOST_PIO_example.ino
Okay. So, a dependency library of EZ_USB_MIDI_HOST called “usb_midi_host” library needs the USBH_EPSIZE_BULK_MAX
enum.
This enum exists in Adafruit TinyUSB before 3.5.0 in src/host/usb_pvt.h, which that library also includes. But, commit update tinyusb to https://github.com/hathach/tinyusb/commit/1a783b357… · adafruit/Adafruit_TinyUSB_Arduino@fafc824 · GitHub deleted the enum and instead replaced it with TUH_EPSIZE_BULK_MPS
. This change was released in 3.5.0 just yesterday, breaking code that expects it, and that is including the EZ_USB_MIDI_HOST library.
The Adafruit TinyUSB version included in Arduino-Pico is still at 3.4.4 though.
The the problem here seems to be that the compilation does not use the Adafruit TinyUSB version as provided by the core, but because the “usb_midi_host” library declares
depends=Adafruit TinyUSB Library
in its library.properties
, PlatformIO seems to blindly download the latest (3.5.0) version of the Adafruit TinyUSB library and includes it in the build upon library install.
An easy way to solve this problem is to pin the to-be-used library versino to 3.4.4 using
adafruit/Adafruit TinyUSB Library@3.4.4
in the lib_deps
expression.
See
Thanks! I’ll try that. I was trying to get it working in circuitpy the last few days, but there are problems writing to the USB A port still it seems