From 6b1a243d3acc1d40fe5090366e4d677ff5fafe0d Mon Sep 17 00:00:00 2001 From: John-Michael Baier Date: Sun, 20 Dec 2020 17:09:38 +0100 Subject: [PATCH] use high speed as default, fix current checksum --- src/tools/README.md | 6 +++--- src/tools/ebuspicloader.cpp | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/tools/README.md b/src/tools/README.md index c6ec2002..8281f437 100644 --- a/src/tools/README.md +++ b/src/tools/README.md @@ -26,7 +26,7 @@ A tool for loading firmware to the eBUS adapter PIC. -m, --mask=MASK set IP mask (e.g. 24) -M, --macip set the MAC address suffix from the IP address -r, --reset reset the device at the end on success - -s, --speed enable high speed transfer + -s, --slow use low speed for transfer -v, --verbose enable verbose output -?, --help give this help list --usage give a short usage message @@ -49,7 +49,7 @@ Firmware version not found MAC address: ae:b0:53:26:15:80 IP address: DHCP -New firmware version: 1 [d5d7] +New firmware version: 1 [c5e7] erasing flash: done. flashing: @@ -72,7 +72,7 @@ On success, the output looks like this: Device ID: 30b0 (PIC16F15356) Device revision: 0.1 Bootloader version: 1 [0a6c] -Firmware version: 1 [d5d7] +Firmware version: 1 [c5e7] MAC address: ae:b0:53:26:15:80 IP address: DHCP diff --git a/src/tools/ebuspicloader.cpp b/src/tools/ebuspicloader.cpp index 8c1c0f08..f4eeabbb 100644 --- a/src/tools/ebuspicloader.cpp +++ b/src/tools/ebuspicloader.cpp @@ -34,7 +34,7 @@ static const struct argp_option argpoptions[] = { {"macip", 'M', nullptr, 0, "set the MAC address suffix from the IP address", 0 }, {"flash", 'f', "FILE", 0, "flash the FILE to the device", 0 }, {"reset", 'r', nullptr, 0, "reset the device at the end on success", 0 }, - {"speed", 's', nullptr, 0, "enable high speed transfer", 0 }, + {"slow", 's', nullptr, 0, "use low speed for transfer", 0 }, {nullptr, 0, nullptr, 0, nullptr, 0 }, }; @@ -47,7 +47,7 @@ static bool setMask = false; static uint8_t setMaskLen = 0x1f; static char* flashFile = nullptr; static bool reset = false; -static bool highSpeed = false; +static bool lowSpeed = false; bool parseByte(const char *arg, uint8_t minValue, uint8_t maxValue, uint8_t *result) { char* strEnd = nullptr; @@ -149,7 +149,7 @@ error_t parse_opt(int key, char *arg, struct argp_state *state) { reset = true; break; case 's': - highSpeed = true; + lowSpeed = true; break; default: return ARGP_ERR_UNKNOWN; @@ -209,7 +209,7 @@ typedef union #define FRAME_HEADER_LEN 9 #define FRAME_MAX_LEN (FRAME_HEADER_LEN+2*WRITE_FLASH_BLOCKSIZE) -#define BAUDRATE_NORMAL B115200 +#define BAUDRATE_LOW B115200 #define BAUDRATE_HIGH B921600 #define WAIT_BYTE_TRANSFERRED_MILLIS 200 #define WAIT_BITRATE_DETECTION_MICROS 100 @@ -594,7 +594,7 @@ int openSerial(std::string port) { struct termios termios; memset(&termios, 0, sizeof(termios)); - if (cfsetspeed(&termios, highSpeed ? BAUDRATE_HIGH : BAUDRATE_NORMAL)!=0) { + if (cfsetspeed(&termios, lowSpeed ? BAUDRATE_LOW : BAUDRATE_HIGH)!=0) { std::cerr<<"unable to set speed "<