diff --git a/arduino_programs/arduino_programmer/arduino_programmer.ino b/arduino_programs/arduino_programmer/arduino_programmer.ino index b9e6ac8..c805a40 100644 --- a/arduino_programs/arduino_programmer/arduino_programmer.ino +++ b/arduino_programs/arduino_programmer/arduino_programmer.ino @@ -245,8 +245,6 @@ void program() { while(Serial.available() == 0); value = Serial.read(); writeEEPROM(addr, value, true); - // Send ack. - Serial.write(value); } } diff --git a/cli/cli.py b/cli/cli.py index d8ff7cc..e5315ce 100644 --- a/cli/cli.py +++ b/cli/cli.py @@ -1,6 +1,7 @@ import argparse import time import serial +from tqdm import tqdm def get_parsed_args(): @@ -82,17 +83,19 @@ def program(args): # Sending command ser.write((0).to_bytes(1, "big")) - bytesToWrite = args.file.read() + bytes_to_write = args.file.read() # Forward the bytes from the selected file - for i in range(32 * 1024): - # Show progress. - if i % 1024 == 0: - print(".", end="") - value = (bytesToWrite[i]).to_bytes(1, "big") + for i in tqdm(range(32 * 1024)): + value = (bytes_to_write[i]).to_bytes(1, "big") ser.write(value) - if value != ser.read(): - # There was an error with the ack, finish early. - break + # This delay was found by experimentation. + # A byte write in the arduino takes about 80us. + # Every 64 bytes (a page) we do data polling and could + # take much longer. A byte send given a 115200 baud rate + # should take ~70us, a 100us delay should give the EEPROM enough time + # to internally write the page withouh the UART read buffer (64 bytes) + # overflowing. + time.sleep(100.0 * 1e-6) print("Done programming!") diff --git a/cli/requirements.txt b/cli/requirements.txt new file mode 100644 index 0000000..cc66994 --- /dev/null +++ b/cli/requirements.txt @@ -0,0 +1,17 @@ +appdirs==1.4.4 +astroid==2.4.2 +isort==5.6.4 +jedi==0.17.2 +lazy-object-proxy==1.4.3 +mccabe==0.6.1 +mypy-extensions==0.4.3 +parso==0.7.1 +pathspec==0.8.1 +pylint==2.6.0 +pyserial==3.5 +rope==0.18.0 +six==1.15.0 +toml==0.10.2 +tqdm==4.54.1 +typing-extensions==3.7.4.3 +wrapt==1.12.1