Merge pull request #1216 from MCUdude/slow-clock-error
Print meaningful error when a too slow ISP clock is detected
This commit is contained in:
commit
3c152dc122
|
@ -1242,8 +1242,11 @@ int main(int argc, char * argv [])
|
||||||
init_ok = (rc = pgm->initialize(pgm, p)) >= 0;
|
init_ok = (rc = pgm->initialize(pgm, p)) >= 0;
|
||||||
if (!init_ok) {
|
if (!init_ok) {
|
||||||
pmsg_error("initialization failed, rc=%d\n", rc);
|
pmsg_error("initialization failed, rc=%d\n", rc);
|
||||||
|
if(rc == -2)
|
||||||
|
imsg_error("the programmer ISP clock is too fast for the target\n");
|
||||||
|
else
|
||||||
imsg_error("- double check the connections and try again\n");
|
imsg_error("- double check the connections and try again\n");
|
||||||
imsg_error("- use -B to set lower ISP clock frequency, e.g. -B 200kHz\n");
|
imsg_error("- use -B to set lower ISP clock frequency, e.g. -B 125kHz\n");
|
||||||
if (!ovsigck) {
|
if (!ovsigck) {
|
||||||
imsg_error("- use -F to override this check\n\n");
|
imsg_error("- use -F to override this check\n\n");
|
||||||
exitrc = 1;
|
exitrc = 1;
|
||||||
|
|
|
@ -795,6 +795,11 @@ retry:
|
||||||
// attempt to read the status back
|
// attempt to read the status back
|
||||||
status = stk500v2_recv(pgm,buf,maxlen);
|
status = stk500v2_recv(pgm,buf,maxlen);
|
||||||
|
|
||||||
|
DEBUG("STK500V2: stk500v2_command() received content: [ ");
|
||||||
|
for (size_t i=0; i<len; i++)
|
||||||
|
DEBUG("0x%02x ",buf[i]);
|
||||||
|
DEBUG("], length %d\n", (int) len);
|
||||||
|
|
||||||
// if we got a successful readback, return
|
// if we got a successful readback, return
|
||||||
if (status > 0) {
|
if (status > 0) {
|
||||||
DEBUG(" = %d\n",status);
|
DEBUG(" = %d\n",status);
|
||||||
|
@ -858,6 +863,9 @@ retry:
|
||||||
return status;
|
return status;
|
||||||
} else if (buf[1] == STATUS_CMD_FAILED) {
|
} else if (buf[1] == STATUS_CMD_FAILED) {
|
||||||
pmsg_error("command failed\n");
|
pmsg_error("command failed\n");
|
||||||
|
} else if (buf[1] == STATUS_CLOCK_ERROR) {
|
||||||
|
pmsg_error("target clock speed error\n");
|
||||||
|
return -2;
|
||||||
} else if (buf[1] == STATUS_CMD_UNKNOWN) {
|
} else if (buf[1] == STATUS_CMD_UNKNOWN) {
|
||||||
pmsg_error("unknown command\n");
|
pmsg_error("unknown command\n");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -138,6 +138,9 @@
|
||||||
#define STATUS_CKSUM_ERROR 0xC1
|
#define STATUS_CKSUM_ERROR 0xC1
|
||||||
#define STATUS_CMD_UNKNOWN 0xC9
|
#define STATUS_CMD_UNKNOWN 0xC9
|
||||||
#define STATUS_CMD_ILLEGAL_PARAMETER 0xCA
|
#define STATUS_CMD_ILLEGAL_PARAMETER 0xCA
|
||||||
|
#define STATUS_PHY_ERROR 0xCB
|
||||||
|
#define STATUS_CLOCK_ERROR 0xCC
|
||||||
|
#define STATUS_BAUD_INVALID 0xCD
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
#define STATUS_ISP_READY 0x00
|
#define STATUS_ISP_READY 0x00
|
||||||
|
|
Loading…
Reference in New Issue