Thank you for posting the resolution, I am sure others will find this helpful.
Please note that this is expected behaviour when using any CODESYS project with different versions of the devices to the ones the project was developed with. The template project that is part of CODESYS for UniPi was developed with a particular version of CODESYS, yet will work with many different versions just by updating the device as shown. The project and package are only updated if there is an enhancement or a bug fix.
Once you have created a project, if you wish to update to a new version of CODESYS for Raspberry Pi, or CODESYS for UniPi you would need to update any changed devices in the same way.
I hope that helps explain why the step is required.
This has been an on-going topic for CODESYS on the Raspberry Pi. The Raspberry Pi does not have non-volatile RAM, and so the built in PERSISTENT and RETAIN variables within IEC61131 do not function. The neatest solution I have seen is discussed in this forum posthttps://forum.codesys.com/viewtopic.php?t=5722 where 3S have provided some sample code that can write retain variables to a file on demand and then restore at power up.
Be careful about writing too frequently to the SDCard as you increase the chance of file system corruption if the power is interrupted whilst writing.
This should be possible if you have the appropriate Linux device drivers installed. This is really a feature of CODESYS for Raspberry PI - there is an explanation of how to do this in the CODESYS Forum https://forum.codesys.com/viewtopic.php?t=5699
Please note that if you support the USB serial device then my understanding is you will no longer be able to access the built in serial ports on the Neuron with CODESYS (Because CODESYS appends the COM port number to a base DeviceFile, and the internal ports would have a different base name to the USB ones.). If you need further detail on this issue I suggest that the CODESYS Raspberry Pi forum is the best place to get further assistance.
@lefrank01 thank you for sharing your tips. I have also had this reported once or twice and on each occasion starting from a clean install of Raspbian, installing CODESYS for Raspberry Pi and then running the script that ships with CODESYS for UniPi has resolved users problems.
I have seen this issue reported a couple of times. On each occasion it was resolved by a clean install of Raspbian, followed by an install of CODESYS for Raspberry Pi and running the install script that installed as part of CODESYS for UniPi (See the data sheet for install instructions).