Ewon TechForum
Providing technical solutions to technical requests


WDT works with Open Close and timer
m-harigaya Offline
Junior Member
#1
Let me ask you a question.

WDT works and reboots in a few minutes using the timer and open-close 

Is the usage incorrect? The code is below.
WDT works even without put and get.

Thank you.


//Init Section
Tset 1,1  //***WDT works and reboots in a few minutes using the timer ***

//Cyclic Section
//modbus tcp open-close
If t%=0 Then
    Open "tcp:192.168.1.1:502,1" FOR BINARY OUTPUT AS 1
    t%=1
Endif

If t%=1 Then
  a%=Getsys PRG,"ACTIONSTAT"
  If a%=0 Then t%=2 //conection OK
  If a%>0 Then Close 1 : t%=0 //connection NG
Endif

If t%=2 Then
  //modbus
  s$=Chr$(0)+Chr$(0)+Chr$(0)+Chr$(0)+Chr$(0)+Chr$(6)+Chr$(1)+Chr$(3)
  s$=s$+Chr$(0)+Chr$(1-1)//address
  s$=s$+Chr$(0)+Chr$(150)//size
  //modbus

  Put 1,s$
  t%=3
Endif

If t%=3 Then
  r$=Get 1
  If r$<>"" THEN CLOSE 1 :t%=0 //OK(read)
Endif
Reply

simon Offline
eWON Support
#2
Hi,

What is the watchdog reason in your event logs ?
I have tried your script in my Cyclic section and my Ewon (running 13.3) run properly during 20 min...

Usually when I do such a script and I trigger it using a timer (1-2 second polling rate is enough) :

[To copy in init section]

TSET 1,1
ONTIMER 1, "GOTO COMM"

COMM:
TSET 1,0
Open "tcp:192.168.120.98:502,1" FOR BINARY OUTPUT AS 1

LIVEFEEDSOCKETOPEN:
S% = GETSYS PRG,"ACTIONSTAT"
IF S% > 0 THEN GOTO LIVEFEEDSOCKETCLOSE
IF S% = -2 THEN GOTO LIVEFEEDSOCKETCLOSE
IF S% = -1 THEN GOTO LIVEFEEDSOCKETOPEN

PRINT "opened"
s$=Chr$(0)+Chr$(0)+Chr$(0)+Chr$(0)+Chr$(0)+Chr$(6)+Chr$(1)+Chr$(3)
s$=s$+Chr$(0)+Chr$(1-1)//address
s$=s$+Chr$(0)+Chr$(150)//size
//modbus
Put 1,s$
retryread:
r$=Get 1
If r$ = "" THEN Goto retryread
If r$<>"" THEN GOTO LIVEFEEDSOCKETCLOSE
END

LIVEFEEDSOCKETCLOSE:
PRINT "close"
CLOSE 1
TSET 1,1
END

Does it reboot with this script too ?

Simon
Reply

m-harigaya Offline
Junior Member
#3
Hi Simon,

Thanks for getting back to me and thanks for your code.

I tried my code again and it stopped with reboot in a few minutes. Attach the LOG at that time.

I also tried your code. Your code did not reboot.
However, I think that is due to the frequency of open-close.
Actually, I want to connect with 200 devices while changing the IP address, so I need to open-close quickly.

Thank you.

Masa


Attached Files
.jpg   WDTREBOOT.jpg (Size: 233,58 KB / Downloads: 8)
Reply

simon Offline
eWON Support
#4
Masa,

Indeed that is perhaps the case. Do you see lots of "TCP connect failed" in your scheduled actions ?
Also, I guess you removed the line "Tset 1,1" in your init ? Because it is totally useless as you put your code in the cyclic section.

Simon
Reply

m-harigaya Offline
Junior Member
#5
Hi Simon,

Thanks for getting back to me again.

The original code was processed differently every second by the Timer.
In order to find out why WDT works, I made it a simple code.
After leaving “Tset” alone, it was decided whether WTD would work.

"ssnd-Connect socket failed " remaind in Event Logs .

Thank you.

Masa
Reply

simon Offline
eWON Support
#6
Hi Masa,

"ssnd-Connect socket failed means Ewon cannot connect to the device.

I don't get you when you say " After leaving “Tset” alone, it was decided whether WTD would work." When you just execute the line TSET 1,1 in your init, you get a watchdog too ? Please clarify.

Simon
Reply

RKMadBiker Offline
Junior Member
#7
Hello Simon, this is Peter Tazaki of Riken Keiki. I work in the same department as Masa.

Basically what he is saying is that the code in the OP above originally had calls using the TSET 1,1 but he removed those calls for debugging purposes. Basically, just having the TSET 1,1 line in the code seems to cause the reboot. Without the TSET 1,1 line, the simplified code does not reboot.

In the WDTREBOOT.JPG file, we can see there are "ssnd-Connect socket failed" errors but the frequency is low. The connect socket failed error frequency does not change with or without the TSET 1,1 line.

Could you also please explain what exactly does the "Watchdog in process (timer)" error mean?

Thank you for your support.
Peter
Reply

simon Offline
eWON Support
#8
Hi Peter,

The Watchdog in process (timer) means that the TIMER thread in the firmware is somehow stuck. So could be related to the timer TSET you use in combination of the cyclic section...

The error "ssnd-Connect socket failed" means that the connection to the device could not be opened.

Simon
Reply



Possibly Related Threads…
  Timer Count Value Started by lewist
3 Replies - 2.218 Views
29-08-2017, 04:30 PM
Last Post: simon
25-06-2016, 09:10 AM
Last Post: instruaravind



Users browsing this thread:
1 Guest(s)



Theme © Ewon 2019 - Forum software by © MyBB - Cookie policy