Skip to content

Commit

Permalink
stop ICE40 FPGA before initializing SPI flash
Browse files Browse the repository at this point in the history
Since commit bdd0dca (release v1.5.0), ice_fpga_stop() has been called
after the ice_flash_init function, which wakes flash from sleep. In
order to avoid contention on the SPI bus during the flash wake command,
stop the ICE40 FPGA prior to sending SPI flash wake command.

Signed-off-by: Daniel DeGrasse <[email protected]>
  • Loading branch information
danieldegrasse authored and josuah committed Apr 20, 2024
1 parent ea1dc16 commit 8e92021
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ice_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
}
Expand Down

0 comments on commit 8e92021

Please sign in to comment.