Very happy to read this post. But I can't find where you set the runtime to use sram for retain variables instead of file (that is the default setting I think). Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Retain data is normally not supported by the raspberry pi runtime by design of the hardware. Raspberry Pi has to my knowledge never been released with built in SRAM or battery backed up ram or similar.
This library focuses purely on realisation of retain data with an mcp7941x RTC Chip with built in SRAM.
If you wish to implement a workaround via a textfile, you are free to do so yourself as it is not part of the mcp7941x RTC Chip.
With kind regards
Last edit: aliazzz 2020-02-11
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ehm, to rephrase it: the Retain mechanism in Codesys will compile but will not work in the standard raspberry pi hardware. This package enables the user to leverage battery backed up hardware sram support in a raspberry pi via the retain mechanisme which will work in combination with this library.
The smallest working stable interval for me is T#1msec (see table)
Your mileage may vary!
Last edit: aliazzz 2020-02-11
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Surely you can use this library as a basis for your needs. It would be even better if you would start a new CForge project for it. If you do, we can help even better you with implementation for it.
You wote *The i2c-adress is also 16#57, At the moment, after a power failure, the retain data is "0"... *
The AT24C is a dedicated EEPROM, while the MCP7941x is a multipurpose package (RTC, Calendar and EEPROM) made by a different brand, so if it works out of the box, that would be sheer luck.
I think you should download and study the data sheets for your AT24C and the MCP7941x. After studying both data sheets and the library for the MCP7941x you can rewrite it to suit your specific needs.
PS, I assume you run it on a Raspberry pi.
Have you checked if the i2c master detects it? When your runtime sees the ic, then you can start debugging.
Good luck!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Some advice: Never try to use a library for hardware it is not written for (!)
In the most negative scenario your hardware could brick or short circuit.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
more posts ...
Very happy to read this post. But I can't find where you set the runtime to use sram for retain variables instead of file (that is the default setting I think). Thanks
Hi,
Thank you!
Retain data is normally not supported by the raspberry pi runtime by design of the hardware. Raspberry Pi has to my knowledge never been released with built in SRAM or battery backed up ram or similar.
This library focuses purely on realisation of retain data with an mcp7941x RTC Chip with built in SRAM.
If you wish to implement a workaround via a textfile, you are free to do so yourself as it is not part of the mcp7941x RTC Chip.
With kind regards
Last edit: aliazzz 2020-02-11
AFAIK the driver doesn't change the retain strategy, but it stores and restores the data additionally into the external chip.
@aliazzz what is the interval in which the data is stored?
Ehm, to rephrase it: the Retain mechanism in Codesys will compile but will not work in the standard raspberry pi hardware. This package enables the user to leverage battery backed up hardware sram support in a raspberry pi via the retain mechanisme which will work in combination with this library.
The smallest working stable interval for me is T#1msec (see table)
Your mileage may vary!
Last edit: aliazzz 2020-02-11
Hello aliazzz,
I want to use the Eeprom AT24C (4096x8) on a DS3231.
What do I've to change in the code?
At the moment, after a power failure, the retain data is "0"...
Thx,
wayne
Hi,
Surely you can use this library as a basis for your needs. It would be even better if you would start a new CForge project for it. If you do, we can help even better you with implementation for it.
You wote *The i2c-adress is also 16#57, At the moment, after a power failure, the retain data is "0"... *
The AT24C is a dedicated EEPROM, while the MCP7941x is a multipurpose package (RTC, Calendar and EEPROM) made by a different brand, so if it works out of the box, that would be sheer luck.
I think you should download and study the data sheets for your AT24C and the MCP7941x. After studying both data sheets and the library for the MCP7941x you can rewrite it to suit your specific needs.
PS, I assume you run it on a Raspberry pi.
Have you checked if the i2c master detects it? When your runtime sees the ic, then you can start debugging.
Good luck!
Ahh...
I've looked into the data sheets (that was a good hint ;-) and there was the first problem.
The adressing is different (2 bytes for the adress)
Yes, i'll run it on a rpi and the i2c detects the 24c32.
OK, i will study the data sheet a little bit longer and then create a new CForge project.
Thx,
wayne
Some advice: Never try to use a library for hardware it is not written for (!)
In the most negative scenario your hardware could brick or short circuit.
Hello,
now I've opened a thread in the forum: https://forge.codesys.com/forge/talk/Deutsch/thread/a73b9e4a96/
Perhaps, you can look in in my new code?
Maybe you can discover a mistake... :-)
Thx,
wayne