====== SD / eMMC Diagnostics ======
#;;
Patron
Neuron
Gate
Unipi 1.1
Axon
#;;
Unipi controllers have Modbus registers for health monitoring of system storage - MicroSD card or eMMC memory. This article describes how and why you can check those values in Mervis and what do they mean.
----
By monitoring storage lifespan, you can prevent damaging it. If storage lifespan changes, it is good to inform relevant persons, for example by sending an SMS/e-mail and call an alarm state. Storage can be irreversibly damaged by excessive or inappropriate use. Correct PLC setting and avoiding problems is described in [[cs:sw:01-mervis:variable-backup-hidden|Variable Backup]] article.
{{page>.:store-history-in-ram-hidden}}
{{ :files:img_warning-line_b.png?nolink |}}
{{ :en:hw:09_safety-instructions_pseudo-ISO-7010-attention.png?nolink |(!)}}
**Attention:** \\
If your storage lifespan changes, you can contact Unipi support, describe the situation and attach Mervis solution. Our support will recommend you the best settings to keep your storage from wearing out.
===== SD / eMMC storage diagnosis =====
There are registers available on the [[https://kb.unipi.technology/cs:sw:02-apis:02-modbus-tcp|Modbus TCP server]], that indicate storage health for all Unipi controllers (apart Unipi 1.1):
\\
Erase cycles used percentage
* states storage wear (in %)
* default: 0%
Good blocks percentage
* states how many storage blocks are good (in %)
* default: 100%
\\
{{ :en:sw:01-mervis:sd-emmc-diagnostics-hidden:variables.png?direct |}}
{{ :files:img_warning-line_b.png?nolink |}}
{{ :en:hw:08_safety-instructions_pseudo-ISO-7010-info.png?nolink |(!)}}
**Note:** \\
Device Modbus definition has to be at least **v2_2**, and also **OS version has to be at least 2.4.0**.
For Neuron units, there is also available information about on/off cycles with current SD card and also SD card vendor, but only for specific cards.
===== Example of use =====
Following program will send an e-mail, when storage health status of the PLC changes.
When **Storage_good_blocks_percentage** and **Storage_erase_cycles_used_percentage** variables change, block //changeChecker// will generate //true// on its output for period of one cycle, which is accepted by //SendMailTrig// block. Parts of messages are taken from variables and merged by //concat// block.
{{ :en:sw:01-mervis:sd-emmc-diagnostics-hidden:example-program-r.png?direct |}}
{{ :files:img_warning-line_b.png?nolink |}}
{{ :en:hw:08_safety-instructions_pseudo-ISO-7010-info.png?nolink |(!)}}
**Note:** \\
Description of **changeChecker** function block can be found in article [[en:sw:01-mervis:variable-backup-hidden?tns#zaloha_pri_zmene_hodnoty|Variable Backup, part "Event variable backup"]].
More information about e-mail sending from Mervis system can be found in [[en:sw:01-mervis:sending-email-hidden|a separate article]].