Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Raspberry not retain var

  • masterofplc

    masterofplc - 2021-05-18

    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
    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.