diff --git a/sw/src/dfu.c b/sw/src/dfu.c index 2bceec2..068ce18 100644 --- a/sw/src/dfu.c +++ b/sw/src/dfu.c @@ -73,7 +73,7 @@ static struct toboot_state { static dfu_state_t dfu_state = dfuIDLE; static dfu_status_t dfu_status = OK; -static unsigned dfu_poll_timeout_ms = 100; +static unsigned dfu_poll_timeout_ms = 1; static uint32_t dfu_buffer[DFU_TRANSFER_SIZE/4]; static uint32_t dfu_buffer_offset; diff --git a/sw/src/spi.c b/sw/src/spi.c index 3f276e9..52d515a 100644 --- a/sw/src/spi.c +++ b/sw/src/spi.c @@ -32,13 +32,17 @@ static void gpioWrite(int pin, int val) { do_mirror |= 1 << pin; else do_mirror &= ~(1 << pin); - bbspi_do_write(do_mirror); + // bbspi_do_write(do_mirror); } static int gpioRead(int pin) { return !!(bbspi_di_read() & (1 << pin)); } +static void gpioSync(void) { + bbspi_do_write(do_mirror); +} + #define SPI_ONLY_SINGLE enum ff_spi_quirks { @@ -161,11 +165,13 @@ void spiBegin(struct ff_spi *spi) { gpioWrite(spi->pins.hold, 1); } gpioWrite(spi->pins.cs, 0); + gpioSync(); } void spiEnd(struct ff_spi *spi) { (void)spi; gpioWrite(spi->pins.cs, 1); + gpioSync(); } static uint8_t spiXfer(struct ff_spi *spi, uint8_t out) {