Merge pull request #5 from AYM1607/feature/fast_writes
Modified the write with a hardcoded delay to avoid ack on every write.
This commit is contained in:
commit
2ecd603db9
3 changed files with 29 additions and 11 deletions
|
|
@ -245,8 +245,6 @@ void program() {
|
||||||
while(Serial.available() == 0);
|
while(Serial.available() == 0);
|
||||||
value = Serial.read();
|
value = Serial.read();
|
||||||
writeEEPROM(addr, value, true);
|
writeEEPROM(addr, value, true);
|
||||||
// Send ack.
|
|
||||||
Serial.write(value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
21
cli/cli.py
21
cli/cli.py
|
|
@ -1,6 +1,7 @@
|
||||||
import argparse
|
import argparse
|
||||||
import time
|
import time
|
||||||
import serial
|
import serial
|
||||||
|
from tqdm import tqdm
|
||||||
|
|
||||||
|
|
||||||
def get_parsed_args():
|
def get_parsed_args():
|
||||||
|
|
@ -82,17 +83,19 @@ def program(args):
|
||||||
# Sending command
|
# Sending command
|
||||||
ser.write((0).to_bytes(1, "big"))
|
ser.write((0).to_bytes(1, "big"))
|
||||||
|
|
||||||
bytesToWrite = args.file.read()
|
bytes_to_write = args.file.read()
|
||||||
# Forward the bytes from the selected file
|
# Forward the bytes from the selected file
|
||||||
for i in range(32 * 1024):
|
for i in tqdm(range(32 * 1024)):
|
||||||
# Show progress.
|
value = (bytes_to_write[i]).to_bytes(1, "big")
|
||||||
if i % 1024 == 0:
|
|
||||||
print(".", end="")
|
|
||||||
value = (bytesToWrite[i]).to_bytes(1, "big")
|
|
||||||
ser.write(value)
|
ser.write(value)
|
||||||
if value != ser.read():
|
# This delay was found by experimentation.
|
||||||
# There was an error with the ack, finish early.
|
# A byte write in the arduino takes about 80us.
|
||||||
break
|
# 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!")
|
print("Done programming!")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
17
cli/requirements.txt
Normal file
17
cli/requirements.txt
Normal file
|
|
@ -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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue