Goodmorning.
I have a project on a raspberry pi 3. When reboot or turn of the raspberry, values of retain var are lost.
the codesys version is 3.5 sp16 patch 4.
The runtime raspberry is 4.0.1.0
I cheked in the application folder on raspberry,the .ret file dont exist.
if I issue the save command on the shell the file is created.
thank you
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Without extra soft or hardware the Pi will never save retain variables out of its own.
Either a non volatile ram hardware (nvram) solution is needed. I have built a special library for an RTC chip which has also NVRAM support or you could use a working UPS (uninterruptable power supply) connected to the pi. Then the runtime store the retain data to a file on exit of Linux (a graceful shutdown is needed) and restore them on restart.
So without additional effort it won't work as the Pi has never been designed to support this via hardware.
Last edit: aliazzz 2021-05-18
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Goodmorning.
I have a project on a raspberry pi 3. When reboot or turn of the raspberry, values of retain var are lost.
the codesys version is 3.5 sp16 patch 4.
The runtime raspberry is 4.0.1.0
I cheked in the application folder on raspberry,the .ret file dont exist.
if I issue the save command on the shell the file is created.
thank you
Without extra soft or hardware the Pi will never save retain variables out of its own.
Either a non volatile ram hardware (nvram) solution is needed. I have built a special library for an RTC chip which has also NVRAM support or you could use a working UPS (uninterruptable power supply) connected to the pi. Then the runtime store the retain data to a file on exit of Linux (a graceful shutdown is needed) and restore them on restart.
So without additional effort it won't work as the Pi has never been designed to support this via hardware.
Last edit: aliazzz 2021-05-18