From 0c41f26e111b6d64117b260105fb1fa1cd15ba01 Mon Sep 17 00:00:00 2001 From: Jacek Fedorynski Date: Wed, 26 Apr 2023 19:29:50 +0200 Subject: [PATCH] Update tinyusb, drive EN pin on boost converter Updates TinyUSB with the latest upstream changes and makes it so that pin 18 is driven high on the Feather USB Host board (connected to the enable pin on the boost converter supplying 5V to connected USB devices). Please note there has been some confusing renaming of the Pico-PIO-USB related pin defines in TinyUSB. --- firmware/CMakeLists.txt | 2 +- firmware/src/boards/feather_host.h | 22 ++++++++++++++++++++-- firmware/tinyusb | 2 +- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/firmware/CMakeLists.txt b/firmware/CMakeLists.txt index e1620d3..7ce0fc0 100644 --- a/firmware/CMakeLists.txt +++ b/firmware/CMakeLists.txt @@ -82,7 +82,7 @@ add_executable(remapper if(PICO_BOARD STREQUAL "pico") target_compile_definitions(remapper PUBLIC PICO_DEFAULT_UART_TX_PIN=16) target_compile_definitions(remapper PUBLIC PICO_DEFAULT_UART_RX_PIN=17) -target_compile_definitions(remapper PUBLIC PIO_USB_DP_PIN=0) +target_compile_definitions(remapper PUBLIC PICO_DEFAULT_PIO_USB_DP_PIN=0) endif() target_include_directories(remapper PRIVATE diff --git a/firmware/src/boards/feather_host.h b/firmware/src/boards/feather_host.h index 7513c7e..1f17e58 100644 --- a/firmware/src/boards/feather_host.h +++ b/firmware/src/boards/feather_host.h @@ -53,8 +53,26 @@ // --- PIO USB --- -#ifndef PIO_USB_DP_PIN -#define PIO_USB_DP_PIN 16 +// these are currently the defaults in tinyusb, but it has changed in the past + +#ifndef PICO_DEFAULT_PIO_USB_DP_PIN +#define PICO_DEFAULT_PIO_USB_DP_PIN 16 +#endif + +#ifndef PICO_DEFAULT_PIO_USB_VBUSEN_PIN +#define PICO_DEFAULT_PIO_USB_VBUSEN_PIN 18 +#endif + +// note that tinyusb defines PICO_DEFAULT_PIO_USB_VBUSEN_STATE in board.h, +// but uses PIO_USB_VBUSEN_STATE in family.c + +#ifndef PIO_USB_VBUSEN_STATE +#define PIO_USB_VBUSEN_STATE 1 #endif +// note that tinyusb uses PICO_DEFAULT_PIO_USB_VBUSEN_PIN for the pin number, +// but PIO_USB_VBUSEN_PIN to decide whether to use it or not + +#define PIO_USB_VBUSEN_PIN + #endif diff --git a/firmware/tinyusb b/firmware/tinyusb index be1e13d..51dbd2f 160000 --- a/firmware/tinyusb +++ b/firmware/tinyusb @@ -1 +1 @@ -Subproject commit be1e13d04b544b3a1ef01e47c9acae02679e30ff +Subproject commit 51dbd2f03ab975a984ce19bba1de9c8532696e18