From 48ecd90f713cc385f6b309a40689914d90cbc859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Milants?= Date: Wed, 9 Nov 2022 21:09:47 +0100 Subject: [PATCH] Fix handshake procedure : - set RST and P8 low - wait - set P8 high - wait - set RST high Also, do not reset again when sending the 2nd handshake. --- lib/blisp.c | 4 ++-- tools/blisp/src/cmd/write.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/blisp.c b/lib/blisp.c index 994a18f..c64cc05 100644 --- a/lib/blisp.c +++ b/lib/blisp.c @@ -143,9 +143,9 @@ blisp_device_handshake(struct blisp_device* device, bool in_ef_loader) { sp_set_rts(serial_port, SP_RTS_ON); sp_set_dtr(serial_port, SP_DTR_ON); sleep_ms(50); - sp_set_rts(serial_port, SP_RTS_OFF); - sleep_ms(100); sp_set_dtr(serial_port, SP_DTR_OFF); + sleep_ms(100); + sp_set_rts(serial_port, SP_RTS_OFF); } uint32_t bytes_count = device->chip->handshake_byte_multiplier * (float)device->current_baud_rate / 10.0f; diff --git a/tools/blisp/src/cmd/write.c b/tools/blisp/src/cmd/write.c index 51471ea..98ee249 100644 --- a/tools/blisp/src/cmd/write.c +++ b/tools/blisp/src/cmd/write.c @@ -318,7 +318,7 @@ void blisp_flash_firmware() { } printf("Sending a handshake..."); - ret = blisp_device_handshake(&device, false); + ret = blisp_device_handshake(&device, true); if (ret != 0) { fprintf(stderr, "\nFailed to handshake with device.\n"); goto exit1;