Final support of flashing on macOS

For some reason, macOS have issues with USB CDC,
surprisingly, CH340G convertor works just fine.
But FTDI and Bouffalo's USB CDC didn't worked.
Basically, without writing anything, we don't receive
response from board. This was fixed by adding drain
after writing BOUFALLOLABRESET handshake + adding
drains after every commmand write. Also, for some reason,
in USB CDC, the size of USB payload is limited, else
it will fail.
This commit is contained in:
Marek Kraus
2023-01-21 14:34:46 +01:00
parent 3325f3725e
commit cbac0733ee
2 changed files with 26 additions and 6 deletions
+8
View File
@@ -130,6 +130,10 @@ int32_t blisp_send_command(struct blisp_device* device,
blisp_dlog("Received error or not written all data: %d", ret);
return BLISP_ERR_UNKNOWN;
}
#ifdef __APPLE__
sp_drain(serial_port);
#endif
return BLISP_OK;
}
@@ -191,6 +195,9 @@ int32_t blisp_device_handshake(struct blisp_device* device, bool in_ef_loader) {
if (!in_ef_loader) {
if (device->is_usb) {
sp_blocking_write(serial_port, "BOUFFALOLAB5555RESET\0\0", 22, 100);
#ifdef __APPLE__
sp_drain(serial_port);
#endif
}
}
ret = sp_blocking_write(serial_port, handshake_buffer, bytes_count, 500);
@@ -210,6 +217,7 @@ int32_t blisp_device_handshake(struct blisp_device* device, bool in_ef_loader) {
return BLISP_OK;
}
}
}
blisp_dlog("Received no response from chip.");
return BLISP_ERR_NO_RESPONSE;