GreatGBL
Hello, I tested an OpenPLC code run on the Arduino Uno and it was succeed, but it fail on the Arduino Mega 2560 , I dont know why.

I build it in same environment and I am sure the "OpenPLC_MEGA_fw" was succeed upload. So I dont know why it fail, there is no any reply on my laptop, just I click the button and nohting happen. Thanks
Quote 0 0
thiagoralves
I need more information to be able to help you. What is the OpenPLC log? Are the RX/TX lights flashing? What is the COM port your Arduino Mega is using?
Quote 0 0
sony
Hello,
I also have the same problem. If I look at the View PLC log has information "Trying to open /dev/ttyS0"
I has been uploading the 'OpenPLC_MEGA_fw.ino' into arduino mega. No light the RX/TX indicator. I use COM4 for my USB arduino mega.
Please give me the hint.
Thanks
Quote 0 0
thiagoralves
Can you paste your full log here?
Quote 0 0
yecao
I also encountered the same problem, using USB on the Arduino Mega 2560 to receive no data.
Without used USB, use the TTL (RX0, TX0) on the Arduino Mega 2560 to connect to the Raspberry Pi TTL (/dev/ttyAMA0) for normal communication.
Quote 0 0
thiagoralves
Did you flash OpenPLC firmware to your Arduino Mega? What do the logs say? I can't help without seeing the problem.
Quote 0 0
yecao
OpenPLC Runtime starting...
Interactive Server: Listening on port 43628
Device test is disconnected. Attempting to reconnect...
Connected to MB device test
Modbus Read Discrete Input Registers failed on MB device test: Connection timed out
Modbus Write Coils failed on MB device test: Connection timed out
Issued stop_dnp3() command
Modbus Read Input Registers failed on MB device test: Connection timed out
Modbus Write Holding Registers failed on MB device test: Connection timed out
Modbus Read Discrete Input Registers failed on MB device test: Connection timed out
Modbus Write Coils failed on MB device test: Connection timed out
Modbus Read Input Registers failed on MB device test: Connection timed out
Modbus Write Holding Registers failed on MB device test: Connection timed out
Modbus Read Discrete Input Registers failed on MB device test: Connection timed out
Modbus Write Coils failed on MB device test: Connection timed out
Modbus Read Input Registers failed on MB device test: Connection timed out
Modbus Write Holding Registers failed on MB device test: Connection timed out
Modbus Read Discrete Input Registers failed on MB device test: Connection timed out
Modbus Write Coils failed on MB device test: Connection timed out
Modbus Read Input Registers failed on MB device test: Connection timed out
Modbus Write Holding Registers failed on MB device test: Connection timed out
Modbus Read Discrete Input Registers failed on MB device test: Connection timed out
Modbus Write Coils failed on MB device test: Connection timed out
Modbus Read Input Registers failed on MB device test: Connection timed out
Modbus Write Holding Registers failed on MB device test: Connection timed out
Modbus Read Discrete Input Registers failed on MB device test: Connection timed out
Modbus Write Coils failed on MB device test: Connection timed out
Modbus Read Input Registers failed on MB device test: Connection timed out
Modbus Write Holding Registers failed on MB device test: Connection timed out
Modbus Read Discrete Input Registers failed on MB device test: Connection timed out
Modbus Write Coils failed on MB device test: Connection timed out
Modbus Read Input Registers failed on MB device test: Connection timed out
Modbus Write Holding Registers failed on MB device test: Connection timed out
Modbus Read Discrete Input Registers failed on MB device test: Connection timed out
Modbus Write Coils failed on MB device test: Connection timed out
Modbus Read Input Registers failed on MB device test: Connection timed out
Modbus Write Holding Registers failed on MB device test: Connection timed out
Modbus Read Discrete Input Registers failed on MB device test: Connection timed out
Modbus Write Coils failed on MB device test: Connection timed out
Modbus Read Input Registers failed on MB device test: Connection timed out
Modbus Write Holding Registers failed on MB device test: Connection timed out
Modbus Read Discrete Input Registers failed on MB device test: Connection timed out
Modbus Write Coils failed on MB device test: Connection timed out
Quote 0 0
yecao
Use TX0 RX0 log
OpenPLC Runtime starting...
Interactive Server: Listening on port 43628
Device test is disconnected. Attempting to reconnect...
Connected to MB device test
Issued start_modbus() command to start on port: 502
Modbus Server: Listening on port 502
Modbus Server: waiting for new client...
Issued stop_dnp3() command
Modbus Server: Client accepted! Creating thread for the new client ID: 9...
Modbus Server: waiting for new client...
Modbus Server: Thread created for client ID: 9
Quote 0 0
thiagoralves
From the logs it appears to be working using direct rx/tx connection. The USB is failing probably because you selected the wrong COM port during setup of the slave device. Make sure you have the arduino board connected to the USB port when you edit the device and then select the right COM port, which for USB can be something like /dev/ttyACM0 or /dev/ttyUSB0 or something like that.
Quote 0 0
Ishwar Singh
Hello,

First of all , I want to thank you for creating an excellent piece of software.

I am having the same issue as Yecao (Oct 3,2018 above) with my Mega board.  I also tested the board with ModbusPoll software and I do get time out error. The Rx line on the board is blinking while TX line on the board does not blink.  I followed your suggestion to check out the com port set up etc.
Any suggestions would be greatly appreciated.

OpenPLC Runtime starting...
Interactive Server: Listening on port 43628
Device AM is disconnected. Attempting to reconnect...
Warning: Persistent Storage file not found
Connected to MB device AM
Issued start_modbus() command to start on port: 43628
Server: Listening on port 43628
Server: waiting for new client...
Issued stop_dnp3() command
Issued stop_enip() command
Issued stop_pstorage() command
Modbus Read Discrete Input Registers failed on MB device AM: Connection timed out
Modbus Write Coils failed on MB device AM: Connection timed out
Modbus Read Input Registers failed on MB device AM: Connection timed out
Modbus Write Holding Registers failed on MB device AM: Connection timed out
Modbus Read Discrete Input Registers failed on MB device AM: Connection timed out
Modbus Write Coils failed on MB device AM: Connection timed out
Modbus Read Input Registers failed on MB device AM: Connection timed out
Modbus Write Holding Registers failed on MB device AM: Connection timed out
Modbus Read Discrete Input Registers failed on MB device AM: Connection timed out
Modbus Write Coils failed on MB device AM: Connection timed out
Modbus Read Input Registers failed on MB device AM: Connection timed out
Modbus Write Holding Registers failed on MB device AM: Connection timed out
Modbus Read Discrete Input Registers failed on MB device AM: Connection timed out
Modbus Write Coils failed on MB device AM: Connection timed out
Modbus Read Input Registers failed on MB device AM: Connection timed out
Modbus Write Holding Registers failed on MB device AM: Connection timed out
Modbus Read Discrete Input Registers failed on MB device AM: Connection timed out
Modbus Write Coils failed on MB device AM: Connection timed out
Modbus Read Input Registers failed on MB device AM: Connection timed out
Modbus Write Holding Registers failed on MB device AM: Connection timed out
Modbus Read Discrete Input Registers failed on MB device AM: Connection timed out
Modbus Write Coils failed on MB device AM: Connection timed out
Modbus Read Input Registers failed on MB device AM: Connection timed out
Modbus Write Holding Registers failed on MB device AM: Connection timed out
Modbus Read Discrete Input Registers failed on MB device AM: Connection timed out
Modbus Write Coils failed on MB device AM: Connection timed out
Quote 0 0
thiagoralves
Did you upload OpenPLC firmware to your board as per instructions on the website? https://openplcproject.com/runtime/arduino/
Quote 0 0
Ishwar Singh
Yes, I uploaded the software as per instructions and did it several times.
Quote 0 0
thiagoralves
I can only guess that something might be wrong with your board. If the firmware is running, the rx led blinks (which means that it had received OpenPLC's message) but it is not sending anything back, then something is off. Just to debug, can you try the Uno firmware on your board? They are pretty much the same, except for the pin assignments, but I don't have a Mega board to test, and I know that the Uno firmware works well.
Quote 0 0
Ishwar Singh
Yes, I tried it with the UNO firmware. Tested the system with mega slave device and uno slave device configurations. In both cases, RX & TX both are blinking. 

When I try with mega device, error messages are is illegal addresses, with the uno device configuration here is the error log:



OpenPLC Runtime starting...
Interactive Server: Listening on port 43628
Device uno test on mega is disconnected. Attempting to reconnect...
Warning: Persistent Storage file not found
Connected to MB device uno test on mega
Issued start_modbus() command to start on port: 43628
Server: Listening on port 43628
Server: waiting for new client...
Issued stop_dnp3() command
Issued stop_enip() command
Issued stop_pstorage() command
Modbus Read Discrete Input Registers failed on MB device uno test on mega: Connection timed out
Quote 0 0
thiagoralves
If you're getting illegal addresses it means that you didn't configure the slave device correctly. If you're using the Uno firmware on the Mega board, make sure you select Uno as your slave device, not Mega
Quote 0 0