diff --git a/src/ice_usb.c b/src/ice_usb.c index ea171f26..aae484c1 100644 --- a/src/ice_usb.c +++ b/src/ice_usb.c @@ -343,6 +343,9 @@ void dfu_init(uint8_t alt) ice_cram_open(); break; case DFU_ALT_FLASH: + // Make sure the RP2040 have full access to the SPI bus + ice_fpga_stop(); + ice_flash_init(); // Ensure reboot in case user doesn't pass -R to dfu-util @@ -355,9 +358,6 @@ void dfu_init(uint8_t alt) // Disable all interrupts except USB and DMA (needed for flash program) irq_set_mask_enabled(~((1 << USBCTRL_IRQ) | (1 << DMA_IRQ_1)), false); - - // Make sure the RP2040 have full access to the SPI bus - ice_fpga_stop(); break; } }