Webserver running on Core0 issues

spyder0069
Posts: 35
Joined: Tue Jan 29, 2019 2:46 am

Re: Webserver running on Core0 issues

Postby spyder0069 » Thu Jan 31, 2019 3:18 pm

Dimming of mains. Zero crossing detection and handling of triacs. In pic microconrollers I use a hardware interrupt and can handle the rest of my code in between interrupts but with the esp32 so far I did not have good success with its interrupt (seemed to not be consistant) so I have it dedicated to the core1 task. Any interruption and your delay routine is thrown off and your output power is a mess. So ideally the webserver side would totally run off of core0 but it seems its own wifi and background tasks don't allow consistent pages to be served.

ESP_Sprite
Posts: 9759
Joined: Thu Nov 26, 2015 4:08 am

Re: Webserver running on Core0 issues

Postby ESP_Sprite » Fri Feb 01, 2019 2:55 am

Any chance of using the MCPWM peripheral to do the hard work? We can debug the software as well (100Hz interrupts should not be an issue for the ESP32 to handle at all) but the MCPWM peripheral is intended for that stuff.

spyder0069
Posts: 35
Joined: Tue Jan 29, 2019 2:46 am

Re: Webserver running on Core0 issues

Postby spyder0069 » Fri Feb 01, 2019 6:21 am

AC dimming doesn't use pwm like a DC motor.

ESP_Sprite
Posts: 9759
Joined: Thu Nov 26, 2015 4:08 am

Re: Webserver running on Core0 issues

Postby ESP_Sprite » Fri Feb 01, 2019 7:10 am

Obviously that's true, but on the other hand, the MCPWM peripheral can do more than just PWM :)

flamy69
Posts: 7
Joined: Fri Sep 10, 2021 7:08 am

Re: Webserver running on Core0 issues

Postby flamy69 » Fri Sep 10, 2021 7:12 am

Hi, I had similar issue and solution for that is CONFIG_ASYNC_TCP_RUNNING_CORE=0. Then all TCP things run on CORE 0 and my main loop on CORE 1 is not affected at all by webserver thinks.

spyder0069
Posts: 35
Joined: Tue Jan 29, 2019 2:46 am

Re: Webserver running on Core0 issues

Postby spyder0069 » Sat Sep 11, 2021 4:49 am

Thank you for the suggestion. I had moved the project on by using a separate inexpensive pic for the zerocrossing/mains and just send commands to it from the esp32. It did have some benefits like if the esp ever had a lockup the pic could timeout and safely handle things. However, now that some of the esp32 arduino is a little more mature maybe its worth revisiting this. After all with a chip shortage going on one less chip could be a big deal. :^)

Did you try the ESPAsyncWebServer by menodev with this setup?

flamy69
Posts: 7
Joined: Fri Sep 10, 2021 7:08 am

Re: Webserver running on Core0 issues

Postby flamy69 » Sun Sep 12, 2021 12:07 pm

spyder0069 wrote:
Sat Sep 11, 2021 4:49 am
Did you try the ESPAsyncWebServer by menodev with this setup?
Yes, this is exactly what I am doing, I am using ESPAsyncWebServer and it works great. My main loop last in avg 10us, max loop length is 81us and in same time I can be connected to webserver and read every 10 ms data via $.get from javascript. But now I found another "issue" and right now I do not know, what exactly it is, but when WiFi (no servers at that moment - i disabled it, looking for primal source of problem) connect as STA to my home AP, my main loop last about 2ms for just one run and then it is ok again and last maximal 81us. 2ms is not problem for me, but I want to understand, why it is happening.

And yes, I am working on coffee machine and I started with STmicrocotroller and HC-05 as bluetooth bridge, than I decided, that I want webserver, so I started work on ESP32 as observer of my STcontroller, but with global mcu shortage i decided to move whole code into ESP32, right now I am not sure about rightness of my decision, but I strongly believe, it will work.

Who is online

Users browsing this forum: No registered users and 50 guests