summaryrefslogtreecommitdiff
path: root/prototype
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2020-12-01 19:36:02 +0100
committerjaseg <git@jaseg.de>2020-12-01 19:41:58 +0100
commit0e6fbeecf12d5176f0db75ad2752692b3c3a649d (patch)
tree739a86e4ff5ab2f9fbfb1f60bf5704e3298b7663 /prototype
parent2967dcee39e937248c21df59e6dbdd6336f8f9fb (diff)
downloadihsm-0e6fbeecf12d5176f0db75ad2752692b3c3a649d.tar.gz
ihsm-0e6fbeecf12d5176f0db75ad2752692b3c3a649d.tar.bz2
ihsm-0e6fbeecf12d5176f0db75ad2752692b3c3a649d.zip
paper: Add initial experimental results
Diffstat (limited to 'prototype')
-rw-r--r--prototype/fw/src/main.c4
-rw-r--r--prototype/fw/tools/ser_test.py13
2 files changed, 9 insertions, 8 deletions
diff --git a/prototype/fw/src/main.c b/prototype/fw/src/main.c
index 0998fce..42c1ea7 100644
--- a/prototype/fw/src/main.c
+++ b/prototype/fw/src/main.c
@@ -73,7 +73,7 @@ int main(void) {
int i = 0;
while (23) {
if (tx_st.remaining_bytes == 0) {
- if (i > 1000) {
+ if (i > 100) {
res_buf.req_seq = req_seq;
res_buf.res_seq = res_seq;
res_seq += 1;
@@ -118,7 +118,7 @@ int main(void) {
} else {
if (rc == sizeof(req_buf)) {
crc32_t check_crc = pkt_crc(&req_buf, &req_buf.trailer);
- if (check_crc != req_buf.trailer.crc32) {
+ if (check_crc != req_buf.trailer.crc32 || check_crc == 0 || check_crc == -1) {
rx_crc_error += 1;
} else {
req_seq = req_buf.req_seq;
diff --git a/prototype/fw/tools/ser_test.py b/prototype/fw/tools/ser_test.py
index 8680f46..ebd95ed 100644
--- a/prototype/fw/tools/ser_test.py
+++ b/prototype/fw/tools/ser_test.py
@@ -32,15 +32,15 @@ if __name__ == '__main__':
while True:
data = ser.read()
for c in data:
- if byte_count == 0:
- print(f'\033[38;5;244m{time.time() - start_time: 8.3f} \033[0m', end='')
+ #if byte_count == 0:
+ #print(f'\033[38;5;244m{time.time() - start_time: 8.3f} \033[0m', end='')
col = '\033[91m' if c == 0 else '\033[0m' # if c == (lastc - 1) % 256 else '\033[92m')
- print(f'{col}{c:02x}', end=' ')
+ #print(f'{col}{c:02x}', end=' ')
line += bytes([c])
byte_count += 1
if c == 0:
- print(' ' * (16 - byte_count), end='\033[0m\n')
+ #print(' ' * (16 - byte_count), end='\033[0m\n')
byte_count = 16
try:
payload = cobs.decode(packet)
@@ -51,7 +51,8 @@ if __name__ == '__main__':
else:
crc_ok = False
ref_crc = ''
- print(' '.join(f'{col if col else ""}{c if c else 0:02x}' for col, c in itertools.zip_longest(field_colors,
+ if len(payload) == 12:
+ print(' '.join(f'{col if col else ""}{c if c else 0:02x}' for col, c in itertools.zip_longest(field_colors,
payload)), 'OK' if crc_ok else f'WRONG')
except cobs.DecodeError:
print('COBS framing error')
@@ -61,7 +62,7 @@ if __name__ == '__main__':
isprint = lambda c: c in b'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ '
if byte_count == 16:
printable = ''.join( chr(c) if isprint(c) else '.' for c in line )
- print(f'\033[93m | {printable}\033[0m')
+ #print(f'\033[93m | {printable}\033[0m')
byte_count = 0
line = b''
lastc = c