use high speed as default, fix current checksum
This commit is contained in:
+3
-3
@@ -26,7 +26,7 @@ A tool for loading firmware to the eBUS adapter PIC.
|
|||||||
-m, --mask=MASK set IP mask (e.g. 24)
|
-m, --mask=MASK set IP mask (e.g. 24)
|
||||||
-M, --macip set the MAC address suffix from the IP address
|
-M, --macip set the MAC address suffix from the IP address
|
||||||
-r, --reset reset the device at the end on success
|
-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
|
-v, --verbose enable verbose output
|
||||||
-?, --help give this help list
|
-?, --help give this help list
|
||||||
--usage give a short usage message
|
--usage give a short usage message
|
||||||
@@ -49,7 +49,7 @@ Firmware version not found
|
|||||||
MAC address: ae:b0:53:26:15:80
|
MAC address: ae:b0:53:26:15:80
|
||||||
IP address: DHCP
|
IP address: DHCP
|
||||||
|
|
||||||
New firmware version: 1 [d5d7]
|
New firmware version: 1 [c5e7]
|
||||||
erasing flash: done.
|
erasing flash: done.
|
||||||
flashing:
|
flashing:
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ On success, the output looks like this:
|
|||||||
Device ID: 30b0 (PIC16F15356)
|
Device ID: 30b0 (PIC16F15356)
|
||||||
Device revision: 0.1
|
Device revision: 0.1
|
||||||
Bootloader version: 1 [0a6c]
|
Bootloader version: 1 [0a6c]
|
||||||
Firmware version: 1 [d5d7]
|
Firmware version: 1 [c5e7]
|
||||||
MAC address: ae:b0:53:26:15:80
|
MAC address: ae:b0:53:26:15:80
|
||||||
IP address: DHCP
|
IP address: DHCP
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ static const struct argp_option argpoptions[] = {
|
|||||||
{"macip", 'M', nullptr, 0, "set the MAC address suffix from the IP address", 0 },
|
{"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 },
|
{"flash", 'f', "FILE", 0, "flash the FILE to the device", 0 },
|
||||||
{"reset", 'r', nullptr, 0, "reset the device at the end on success", 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 },
|
{nullptr, 0, nullptr, 0, nullptr, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ static bool setMask = false;
|
|||||||
static uint8_t setMaskLen = 0x1f;
|
static uint8_t setMaskLen = 0x1f;
|
||||||
static char* flashFile = nullptr;
|
static char* flashFile = nullptr;
|
||||||
static bool reset = false;
|
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) {
|
bool parseByte(const char *arg, uint8_t minValue, uint8_t maxValue, uint8_t *result) {
|
||||||
char* strEnd = nullptr;
|
char* strEnd = nullptr;
|
||||||
@@ -149,7 +149,7 @@ error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
|||||||
reset = true;
|
reset = true;
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
highSpeed = true;
|
lowSpeed = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return ARGP_ERR_UNKNOWN;
|
return ARGP_ERR_UNKNOWN;
|
||||||
@@ -209,7 +209,7 @@ typedef union
|
|||||||
|
|
||||||
#define FRAME_HEADER_LEN 9
|
#define FRAME_HEADER_LEN 9
|
||||||
#define FRAME_MAX_LEN (FRAME_HEADER_LEN+2*WRITE_FLASH_BLOCKSIZE)
|
#define FRAME_MAX_LEN (FRAME_HEADER_LEN+2*WRITE_FLASH_BLOCKSIZE)
|
||||||
#define BAUDRATE_NORMAL B115200
|
#define BAUDRATE_LOW B115200
|
||||||
#define BAUDRATE_HIGH B921600
|
#define BAUDRATE_HIGH B921600
|
||||||
#define WAIT_BYTE_TRANSFERRED_MILLIS 200
|
#define WAIT_BYTE_TRANSFERRED_MILLIS 200
|
||||||
#define WAIT_BITRATE_DETECTION_MICROS 100
|
#define WAIT_BITRATE_DETECTION_MICROS 100
|
||||||
@@ -594,7 +594,7 @@ int openSerial(std::string port) {
|
|||||||
struct termios termios;
|
struct termios termios;
|
||||||
memset(&termios, 0, sizeof(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 "<<std::endl;
|
std::cerr<<"unable to set speed "<<std::endl;
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user