msalau / rl78flash

Tool to program RL78 MCUs via serial bootloader

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I propose the code not using DTR.

Hokoshi opened this issue · comments

Thank you for the wonderful code.
I am allowed to refer to it.
However, DTR did not exist in UB232R which I have.

It is a problem that these codes must use DTR.

RESET is controlled by RTS.
DTR does not use it.
As for the following, only an adjusting point is.

It was able to write in G13 well by UB232R.

Bye

Email:okoshi3@yahoo.co.jp

..........
int rl78_reset_init(int fd, int baud, int mode, float voltage)
{
unsigned char r;
if (1 == mode)
{
r = SET_MODE_1WIRE_UART;
}
else if (2 == mode)
{
r = SET_MODE_2WIRE_UART;
}
else
{
fprintf(stderr, "Unsupported mode %i\n", mode);
return -1;
}
communication_mode = mode;
if (4 <= verbose_level)
{
printf("Using communication mode %u\n", communication_mode);
}

//H.Okoshi 2012.11.02   //Original
serial_set_rts(fd, 0);  //serial_set_dtr(fd, 0);      /* RESET -> 0 */
ioctl(fd, TIOCSBRK);    //serial_set_rts(fd, 0);      /* TOOL0 -> 0 */
usleep(3000);
serial_set_rts(fd, 1);  //serial_set_dtr(fd, 1);      /* RESET -> 1 */
usleep(10);
ioctl(fd, TIOCCBRK);    //serial_set_rts(fd, 1);      /* TOOL0 -> 1 */
usleep(1000);

....

int rl78_reset(int fd)
{
ioctl(fd, TIOCCBRK); //serial_set_rts(fd, 1); /* TOOL0 -> 1 /
serial_set_rts(fd, 0); //serial_set_dtr(fd, 0); /
RESET -> 0 /
usleep(10000);
serial_set_rts(fd, 1); //serial_set_dtr(fd, 1); /
RESET -> 1 */
return 0;
}

Hello Hokoshi.

Thank You for feedback and proposal.
This is great idea to eliminate separate pin to control fixed level on TOOL0 pin. I'll implement it shortly.

Maxim.

Hi, rl78flash now supports mode in which Reset signal is generated by RTS pin. See -m argument (mode 3 and 4).

Maxim.