-
Notifications
You must be signed in to change notification settings - Fork 54
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
NodeMCU v1.5.1 - Reset on echo #14
Comments
Oh interesting. I'm printing the result of the echo command and....
I think my ESP is resetting. Not sure why. |
Okay I'm guessing that the WeMOS D1 resets on a new connection for convenience. Problem #1 Problem #2 |
Okay PR #15 works for me so far, but I'm not sure how that would affect older devices. Maybe you have some insight? |
Dear pctj101, i have reject your pull request, because you are using synchronous code which may cause an unexcpected behaviour in some cases: the serial-io is async, therefore it can cause random delays between the command and its execution. in some cases the two echo commands can overlap and this will cause a fatal error. currently, i am not shure whats going on in NodeMCU v1.5.X - a reset should not happen during the transfer. i will investigate this issue - maybe they have changed the API again and one of the commands used by NodeMCU-Tool cause the reset... best regards, Andi |
Thanks for the detailed rejection! :P I'll take a peek later if I get a chance to see if there's a way i can improve it.
|
Dear pctj101, i've just updated my NodeMCU Dev Kit to v1.5.1 (cjson, file, gpio, mqtt, net, node, tmr, uart, wifi) using http://nodemcu-build.com/ and i cannot reproduce the problems you've mentioned. which build options do you use ? do you have re-created the file-system after flashing the firmware ? Step 1 - Firmware Flash
Step 2 - Power on/off the Module Step 3 - Re-Create the File System
Step 4 - Upload + Run LUA Files
|
Hi Andi, FYI the modules I included are:
I'm using a Wemos D1 which may for whatever reason have DTR/RTS hooked up in some way that makes the board reset "on connect" which it certainly seems to love doing (reset nodemcu when I "open the serial port on my mac") I did 'mkfs' after flashing my device and file uploads work "great" when they work. In your case if your board does not reset, then the code I provided is of course not necessary. The code I provided effectively skips over the boot messages and only looks for the echo response at the very end of whatever comes back over the serial line. I have other boards that don't auto-reboot because that's "not how it's wired" and will probably have no issue. Do you happen to have any chronic-rebooting boards? :) |
For fun, I'm trying to build an image (master) that follows your selected modules. Will give you an update when I get the output and give it a spin. :) |
Yeah so on a custom board I have that does not have the luxury of DTR/RTS "software induced" reset, I have no issues at all and life is great. It's those fancy boards... much in the same way those "Arduinos" have something more fancy than just the "plain atmega chip". |
Verified the custom non-fancy board does no reset using: Both before/after uploading a file. Uptime only goes up! :) Almost surely that fancy serial DTR/RTS based reset. |
Do you have this board http://www.wemos.cc/Products/d1_r2.html ? The reset circuit on it is taken from the official NodeMCU DevKit - i have one of these boards here to test NodeMCU Tool and everything works fine including the rts/dtr hard-reset - therefore, the behaviour of your board is very very strange! maybe it is a issue with the serial driver which cause the reset. what happens if you use the terminal mode ?
does a reset happen every time you use this command ? |
This is the board I have: Will check terminal in a bit. From what I remember the board does reset upon a new connection.
|
So yes! terminal does reset my device $ nodemcu-tool -p /dev/tty.whatver terminal
|
Flashed with This was built against the master branch and includes the following modules: cjson, file, gpio, mqtt, net, node, tmr, uart, wifi. (Not sure why I don't see a boot banner... but... okay here we go...)
Exit then try again
|
…rd-reset on opening the serial connection (dts/rts lines) #14
Dear pctj101, i've added the please try to upload a file or run a file on your "weak" module as follows:
this will delay the connection check by 5000+3000ms i've tested this with my NodeMCU DEVKIT by running a hard reset before the command:
|
cool will try |
Delay works well. Noticed some hard coded delays of 1000 (ms?) in code. Could make that a variable as you see fit so that a 2 second total delay isn't hard coded. NOTE: Tried to play with code
I did notice that if I lowered Delay #2 and #3 below say 200ms, the tool would "lock up" at:
But I have no idea why. Maybe something to do with async calls and serial writes getting "mixed up" like you alluded to before. FYI I'm using flags: Also I noticed that --port doesn't seem to work for whatever reason (again, don't know why but changing defaults directly in source works fine) |
thanks for your support! the im not sure if it is useful to make the other delays accessable by end-users. they are required for the auto-baud detection of NodeMCU (the first few echo characters have to be purged). maybe 500ms each will be a good value? |
…1<>wait<>sequence2<>wait<>connectionCheck #14
…1<>wait<>sequence2<>wait<>connectionCheck #14
Hey Andi, Sorry a bit tied up and wasn't able to test the "reduced sleep" for autobaud. My logs show errors only when reducing below 200ms, so I'm guessing that in lieu of additional information, that 500ms should be plenty enough. |
Great! Then i will release the v2.0.0 within the next days |
Hi Andi , C:\Users\TANVI>nodemcu-tool --port COM6 --baud=9600 run test.lua C:\Users\TANVI>nodemcu-tool run helloworld.lua --connection-delay 5000 --baud 115200 --port COM6 |
@tanviranade please open a new issue! |
I'm getting this error message often:
Simply re-running the command between 1 - 20 times eventually gets success.
I never had such issues in 0.9.x NodeMCU releases.
I've looked at the source and see that the connection is a simple connect, echo and string compare, so I can't see why it wouldn't work.
Any ideas? :)
The text was updated successfully, but these errors were encountered: