-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RTS question #50
Comments
I see no attached files I can review the problem. |
@nissimzur what attached files are you refering to? download cmd line for esp8266 or others? |
You say "I add the source code" Please add a full source code and I will test on my side. |
void serialport_drain(void) } int serialport_close(void) void serialport_set_dtr(unsigned char val) |
@nissimzur in serialport/serialport.c |
Sorry for a dumb question @ouki-wang, but why do you expect to receive an RTS packet when serial port is being closed? We aren't resetting the ESP using external reset, instead we are telling the ROM bootloader of the ESP to start running the application. |
@igrr I want to use a pin to control GPIO0 when receiving RTS signal。 |
@igrr sorry ,I am not familiar with the CDC protocol。 |
GPIO0/CH_PD get toggled when the port is opened, call chain looks like this: espcomm_open > espcomm_sync > espcomm_enter_boot > espcomm_board_reset_into_bootloader > (one of board_XX_rb functions in espcomm_boards.c). There you can see that depending on reset method, different manipulations with RTS/DTR are performed. When serialport_set_rts is called, that will use ioctl (with TIOCMSET, TIOCM_RTS) (on Linux/Mac) or EscapeCommFunction (on Windows). Then it's the operating system's duty to translate this into underlying driver calls which should then emit corresponding packet. |
@igrr thanks for your help。i test my cdc and ch340 and guess it is usb cdc windows driver‘s defect。 |
Do you expect the state serialport_set_rts(1);///////// my code serialport_set_dtr(0);///////// my code
Will be same after you kill the USB serial port ?
The driver will free that to accept new connection. meaning RTS and DTR will change.
Please work with single step and verify the voltage level on RTS DTR before USB serial port closed and after.
Kind regards,
Dr. Nissim Zur
Bluetooth Smart, IoT expert
<http://www.elinistech.com/> CTO Elinistech
Skype <callto:nissim.test> nissim.test
Follow <https://goo.gl/CXY35s> Linkedin https://goo.gl/CXY35s
Email [email protected]
<http://www.elinistech.com/> www.elinistech.com
From: ouki [mailto:[email protected]]
Sent: Friday, March 31, 2017 11:26 AM
To: igrr/esptool-ck
Cc: Dr. Nissim Zur; Mention
Subject: Re: [igrr/esptool-ck] RTS question (#50)
void serialport_drain(void)
{
if(sPort)
{
FlushFileBuffers(sPort);
}
}
int serialport_close(void)
{
if(!sPort)
return 0;
serialport_drain();
serialport_flush();
serialport_set_rts(1);///////// my code
serialport_set_dtr(0);///////// my code
CloseHandle(sPort);
sPort = NULL;
return 1;
}
void serialport_set_dtr(unsigned char val)
{
if(sPort)
{
EscapeCommFunction(sPort,((val)?SETDTR:CLRDTR));
}
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#50 (comment)> , or mute the thread <https://github.com/notifications/unsubscribe-auth/ADgOR1i2GRtsEeXhN4QcGRNpmm-Ps03Rks5rrLiHgaJpZM4Mt7rS> . <https://github.com/notifications/beacon/ADgORyMWLX0SE2wwkJrj_lyYJVs2aHv8ks5rrLiHgaJpZM4Mt7rS.gif>
|
have you tested a standard USB CDC device except cp2102 and ch340?
I expect to receive an RTS packet(21 22 02 00 00 00 00 00) to reset esp8266.
but I can not receive it.
I add the source code
serialport_set_rts(1);
serialport_set_dtr(0);
in function serialport_close()
.
packet(21 22 02 00 00 00 00 00) will be sended.
The text was updated successfully, but these errors were encountered: