Raspberry not retain var

2021-05-18
2021-05-18
  • masterofplc - 2021-05-18

    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

     
  • aliazzz

    aliazzz - 2021-05-18

    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

Log in to post a comment.