Skip to content

Commit

Permalink
native/platform: fix DFU detach
Browse files Browse the repository at this point in the history
DFU detach wasn't lowering the USB pullup. This meant that BMP was
rebooting into DFU bootloader mode, but the host wasn't re-enumerating
it, because it hadn't detected a detach.

In `platform_request_boot`, The `gpio_set_mode` config was for analog
instead of floating input. PA8 isn't defined as an analog pin on this
chip, so it's arguably undefined behavior.

Also confirmed that using `scb_reset_system` instead of `scb_reset_core`
to do the DFU reboot would correctly detach and enter the bootloader, if
the boot button was held down.
  • Loading branch information
tlyu authored and dragonmux committed Jan 1, 2024
1 parent d7767d4 commit b44bbf0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/platforms/native/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ const char *platform_target_voltage(void)
void platform_request_boot(void)
{
/* Disconnect USB cable */
gpio_set_mode(USB_PU_PORT, GPIO_MODE_INPUT, 0, USB_PU_PIN);
gpio_set_mode(USB_PU_PORT, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, USB_PU_PIN);

/* Drive boot request pin */
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO12);
Expand Down

0 comments on commit b44bbf0

Please sign in to comment.