DSL
Hello.
 
I make a trivial program like on picture 1 just for test purposes.
If I set Scan Cycle to T#700ms as on picture 2 and start Live Debug, everything works as it should.
When test IP address usage, as on picture 2.5 ESP8266 is identified as Espressif Inc. with address 192.168.1.130 and this is static IP address from address pool that I was set on my router, so, there is no mess with IP addresses.
 
Now comes a fun part, when I change Scan Cycle time from T#700ms to T#2000ms, as on picture 3 and all other leave as it was and try to start Live Debug, I end up with message like on picture 4.
 
When test IP address usage, as on picture 4.5 ESP8266 is NO MORE identified as Espressif Inc. but still with address 192.168.1.130. At the Bottom of those pictures is statistics that says: "6 alive, 5 dead, 243 unknown", same message on picture 2.5 and 4.5, so, Advanced IP Scanner still see ESP8266 as active.
 
Of course. Live Debug not working, that is fun part.
 
To be more funny, if I gradually increase Scan Cycle time in steps of 100ms I can achieve ESP8266 to work with longer Scan Cycle.
Reply 0 0
thiagoralves
This is indeed very weird. Maybe it could be explained by the cyclic nature of the OpenPLC runtime. If the delay between cycles is too long, it might starve some ESP8266 functions that need to run periodically, which can lead to the problems you're describing. However, I can't think of anything right now that OpenPLC calls that is strictly required for the ESP8266 to work. Maybe a deep dive into the code can lead to an answer on this. In any case, it is always better you keep at least one task running at a faster interval, usually 20ms, even if the task is doing nothing.
Reply 0 0
DSL
This is indeed very weird. Maybe it could be explained by the cyclic nature of the OpenPLC runtime. If the delay between cycles is too long, it might starve some ESP8266 functions that need to run periodically, which can lead to the problems you're describing. However, I can't think of anything right now that OpenPLC calls that is strictly required for the ESP8266 to work. Maybe a deep dive into the code can lead to an answer on this. In any case, it is always better you keep at least one task running at a faster interval, usually 20ms, even if the task is doing nothing.
Thank you for your response.
 
In this project I use DS18B20 temperature sensor. Measuring cycle time for this sensor is about 980ms (AD conversion and communication), so if I use FBD DS18B20, and I use it, this measuring cycle is done with in Scan Cycle, so no matter what Scan Cycle I set, if I use DS18B20 it will be slow down to about 980ms, that is how I came across these phenomena in the first place. So, the core problem is that FBD DS18B20 is not a parallel process, or at least it is not as far as I can see, I can not set Scan Cycle arbitrary and just read current value of temperature from memory, instead, when measuring take place, it takes place with in Scan Cycle, so everything else is stopped, until it is finished, hence slow down in Scan Cycle execution.
Reply 0 0
thiagoralves
Ah, there is your answer! The problem is not the scan cycle time (which I suspected from the beginning), but the fact that the DS18B20 is a very slow sensor. The library implementation that OpenPLC uses reads the sensor making use of delays to adjust to the sensor timing. This locks the esp8266 and prevents the WiFi tasks to run.
 
What you could try in this case is to write your own parallel DS18B20 implementation using a non blocking library on the new Arduino Sketch feature:   https://openplc.discussion.community/post/new-feature-arduino-sketch-on-plc-programs-13249303
Reply 1 0
DSL
Ah, there is your answer! The problem is not the scan cycle time (which I suspected from the beginning), but the fact that the DS18B20 is a very slow sensor. The library implementation that OpenPLC uses reads the sensor making use of delays to adjust to the sensor timing. This locks the esp8266 and prevents the WiFi tasks to run.
 
What you could try in this case is to write your own parallel DS18B20 implementation using a non blocking library on the new Arduino Sketch feature:   https://openplc.discussion.community/post/new-feature-arduino-sketch-on-plc-programs-13249303
Thank you so much. This is extremely useful functionality. It give us opportunity to blend best from both world, embedded and PLC.
Reply 0 0
Reply