Home > Forum > Controllers SlimLine e Netsyst (LogicLab) > Reset the system from the user program
- This topic has 14 replies, 2 participants and was last updated 1 year, 2 months ago da Sergio Bertana.
-
AuthorPost
-
September 6, 2013 at 6: 49 am #35405Maurizio ContiParticipant
I would like to write a watchdog function that resets the PLC for me in case of any blockages (clearly assuming that the blocking leaves the watchdog function operational).
It is possible to reset it Slimline from ST code?
September 6, 2013 at 6: 53 am #37754Sergio BertanaAdministrator ForumThis post gives me the opportunity to explain in detail all the self-control mechanisms of the functioning managed by the operating system and by the hardware of the SlimLine.
Systems SlimLine they have a double hardware watchdog circuit, one based on a specially prepared circuit and one managed internally by the ARM processor. If the program does not cyclically refresh these two watchdogs, the system is reset in hardware mode, forcing a restart. All this management is done specifically to ensure that any system blockages do not block it, the IEC standard in fact provides that in the event of blocks on the functioning of the program the system restarts. There are also further controls managed in hardware mode by the ARM processor that cause the system to restart:
The program accesses an incorrect memory area.
The processor finds an incorrect instruction in the program.
Abnormals are enabled / disabled.
The processor heap memory is corrupted.It may happen that in the program transferred to the system there is a serious error that causes the system to restart, in this case I would find myself in a dead end, the system restarting re-runs the program in error restarting and this endlessly. So here's what if SlimLine recognizes that it was connected to a PC with the LogicLab development environment, in the event of an error it does not restart the program but goes into programming mode.
September 6, 2013 at 7: 16 am #37755Sergio BertanaAdministrator ForumI add the answer to your request, as mentioned in the previous post, SlimLine it is restarted if the program does not cyclically refresh the watchdog circuit, so if in your program you get stuck in an infinite loop you cause the system to restart. For example, it is possible to write a program of the type:
WHILE (Di00CPU) DO END_WHILE;
As can be seen by activating the Di00CPU variable (Defined as% IX255.0, 0 input of the CPU module) the program stops in an infinite loop causing the system to restart. SlimLine for intervention of the watchdog circuit.
Attenzione! Eseguendo questo tipo di tests od in generale se il programma và sempre in errore può essere impossibile riconnettere il sistema a LogicLab, per risolvere il problema occorre eseguire un catch del sistema e la successiva cancellazione del programma (Vedi post).
September 9, 2013 at 4: 03 pm #37761Maurizio ContiParticipantI tried to set the reset by 'appropriately' matching the program with the instruction WHILE (TRUE) DO END_WHILE;
The effect I get is to lose control from LogicLab (and I think also the functionality of the PLC) with ERROR signaling in red in the status bar. From here on it is no longer possible to connect to the PLC with LogicLab. To do this I have to switch the PLC off and on again and then everything goes back to working normally.September 10, 2013 at 1: 04 pm #37762Sergio BertanaAdministrator ForumThat's what you wanted to achieve. If you read my post well, closing the program in an infinite loop, the system resets and then starts from the beginning (Exactly as if it were turned off and on).
Your question was to reboot on certain conditions, so here the infinite loop must be enabled only on the conditions in which you want to reboot.
September 11, 2013 at 10: 10 am #37767Maurizio ContiParticipantI confirm what you say, the program restarts but the ability to control it is lost SlimLine by LogicLab. Even by deactivating the connection and then reactivating it, or by exiting and re-entering LL, it is no longer possible to connect to the SlimLine. The only way I've found is to turn it off and on again SlimLine, then also LL works.
September 11, 2013 at 10: 24 am #37768Sergio BertanaAdministrator ForumBut what kind of connection do you use with it? SlimLine ?
Serial connection, should resume without any problem.
TCP / IP connection on an Ethernet network, by rebooting the connection is lost, it must be disabled and then re-enabled.
TCP / IP connection on USB, you must disconnect and reconnect the USB cable and / or how you turn the device off and on again.September 11, 2013 at 4: 38 pm #37769Maurizio ContiParticipantI use the TCP / IP connection on USB; actually if I disconnect and reconnect the USB cable after the 'reset' then everything goes back to working. Surely this is better than switching the PLC off / on again.
September 11, 2013 at 4: 48 pm #37770Sergio BertanaAdministrator ForumThe problem is that the Windows RNDIS driver on the reboot does not notice the system disconnection and therefore keeps the USB connection active, it SlimLine instead, having reset, it interrupted the endpoint and therefore no longer communicates.
Disconnecting the cable or turning it off and on again SlimLine there is no electrical signal on the USB of the PC which resets all active connections.
March 12, 2014 at 1: 53 pm #38128Maurizio ContiParticipantThe recently purchased OEM PCB131A020 module appears to have a different behavior from the MPS050A020 following a forced reset: in fact, while the latter restarts regularly the former remains stationary (I have to start from LogicLab). Do I need to configure something somewhere?
March 12, 2014 at 2: 47 pm #38129Sergio BertanaAdministrator ForumIl OEM module it is exactly the same circuit you find in the complete MPS050A020 module, so there are no circuit differences. You can check if the firmware installed in the two modules if it is the same version SFW184 *** 0 otherwise you can perform an upgrade (See noteBut you tell me that you have to start from LogicLab, I was wondering it's not that when you force the reset you have LogicLab connected, because in this case the system resets itself, but the user program does not go into execution.
October 11, 2019 at 2: 55 pm #50127RuboxParticipantReading on the forum I come across posts that interest me, even if they are "old" by years and I have questions after questions.
It is interesting to be able to restart the PLC by placing it in an infinite loop. Is there a way to notice that the system has restarted due to something abnormal? Like a bool flag that tells me one or more restarts for the watchdog?
October 11, 2019 at 3: 03 pm #50194Sergio BertanaAdministrator ForumCurrently there is no variable that indicates what kind of startup the system had, but I find the idea interesting and let's see if we can also include this possibility in a next release of the operating system.
If you want to "understand" that the system has rebooted for a watchdog created by you in the program (infinite loop), there is a workaround. Before stopping in the loop, write a certain value to a backup memory location (Example assuming a UDINT 16 # 12345678). Then wait a few seconds to ensure that the data has been backed up, you can also synchronize by testing the variable SysBackupEnd, which must be activated at least 2 times.
Now at start-up you check the value of the variable and if it is the value you defined the system restarted due to your command. Of course just after the check you have to set the value of the variable to 0.
February 10, 2023 at 9: 44 am #70065Alessandro CampodonicoParticipantI came across this old thread, as I would be interested in rebooting the SlimLine from user program.
I was wondering if there has been an “alternative system to restart the lo” implemented over the years slimline from the program, or if the solution is always to be kept valid
WHILE (Di00CPU) DO END_WHILE
February 13, 2023 at 11: 06 am #70095Sergio BertanaAdministrator ForumTo restart the system you can use the function SysOSIDValue passing as OSID the definition OSID_PLC_COMMAND with the values:
- reboot: reboots the system.
- restart: restarts the PLC program only, all variables are reset.
Here is a sample program (Must run in task Back).
PROGRAM RebootRestart VAR i : UDINT; (* Auxiliary variable *) Reboot : BOOL; (* Reboot command *) Restart : BOOL; (* Restart command *) END_VAR IF (Reboot) THEN i:=SysOSIDValue(TRUE, OSID_PLC_COMMAND, ADR('reboot')); END_IF; IF (Restart) THEN i:=SysOSIDValue(TRUE, OSID_PLC_COMMAND, ADR('restart')); END_IF;
-
AuthorPost
- You must be logged in to reply to this topic.