Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quicker upload not relying on luck #18

Merged
merged 2 commits into from
Jul 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions fpga.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ def usb_tx(title, data):
else:
print("ESP32 already in FPGA download mode, connecting...")

while True:
data = None
requested_len = 4 + 4 - 1 # 2 times "FPGA" if we are unlucky and "PGAFPGA" got transmitted
data = bytearray()

while (len(data) < requested_len) or (data.find(b'FPGA') == -1):
try:
data = bytes(esp32_ep_in.read(32))
data += bytes(esp32_ep_in.read(32))
except Exception as e:
#print(e)
pass
if (data == b"FPGA"):
break

esp32_ep_out.write(b'FPGA')

Expand Down