raspberrypi / pico-sdk

BSD 3-Clause "New" or "Revised" License
3.62k stars 901 forks source link

Dont exclude baudrate BOOTSEL reset trick from build when LIB_TINYUSB_HOST or LIB_TINYUSB_DEVICE is defined #1118

Closed popy2k14 closed 4 weeks ago

popy2k14 commented 1 year ago

As the title says and discussed here: https://github.com/raspberrypi/pico-sdk/issues/838#issuecomment-1325602575

Please do not exclude function tud_cdc_line_coding_cb() from file /rp2_common/pico_stdio_usb)/reset_interface.c The function is very helpful to bring the pi into BOOTSEL mode when TinyUSB is used. A better approach would be to include it always and make an define to exclude it, when not needed.

As a workaround, i have just copied, adapted and inserted the function into my project, like this

// Support for default BOOTSEL reset by changing baud rate
void tud_cdc_line_coding_cb(__unused uint8_t itf, cdc_line_coding_t const* p_line_coding) {
    if (p_line_coding->bit_rate == 110) {    
        //board_led_write(1);
        reset_usb_boot(gpio_mask, 0);
    }
}
kilograham commented 1 month ago

We will now respect PICO_STDIO_USB_ENABLE_RESET_VIA_BAUD_RATE=1 if you set it when using TinyUSB yourself (it won't default to 1 like it does when you aren't using TinyUSB)

popy2k14 commented 1 month ago

@kilograham thx for comming back to this and fixing it.

kilograham commented 4 weeks ago

This should work fine with SDK 2.0.0