I am using the Renesas RL78 G23 microcontroller.
I want to be able to identify a first time power up (aka virgin power up). I was thinking I could write a signature value to some register that can't be erased. I can’t use data flash or code flash because those can be erased (accidentally or on purpose).
Do you know of something like this?
To recap –
Anyone have ideas on how to do this?
I'm almost certain, there’s no dedicated one-time programmable (OTP) region in RL78 memory, but I have some ideas about implementing virgin startup detection in these devices that might…
I'm almost certain, there’s no dedicated one-time programmable (OTP) region in RL78 memory, but I have some ideas about implementing virgin startup detection in these devices that might be helpful.
Using chip erase security feature after programming, this will prevent the device from rewriting and make the program safe from external manipulation. Although, Internal flash writing is accessible within the program using the Renesas flash driver library, so you can write some initial value after the first startup and check it for subsequent boots. This way, you can ensure that the data won’t be manipulated from the outside anymore, although you'll have a one-time programmable MCU.
If the above isn’t available on your device (I haven’t tested it on the G23 yet), you might need to consider using the On-chip Debug Security ID memory region (000C4H to 00CDH). This region of memory probably has some potential advantages because it holds the security ID. You can likely use this for storing virgin startup data, and external programmers might not be able to read that area with genuine values, if they attempt to copy the program and reprogram it into a new device. So, even if someone could read the flash data, they cannot obtain the real value. Hence, if you find some unexpected values, you can interpret it as an attempt to reprogram the device. However, the initial virgin startup value and non-virgin value must not be identical to default values after erasing memory.
I hope you find it useful, don’t hesitate to reach out here for following questions.
Thanks for the suggestion. I will look into this