commit
7b162ec93f
|
@ -33,9 +33,6 @@ if(FAMILY STREQUAL "rp2040")
|
||||||
CFG_TUSB_OS=OPT_OS_PICO
|
CFG_TUSB_OS=OPT_OS_PICO
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT} pico_stdlib pico_fix_rp2040_usb_device_enumeration)
|
|
||||||
pico_add_extra_outputs(${PROJECT})
|
|
||||||
|
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Invalid FAMILY specified")
|
message(FATAL_ERROR "Invalid FAMILY specified")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -37,9 +37,6 @@ elseif(FAMILY STREQUAL "rp2040")
|
||||||
CFG_TUSB_OS=OPT_OS_PICO
|
CFG_TUSB_OS=OPT_OS_PICO
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT} pico_stdlib pico_fix_rp2040_usb_device_enumeration)
|
|
||||||
pico_add_extra_outputs(${PROJECT})
|
|
||||||
|
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Invalid FAMILY specified")
|
message(FATAL_ERROR "Invalid FAMILY specified")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -33,9 +33,6 @@ if(FAMILY STREQUAL "rp2040")
|
||||||
CFG_TUSB_OS=OPT_OS_PICO
|
CFG_TUSB_OS=OPT_OS_PICO
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT} pico_stdlib pico_fix_rp2040_usb_device_enumeration)
|
|
||||||
pico_add_extra_outputs(${PROJECT})
|
|
||||||
|
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Invalid FAMILY specified")
|
message(FATAL_ERROR "Invalid FAMILY specified")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -39,9 +39,6 @@ elseif(FAMILY STREQUAL "rp2040")
|
||||||
CFG_TUSB_OS=OPT_OS_PICO
|
CFG_TUSB_OS=OPT_OS_PICO
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT} pico_stdlib pico_fix_rp2040_usb_device_enumeration)
|
|
||||||
pico_add_extra_outputs(${PROJECT})
|
|
||||||
|
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Invalid FAMILY specified")
|
message(FATAL_ERROR "Invalid FAMILY specified")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -33,9 +33,6 @@ if(FAMILY STREQUAL "rp2040")
|
||||||
CFG_TUSB_OS=OPT_OS_PICO
|
CFG_TUSB_OS=OPT_OS_PICO
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT} pico_stdlib pico_fix_rp2040_usb_device_enumeration)
|
|
||||||
pico_add_extra_outputs(${PROJECT})
|
|
||||||
|
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Invalid FAMILY specified")
|
message(FATAL_ERROR "Invalid FAMILY specified")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -34,9 +34,6 @@ if(FAMILY STREQUAL "rp2040")
|
||||||
CFG_TUSB_OS=OPT_OS_PICO
|
CFG_TUSB_OS=OPT_OS_PICO
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT} pico_stdlib pico_fix_rp2040_usb_device_enumeration)
|
|
||||||
pico_add_extra_outputs(${PROJECT})
|
|
||||||
|
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Invalid FAMILY specified")
|
message(FATAL_ERROR "Invalid FAMILY specified")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -33,9 +33,6 @@ if(FAMILY STREQUAL "rp2040")
|
||||||
CFG_TUSB_OS=OPT_OS_PICO
|
CFG_TUSB_OS=OPT_OS_PICO
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT} pico_stdlib pico_fix_rp2040_usb_device_enumeration)
|
|
||||||
pico_add_extra_outputs(${PROJECT})
|
|
||||||
|
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Invalid FAMILY specified")
|
message(FATAL_ERROR "Invalid FAMILY specified")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -33,9 +33,6 @@ if(FAMILY STREQUAL "rp2040")
|
||||||
CFG_TUSB_OS=OPT_OS_PICO
|
CFG_TUSB_OS=OPT_OS_PICO
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT} pico_stdlib pico_fix_rp2040_usb_device_enumeration)
|
|
||||||
pico_add_extra_outputs(${PROJECT})
|
|
||||||
|
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Invalid FAMILY specified")
|
message(FATAL_ERROR "Invalid FAMILY specified")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -33,9 +33,6 @@ if(FAMILY STREQUAL "rp2040")
|
||||||
CFG_TUSB_OS=OPT_OS_PICO
|
CFG_TUSB_OS=OPT_OS_PICO
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT} pico_stdlib pico_fix_rp2040_usb_device_enumeration)
|
|
||||||
pico_add_extra_outputs(${PROJECT})
|
|
||||||
|
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Invalid FAMILY specified")
|
message(FATAL_ERROR "Invalid FAMILY specified")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -33,9 +33,6 @@ if(FAMILY STREQUAL "rp2040")
|
||||||
CFG_TUSB_OS=OPT_OS_PICO
|
CFG_TUSB_OS=OPT_OS_PICO
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT} pico_stdlib pico_fix_rp2040_usb_device_enumeration)
|
|
||||||
pico_add_extra_outputs(${PROJECT})
|
|
||||||
|
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Invalid FAMILY specified")
|
message(FATAL_ERROR "Invalid FAMILY specified")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -34,9 +34,6 @@ if(FAMILY STREQUAL "rp2040")
|
||||||
CFG_TUSB_OS=OPT_OS_PICO
|
CFG_TUSB_OS=OPT_OS_PICO
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT} pico_stdlib pico_fix_rp2040_usb_device_enumeration)
|
|
||||||
pico_add_extra_outputs(${PROJECT})
|
|
||||||
|
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Invalid FAMILY specified")
|
message(FATAL_ERROR "Invalid FAMILY specified")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -80,9 +80,6 @@ if(FAMILY STREQUAL "rp2040")
|
||||||
HTTPD_USE_CUSTOM_FSDATA=0
|
HTTPD_USE_CUSTOM_FSDATA=0
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT} pico_stdlib pico_fix_rp2040_usb_device_enumeration)
|
|
||||||
pico_add_extra_outputs(${PROJECT})
|
|
||||||
|
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Invalid FAMILY specified")
|
message(FATAL_ERROR "Invalid FAMILY specified")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -33,9 +33,6 @@ if(FAMILY STREQUAL "rp2040")
|
||||||
CFG_TUSB_OS=OPT_OS_PICO
|
CFG_TUSB_OS=OPT_OS_PICO
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT} pico_stdlib pico_fix_rp2040_usb_device_enumeration)
|
|
||||||
pico_add_extra_outputs(${PROJECT})
|
|
||||||
|
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Invalid FAMILY specified")
|
message(FATAL_ERROR "Invalid FAMILY specified")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -34,9 +34,6 @@ if(FAMILY STREQUAL "rp2040")
|
||||||
CFG_TUSB_OS=OPT_OS_PICO
|
CFG_TUSB_OS=OPT_OS_PICO
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT} pico_stdlib pico_fix_rp2040_usb_device_enumeration)
|
|
||||||
pico_add_extra_outputs(${PROJECT})
|
|
||||||
|
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Invalid FAMILY specified")
|
message(FATAL_ERROR "Invalid FAMILY specified")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -33,9 +33,6 @@ if(FAMILY STREQUAL "rp2040")
|
||||||
CFG_TUSB_OS=OPT_OS_PICO
|
CFG_TUSB_OS=OPT_OS_PICO
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT} pico_stdlib pico_fix_rp2040_usb_device_enumeration)
|
|
||||||
pico_add_extra_outputs(${PROJECT})
|
|
||||||
|
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Invalid FAMILY specified")
|
message(FATAL_ERROR "Invalid FAMILY specified")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -38,9 +38,6 @@ elseif(FAMILY STREQUAL "rp2040")
|
||||||
CFG_TUSB_OS=OPT_OS_PICO
|
CFG_TUSB_OS=OPT_OS_PICO
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT} pico_stdlib pico_fix_rp2040_usb_device_enumeration)
|
|
||||||
pico_add_extra_outputs(${PROJECT})
|
|
||||||
|
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Invalid FAMILY specified")
|
message(FATAL_ERROR "Invalid FAMILY specified")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -194,6 +194,8 @@ else
|
||||||
$(RM) -rf $(BUILD)
|
$(RM) -rf $(BUILD)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
endif # GNU Make
|
||||||
|
|
||||||
# Print out the value of a make variable.
|
# Print out the value of a make variable.
|
||||||
# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile
|
# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile
|
||||||
print-%:
|
print-%:
|
||||||
|
@ -227,7 +229,6 @@ flash-pyocd: $(BUILD)/$(PROJECT).hex
|
||||||
pyocd flash -t $(PYOCD_TARGET) $<
|
pyocd flash -t $(PYOCD_TARGET) $<
|
||||||
pyocd reset -t $(PYOCD_TARGET)
|
pyocd reset -t $(PYOCD_TARGET)
|
||||||
|
|
||||||
endif # GNU Make
|
|
||||||
|
|
||||||
#-------------- Artifacts --------------
|
#-------------- Artifacts --------------
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,10 @@ bool __no_inline_not_in_flash_func(get_bootsel_button)() {
|
||||||
|
|
||||||
//------------- Segger RTT retarget -------------//
|
//------------- Segger RTT retarget -------------//
|
||||||
#if defined(LOGGER_RTT)
|
#if defined(LOGGER_RTT)
|
||||||
|
|
||||||
// Logging with RTT
|
// Logging with RTT
|
||||||
|
// If RTT Control Block is not found by 'Auto Detection`
|
||||||
|
// try to use 'Search Range` with '0x20000000 0x10000'
|
||||||
|
|
||||||
#include "pico/stdio/driver.h"
|
#include "pico/stdio/driver.h"
|
||||||
#include "SEGGER_RTT.h"
|
#include "SEGGER_RTT.h"
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
target_link_libraries(${PROJECT}
|
||||||
|
pico_stdlib
|
||||||
|
pico_bootsel_via_double_reset
|
||||||
|
pico_fix_rp2040_usb_device_enumeration
|
||||||
|
)
|
||||||
|
|
||||||
|
pico_add_extra_outputs(${PROJECT})
|
||||||
|
pico_enable_stdio_uart(${PROJECT} 1)
|
||||||
|
|
||||||
# TinyUSB Stack source
|
# TinyUSB Stack source
|
||||||
set(SRC_TINYUSB
|
set(SRC_TINYUSB
|
||||||
${TOP}/src/tusb.c
|
${TOP}/src/tusb.c
|
||||||
|
@ -42,12 +51,9 @@ target_compile_definitions(${PROJECT} PUBLIC
|
||||||
|
|
||||||
if(DEFINED LOG)
|
if(DEFINED LOG)
|
||||||
target_compile_definitions(${PROJECT} PUBLIC CFG_TUSB_DEBUG=${LOG} )
|
target_compile_definitions(${PROJECT} PUBLIC CFG_TUSB_DEBUG=${LOG} )
|
||||||
pico_enable_stdio_uart(${PROJECT} 1)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(LOGGER STREQUAL "rtt")
|
if(LOGGER STREQUAL "rtt")
|
||||||
pico_enable_stdio_uart(${PROJECT} 0)
|
|
||||||
|
|
||||||
target_compile_definitions(${PROJECT} PUBLIC
|
target_compile_definitions(${PROJECT} PUBLIC
|
||||||
LOGGER_RTT
|
LOGGER_RTT
|
||||||
SEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
SEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
FAMILY_SUBMODULES = hw/mcu/raspberrypi/pico-sdk
|
FAMILY_SUBMODULES = hw/mcu/raspberrypi/pico-sdk
|
||||||
|
|
||||||
|
JLINK_DEVICE = rp2040_m0_0
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 2d5789eca89658a7f0a01e2d6010c0f254605d72
|
Subproject commit 61978dc707c7f2026efa4c3300bbb94baa89c78a
|
|
@ -992,11 +992,15 @@ void dcd_event_handler(dcd_event_t const * event, bool in_isr)
|
||||||
switch (event->event_id)
|
switch (event->event_id)
|
||||||
{
|
{
|
||||||
case DCD_EVENT_UNPLUGGED:
|
case DCD_EVENT_UNPLUGGED:
|
||||||
|
// UNPLUGGED event can be bouncing, only processing if we are currently connected
|
||||||
|
if ( _usbd_dev.connected )
|
||||||
|
{
|
||||||
_usbd_dev.connected = 0;
|
_usbd_dev.connected = 0;
|
||||||
_usbd_dev.addressed = 0;
|
_usbd_dev.addressed = 0;
|
||||||
_usbd_dev.cfg_num = 0;
|
_usbd_dev.cfg_num = 0;
|
||||||
_usbd_dev.suspended = 0;
|
_usbd_dev.suspended = 0;
|
||||||
osal_queue_send(_usbd_q, event, in_isr);
|
osal_queue_send(_usbd_q, event, in_isr);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DCD_EVENT_SOF:
|
case DCD_EVENT_SOF:
|
||||||
|
@ -1004,9 +1008,10 @@ void dcd_event_handler(dcd_event_t const * event, bool in_isr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DCD_EVENT_SUSPEND:
|
case DCD_EVENT_SUSPEND:
|
||||||
// NOTE: When plugging/unplugging device, the D+/D- state are unstable and can accidentally meet the
|
// NOTE: When plugging/unplugging device, the D+/D- state are unstable and
|
||||||
// SUSPEND condition ( Idle for 3ms ). Some MCUs such as SAMD doesn't distinguish suspend vs disconnect as well.
|
// can accidentally meet the SUSPEND condition ( Bus Idle for 3ms ).
|
||||||
// We will skip handling SUSPEND/RESUME event if not currently connected
|
// In addition, some MCUs such as SAMD or boards that haven no VBUS detection cannot distinguish
|
||||||
|
// suspended vs disconnected. We will skip handling SUSPEND/RESUME event if not currently connected
|
||||||
if ( _usbd_dev.connected )
|
if ( _usbd_dev.connected )
|
||||||
{
|
{
|
||||||
_usbd_dev.suspended = 1;
|
_usbd_dev.suspended = 1;
|
||||||
|
|
|
@ -317,13 +317,45 @@ static void dcd_rp2040_irq(void)
|
||||||
pico_trace("BUS RESET (addr %d -> %d)\n", assigned_address, 0);
|
pico_trace("BUS RESET (addr %d -> %d)\n", assigned_address, 0);
|
||||||
usb_hw->dev_addr_ctrl = 0;
|
usb_hw->dev_addr_ctrl = 0;
|
||||||
handled |= USB_INTS_BUS_RESET_BITS;
|
handled |= USB_INTS_BUS_RESET_BITS;
|
||||||
dcd_event_bus_signal(0, DCD_EVENT_BUS_RESET, true);
|
dcd_event_bus_reset(0, TUSB_SPEED_FULL, true);
|
||||||
usb_hw_clear->sie_status = USB_SIE_STATUS_BUS_RESET_BITS;
|
usb_hw_clear->sie_status = USB_SIE_STATUS_BUS_RESET_BITS;
|
||||||
#if TUD_OPT_RP2040_USB_DEVICE_ENUMERATION_FIX
|
#if TUD_OPT_RP2040_USB_DEVICE_ENUMERATION_FIX
|
||||||
rp2040_usb_device_enumeration_fix();
|
rp2040_usb_device_enumeration_fix();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (status & USB_INTS_DEV_CONN_DIS_BITS)
|
||||||
|
{
|
||||||
|
handled |= USB_INTS_DEV_CONN_DIS_BITS;
|
||||||
|
|
||||||
|
if ( usb_hw->sie_status & USB_SIE_STATUS_CONNECTED_BITS )
|
||||||
|
{
|
||||||
|
// Connected: nothing to do
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
// Disconnected
|
||||||
|
dcd_event_bus_signal(0, DCD_EVENT_UNPLUGGED, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
usb_hw_clear->sie_status = USB_SIE_STATUS_CONNECTED_BITS;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0 // TODO Enable SUSPEND & RESUME interrupt and test later on with/without VBUS detection
|
||||||
|
if (status & USB_INTS_DEV_SUSPEND_BITS)
|
||||||
|
{
|
||||||
|
handled |= USB_INTS_DEV_SUSPEND_BITS;
|
||||||
|
dcd_event_bus_signal(0, DCD_EVENT_SUSPEND, true);
|
||||||
|
usb_hw_clear->sie_status = USB_SIE_STATUS_SUSPENDED_BITS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status & USB_INTS_DEV_RESUME_FROM_HOST_BITS)
|
||||||
|
{
|
||||||
|
handled |= USB_INTS_DEV_RESUME_FROM_HOST_BITS;
|
||||||
|
dcd_event_bus_signal(0, DCD_EVENT_RESUME, true);
|
||||||
|
usb_hw_clear->sie_status = USB_SIE_STATUS_RESUME_BITS;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (status ^ handled)
|
if (status ^ handled)
|
||||||
{
|
{
|
||||||
panic("Unhandled IRQ 0x%x\n", (uint) (status ^ handled));
|
panic("Unhandled IRQ 0x%x\n", (uint) (status ^ handled));
|
||||||
|
@ -364,8 +396,10 @@ void dcd_init (uint8_t rhport)
|
||||||
|
|
||||||
// Enable individual controller IRQS here. Processor interrupt enable will be used
|
// Enable individual controller IRQS here. Processor interrupt enable will be used
|
||||||
// for the global interrupt enable...
|
// for the global interrupt enable...
|
||||||
|
// TODO Enable SUSPEND & RESUME interrupt
|
||||||
usb_hw->sie_ctrl = USB_SIE_CTRL_EP0_INT_1BUF_BITS;
|
usb_hw->sie_ctrl = USB_SIE_CTRL_EP0_INT_1BUF_BITS;
|
||||||
usb_hw->inte = USB_INTS_BUFF_STATUS_BITS | USB_INTS_BUS_RESET_BITS | USB_INTS_SETUP_REQ_BITS;
|
usb_hw->inte = USB_INTS_BUFF_STATUS_BITS | USB_INTS_BUS_RESET_BITS | USB_INTS_SETUP_REQ_BITS |
|
||||||
|
USB_INTS_DEV_CONN_DIS_BITS /* | USB_INTS_DEV_SUSPEND_BITS | USB_INTS_DEV_RESUME_FROM_HOST_BITS */ ;
|
||||||
|
|
||||||
dcd_connect(rhport);
|
dcd_connect(rhport);
|
||||||
}
|
}
|
||||||
|
@ -393,8 +427,9 @@ void dcd_set_address (uint8_t rhport, uint8_t dev_addr)
|
||||||
|
|
||||||
void dcd_remote_wakeup(uint8_t rhport)
|
void dcd_remote_wakeup(uint8_t rhport)
|
||||||
{
|
{
|
||||||
pico_info("dcd_remote_wakeup %d is not supported yet\n", rhport);
|
pico_info("dcd_remote_wakeup %d\n", rhport);
|
||||||
assert(rhport == 0);
|
assert(rhport == 0);
|
||||||
|
usb_hw_set->sie_ctrl = USB_SIE_CTRL_RESUME_BITS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// disconnect by disabling internal pull-up resistor on D+/D-
|
// disconnect by disabling internal pull-up resistor on D+/D-
|
||||||
|
|
Loading…
Reference in New Issue