Add Teensy 4.1 power pin and fix SWD for DEBUG=1

This commit is contained in:
Scott Shawcroft 2022-03-08 17:17:07 -08:00
parent 83593a1558
commit 96f5eec2ee
No known key found for this signature in database
GPG Key ID: 0DFD512649C052DA
4 changed files with 30 additions and 1 deletions

View File

@ -142,6 +142,11 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_D54), MP_ROM_PTR(&pin_GPIO_EMC_29) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_QSPI_IO3), MP_ROM_PTR(&pin_GPIO_EMC_29) },
// USB Host
{ MP_ROM_QSTR(MP_QSTR_USB_HOST_POWER), MP_ROM_PTR(&pin_GPIO_EMC_40) },
{ MP_ROM_QSTR(MP_QSTR_USB_HOST_DP), MP_ROM_PTR(&pin_USB_OTG2_DP) },
{ MP_ROM_QSTR(MP_QSTR_USB_HOST_DM), MP_ROM_PTR(&pin_USB_OTG2_DN) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },

View File

@ -408,7 +408,11 @@ void port_idle_until_interrupt(void) {
common_hal_mcu_disable_interrupts();
if (!background_callback_pending()) {
NVIC_ClearPendingIRQ(SNVS_HP_WRAPPER_IRQn);
// Don't down clock on debug builds because it prevents the DAP from
// reading memory
#if CIRCUITPY_DEBUG == 0
CLOCK_SetMode(kCLOCK_ModeWait);
#endif
__WFI();
CLOCK_SetMode(kCLOCK_ModeRun);
}

View File

@ -105,7 +105,7 @@ void serial_early_init(void) {
common_hal_busio_uart_never_reset(&debug_uart);
// Do an initial print so that we can confirm the serial output is working.
debug_uart_printf("Serial debug setup\n");
debug_uart_printf("Serial debug setup\r\n");
#endif
}

View File

@ -0,0 +1,20 @@
import usb_host
import board
import digitalio
import usb.core
import time
if hasattr(board, "USB_HOST_POWER"):
d = digitalio.DigitalInOut(board.USB_HOST_POWER)
d.switch_to_output(value=True)
print("USB power on")
h = usb_host.Port(board.USB_HOST_DP, board.USB_HOST_DM)
while True:
for device in usb.core.find(find_all=True):
print(device.idVendor, device.idProduct)
print(device.manufacturer, device.product)
print(device.serial_number)
print()
time.sleep(10)