Skip to content

Commit

Permalink
Merge branch 'fix-issue-8'
Browse files Browse the repository at this point in the history
  • Loading branch information
msalau committed Mar 15, 2017
2 parents 3eefb59 + fe79459 commit 8c4b1e6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ int main(int argc, char *argv[])
{
printf("Erase\n");
}
rl78_erase(fd, code_size, data_size);
rc = rl78_erase(fd, code_size, data_size);
if (0 != rc)
{
fprintf(stderr, "Erase failed\n");
Expand Down
2 changes: 1 addition & 1 deletion src/rl78.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ int rl78_reset_init(port_handle_t fd, int wait, int baud, int mode, float voltag
serial_flush(fd);
usleep(1000);
rl78_set_reset(fd, mode, 1); /* RESET -> 1 */
usleep(10);
usleep(3000);
serial_set_txd(fd, 1); /* TOOL0 -> 1 */
usleep(1000);
serial_flush(fd);
Expand Down
23 changes: 11 additions & 12 deletions src/rl78g10.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ static int get_size_from_code (unsigned int code)
int size;
switch (code)
{
case 0x01: size = 512; break;
case 0x03: size = 1024; break;
case 0x07: size = 1024*2; break;
case 0x0F: size = 1024*4; break;
case 0x1F: size = 1024*8; break;
case 0x3F: size = 1024*16; break;
case 0x7F: size = 1024*32; break;
case 0xFF: size = 1024*64; break;
case 0x01: size = 512; break;
case 0x03: size = 1024; break;
case 0x07: size = 1024*2; break;
case 0x0F: size = 1024*4; break;
case 0x1F: size = 1024*8; break;
case 0x3F: size = 1024*16; break;
case 0x7F: size = 1024*32; break;
case 0xFF: size = 1024*64; break;
default: size = -1; break;
}
return size;
Expand Down Expand Up @@ -71,7 +71,7 @@ int rl78g10_reset_init(port_handle_t fd, int wait, int mode)
serial_flush(fd);
usleep(1000);
rl78g10_set_reset(fd, mode, 1); /* RESET -> 1 */
usleep(1000);
usleep(2000);
serial_set_txd(fd, 1); /* TOOL0 -> 1 */
usleep(1000);
serial_flush(fd);
Expand Down Expand Up @@ -210,7 +210,7 @@ int rl78g10_crc_check(port_handle_t fd, const void *data, int size)
buf[0] = STATUS_ACK;
serial_write(fd, buf, 1);
serial_read(fd, buf, 1);

/* Wait till end of CRC calculation */
int i = 100;
int n;
Expand All @@ -230,7 +230,7 @@ int rl78g10_crc_check(port_handle_t fd, const void *data, int size)
perror("Unable to read from port:");
return -1;
}

if (buf[0] != STATUS_ACK)
{
fprintf(stderr, "Unexpected response %02X\n", buf[1]);
Expand All @@ -250,4 +250,3 @@ int rl78g10_crc_check(port_handle_t fd, const void *data, int size)
}
return 0;
}

2 changes: 2 additions & 0 deletions src/serial_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ port_handle_t serial_open(const char *port)
dcbSerialParams.Parity = NOPARITY;
dcbSerialParams.fDtrControl = DTR_CONTROL_DISABLE;
dcbSerialParams.fRtsControl = RTS_CONTROL_DISABLE;
dcbSerialParams.fInX = FALSE;
dcbSerialParams.fOutX = FALSE;
SetCommState(fd, &dcbSerialParams);

COMMTIMEOUTS timeouts;
Expand Down

0 comments on commit 8c4b1e6

Please sign in to comment.