Baxter666666
Hi All,

I have tried to upload my first PLC program onto my Raspberry Pi through the Webserver, however it seems to not be connecting to my IP server. This was the message sent back through the run time logs whenever i tried to run the PLC after uploading it.

OpenPLC Runtime starting...
Interactive Server: Listening on port 43628
Warning: Persistent Storage file not found
Issued start_modbus() command to start on port: 502
Server: Listening on port 502
Server: waiting for new client...
Issued start_dnp3() command to start on port: 20000
DNP3 ID manager: Starting thread (0)
DNP3 ID DNP3_Server: Listening on: 0.0.0.0:20000
Issued start_enip() command to start on port: 44818
Server: Listening on port 44818
Server: waiting for new client...
Issued stop_pstorage() command
Issued start_modbus() command to start on port: 502
Modbus server already active. Restarting on port: 502
Server: Error accepting client!
Terminating Server thread
Modbus server was stopped
Server: Listening on port 502
Server: waiting for new client...
Issued start_dnp3() command to start on port: 20000
DNP3 server already active. Restarting on port: 20000
DNP3 ID DNP3_Server: Operation aborted.
DNP3 ID manager: Exiting thread (0)
DNP3 server was stopped
DNP3 ID manager: Starting thread (0)
DNP3 ID DNP3_Server: Listening on: 0.0.0.0:20000
Issued start_modbus() command to start on port: 502
Modbus server already active. Restarting on port: 502
Server: Error accepting client!
Terminating Server thread
Modbus server was stopped
Server: Listening on port 502
Server: waiting for new client...
Issued start_dnp3() command to start on port: 20000
DNP3 server already active. Restarting on port: 20000
DNP3 ID DNP3_Server: Operation aborted.
DNP3 ID manager: Exiting thread (0)
DNP3 server was stopped
DNP3 ID manager: Starting thread (0)
DNP3 ID DNP3_Server: Listening on: 0.0.0.0:20000
Issued start_enip() command to start on port: 44818
EtherNet/IP server already active. Restarting on port: 44818
Server: Error accepting client!
Terminating Server thread
EtherNet/IP server was stopped
Server: Listening on port 44818
Server: waiting for new client...
Issued stop_pstorage() command

Sorry for the long list from the Runtime Log but any help would be grateful.
Quote 0 0
thiagoralves
First of all, your program is running fine. From the logs it seems that you have started and stopped the services (modbus, dnp3 and ethernet/ip servers) a couple times. Were you playing with the settings while the program was running? What exactly are you trying to do?
Quote 1 0
Baxter666666
Hi, 

No I haven't touched the settings. My PLC was running the example from 'Creating your first Project' as it is my first project. The circuit isn't working on my breadboard and I thought this might be the factor inwhich it isn't working.
Quote 0 0
thiagoralves
Something else might be killing the threads then, however, it shouldn't affect the behavior of the program. There are so many 3rd party software that can interfere with OpenPLC runtime that it is always recommended to install OpenPLC on a clean image of Raspbian. Once OpenPLC is running properly, check the Monitoring tab to see if the inputs and outputs are being activated as expected. Also, make sure that you've selected the right driver on the Hardware tab, otherwise OpenPLC won't be able to control the GPIO pins. 
Quote 0 0
Baxter666666
My Hardware tab has Raspberry Pi as the Hardware Layer already.

This is this current logs whenever I started the PLC again:

OpenPLC Runtime starting...
Interactive Server: Listening on port 43628
Warning: Persistent Storage file not found
Issued start_modbus() command to start on port: 502
Server: Listening on port 502
Server: waiting for new client...
Issued start_dnp3() command to start on port: 20000
DNP3 ID manager: Starting thread (0)
DNP3 ID DNP3_Server: Listening on: 0.0.0.0:20000
Issued start_enip() command to start on port: 44818
Server: Listening on port 44818
Server: waiting for new client...
Issued stop_pstorage() command

The PLC force stops on the webserver then. Whenever the PLC is running, from the monitoring tab the Outputs and Inputs aren't being registered when pressed. I assume that this is a breadboard wiring issue.
Quote 0 0
thiagoralves
What does your wiring look like? What do you mean by "the PLC force stops on the webserver"?
Quote 0 0
Baxter666666
From the picture, I have the two push buttons connected to the 3.3V from the R-Pi and the other side of the push button is connected to input pins %IX0.0 and %IX0.1. I haven't included any resistors. My LED is connected to ground on the flat side and pin %QX0.0 on the other. By 'Force Stop' I mean that when I go to start my PLC from the dashboard of the webserver, it says 'Status = Running' for 10ms after I click the 'Run PLC' button and then its cuts to 'Status = Stopped'. However when I start running the PLC directly after it again it stays running then. I hope this is clearly explained.
Quote 0 0
thiagoralves
Your wiring is totally wrong. From the "creating my first project" page:
Quote:
On Raspberry Pi boards, the first two inputs (%IX0.0 and %IX0.1) are inverted in hardware. This can give you problems as it will be like if the buttons are constantly pressed. You can invert the input in your PLC program by using negated contacts (if you know how to do it) or you can just use other inputs instead, like %IX0.2 and %IX0.3.

Also, since the Raspbery Pi is not an industrial board, you must add the resistors. Otherwise your inputs will float when the buttons are not pressed and your program simply won't work as you're expecting.
Finally, an LED without resistor connected directly to the Pi = burned LED. You must add a resistor to prevent the LED from burning. Something small, like 220ohms or so will do the job.
Quote 0 0