-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
[BUG]WifiTask running on core 0 may result in halts during prints #10
Comments
Marlin run on Core 1 like all arduino |
@luc-github Thanks for clarifying. I guess the random halts are caused by something else then. Will close this. |
@vivian-ng they are not same random pause that @felixstorm fixed ? they happened wifi off these new ones happen only when wifi on ? |
@luc-github Could this be the problem?
in Since the I2S stepper task is not pinned to any core, will it end up running on core 0 and become interfered by wifi? |
you may add
but may need to store in variable as I am not sure the output is already available when init task |
Generally I would also run all non-Marlin tasks on core 0 (WiFi, ESP3DLib etc.) and run everything Marlin undisturbed on core 1, so also pinning the stepper task to @vivian-ng Do you still have any random pauses now with the latest Marlin versions? |
@felixstorm I am using quite a new version of Marlin bugfix-2.0.x (fetched about two days back). Usually, no issues with printing, but yesterday, I was having a lot of connections problems on 2.4G wifi (either my router is giving me problems on 2.4G, or my area has a lot of 2.4G interference) and my ESP32 devices (printer and even ESP32-CAMs). I finally managed to get a connection on my Ender-3 running on my MRR ESPE board (with I2S), but it was quite a bad connection (loading webUI took longer time than usual, etc.) When printing, I noticed a lot of pauses. I ended up halting the prints. @luc-github I think the I2S stepper stream is probably on core 0, since Marlin is already running on core 1, and the
The thing is, it is difficult for me to recreate the conditions to test if any solution actually solves this. The issue only occurs when I have problems on my 2.4G wifi, and fortunately, that is not often. Whatever the case, I think I will just push this fix as a PR to Marlin next week (after I test it out a bit to make sure it does not create more problems than solve them). Maybe this fix will even help resolve the issue with babystepping on I2S. (wishful thinking on my part) |
@luc-github Should Something like:
which will run on core 0 if Anyway, I have submitted PR#16874 to Marlin to explicitly run I2S stepper task on |
arduino core is build like this, changing core in sdkconfig means new arduino core and this may break backward compatibility so I really doubt it will happen ever on arduino core, it only may be done using IDF and arduino as component, core for ESP3DLib could be an overidable define yes, but I really doubt of need, anyway it is just 3 lines of code to let full flexibility same as core or not I will add this possibility later |
@vivian-ng I have added the defines for ESP3DLIb task priority and targeted core |
@luc-github I have compiled the latest version with your PR already included against a slightly modified version of the Arduino-ESP32 libraries that lets me dump FreeRTOS task statistics.
To me, this looks ok now. Should we still encounter pauses due to WiFi issues in the future, I see 2 more viable options:
All options might have side effects, so before implementing anything "just in case" we should IMHO wait if there are really still issues and if so, setup a test environment to duplicate the issues and then try out fixes... |
Thank you! It was just a suggestion because I am not a fan of magic numbers in code. As for |
the event task will call this function when event is catched : Lines 178 to 191 in 3cf617b
So probability it generate pause is very very low I think |
This was an issue raised when this was part of a custom Marlin fork.
The wifi task running on the same core as the rest of Marlin may cause random halts during prints when wifi connection is poor. The solution back then was to run wifi task on another core.
I believe
esp3dlib.cpp
can be amended to run wifi task on core 1 instead of 0.The text was updated successfully, but these errors were encountered: