arduino-libraries / AlPlc_Opta

Library for Arduino PLC IDE runtime and plugins for Arduino Opta
https://docs.arduino.cc/software/plc-ide
Creative Commons Attribution 4.0 International
5 stars 0 forks source link

Opta 1.1 breaks connection over Modbus on Arduino PLC IDE #5

Open JC-85 opened 1 month ago

JC-85 commented 1 month ago

I have a project in Arduino PLC IDE 1.0.3 where I've been using Modbus TCP to remote debug and download updates. Today after upgrading Arduino PLC IDE to 1.0.6 and re-initializing the Opta I can no longer connect to the device, it only shows Error in the Connection status-bar. I've tested this with two separate devices, the first one was field deployed and I can still connect to it as a modbus slave and read mapped variables in the 0x6000 range. Wireshark suggests that the registers used for the management communication is unavailable.

Skärmbild 2024-05-31 191700

Downgrading to PLC IDE 1.0.3 and re-initializing with Opta 1.0 solves the problem.

manchoz commented 2 weeks ago

Hi @JC-85, in PLC IDE 1.0.6, we had to remove support to update the PLC application with Modbus TCP because it is not fully functional (also in 1.0.3).

In the PLC IDE, a complete PLC application consists of the PLC runtime and the PLC application. The PLC runtime can only be updated via USB, and since it's linked to the embedded Arduino Sketch, a complete application update may require updating both the PLC logic part and runtime. This process is essential to ensure a fully updated application.

For example, if you use the Arduino Sketch to configure the Ethernet port and change the configuration, you must also update the runtime part. It is impossible to update the runtime part with Modbus TCP, so you will likely end up with an Opta in an inconsistent status.

We are working on a solution that also allows updating the PLC runtime over the Ethernet connection, which will be included in the next releases.

Meanwhile, please use the Modbus TCP connection to update the application with extreme care.

Incompetent-OE commented 2 weeks ago

Any idea of a ballpark when the next release is going to be released? PLC IDE 1.0.6 is unstable enough I am seriously considering shelling out for an industrial PLC that will just work.

manchoz commented 2 weeks ago

Hey @Incompetent-OE, what kind of instability are you experiencing?

Please keep in touch with the Arduino PRO support at pro at arduino.cc

Incompetent-OE commented 2 weeks ago

@manchoz Well the biggest one is the IDE crashing about half the time a device refuses to connect, even over USB. I figured out part of the issue was I had flashed the wrong firmware version to my boards, but even with the correct firmware I'm still crashing enough for it to be a headache.

manchoz commented 2 weeks ago

@Incompetent-OE try resetting the Opta to factory defaults following the instructions at https://docs.arduino.cc/tutorials/opta/memory-partitioning/ and then start with the PLC IDE from scratch.

JC-85 commented 1 week ago

Hi @manchoz, thanks for the response.

In the PLC IDE, a complete PLC application consists of the PLC runtime and the PLC application. The PLC runtime can only be updated via USB, and since it's linked to the embedded Arduino Sketch, a complete application update may require updating both the PLC logic part and runtime. This process is essential to ensure a fully updated application.

That seems reasonable and not really a major hurdle, it was part of the learning curve to see which changes could be pushed over Ethernet and which required a serial connection.

In my use case I'm about to deploy 10 Opta units to a remote site. The development is completed so I don't need to push any major changes except for fine tuning a constant for a linear transform that's applied to one of the analog inputs. The watch window is also really helpful with this.

So the base functionality in Opta 1.0 already fulfilled all my requirements. But there seems to be a major issue in Opta 1.0. When running as a modbus slave I get mbedOS crashes after 12-24 hours, with the red status LED blinking alternating long and short pulses. I would have opened a separate issue for this except I don't really have a better error description than this. And it doesn't seem to be in a consistent fashion either. The unit I have at my desk I can just power cycle and it will come back online, but the unit we did our initial test deployment with refuses to acquire a new DHCP lease and needs to be re-initialized to com back to life.

This problem however seems to have been fixed in Opta 1.1. We had a device up and running for over 48 hours without issue. But the lack of a watch window was really setting us back with verifying the calculations on analog values, so we decided to roll back to Opta 1.0 to see if we can sort out the random mbedOS crashes, but so far we haven't gotten anywhere with that.

manchoz commented 1 week ago

Hey @JC-85, What do you think about reading the values using a Modbus client? You can export your analog variables as Modbus variables by adding them as Status variables in the Public Objects menu in the Resources pane.

Any Modbus client software will do it. Also, you can use another Arduino board running as a Modbus client to collect data from the remote devices.