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

Saving data in powerfail

jauer
2021-09-24
2021-11-10
  • jauer - 2021-09-24

    Hello everyone,

    IΒ΄m developing a hardware-project with CODESYS implementation and I need to ensure that the data on my PLC-hardware is saved in the case of a powerfail. I know that this works with a FRAM or a UPS and I have implemented both on my hardware. I want to use a real-time Linux OS and I have an ARM processor so I use the "CODESYS Control for Linux ARM" Runtime.

    My question is how IΒ΄m able to adjust that the persistent variables are saved on the FRAM? Do I only have to adjust it in Linux and the Runtime communicates with it or do I have to adjust something in the Runtime settings so that persistent variables are getting a own address?

    Thank you for your answers.

     
  • i-campbell

    i-campbell - 2021-09-24

    You need these settings in your config file

    [CmpRetain]
    Retain.SRAM.Size=0x100000 
    Retain.SRAM.Address=0x30000000
    
    [CmpApp]
    RetainType.Applications=InSRAM
    

    the address and size should match your actual NVRAM.

     
  • jauer - 2021-11-09

    Thanks for your response @i-campbell. Unfortunately I wasnΒ΄t able to continue with my work until now.

    I added the settings in my config file but there is no difference to before and the variables get written in the normal memory.
    I tried it with writing in the CODESYSControl.cfg and in the CODESYSControl_User.cfg but in both cases it didn't work. After implementing the settings I rebooted the system and I tried different address areas (beginning of the NVRAM and somewhere in the middle of the NVRAM-address area).
    Did I forget something?


    My Code:

    [CmpRetain]
    Retain.SRAM.Size = 0x20000
    Retain.SRAM.Address = 0x9A8E2A4

    [CmpApp]
    RetainType.Applications = InSRAM

     
  • jauer - 2021-11-10

    I'm declaring them exactly like explained in the file you mentioned...

    But if I watch the usage of the memory in the development system, the size of the retain memory stays the same.

     

Log in to post a comment.