First time powerup (virgin) recognition question

Hi All,

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 –

  • The unit wakes up for the absolute first time
  • It is recognized that it is the first time (because the special register or equivalent has not been set)
  • Write special value
  • Any time we power up after that we know it is a non-virgin power-up because the special value is there.
  • Once the special value is written, it is important that it can never be erased for the lifetime of the unit.

Anyone have ideas on how to do this?

  • Hello Steven,

    Thanks for reaching out to Renesas Community.

    I cannot think of anything off the top of my head, please let me investigate more and I will let you know soon.


  • Former Member
    +1 Former Member

    Hi Steven.

    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.  

    Best regards.

  • Thanks for the suggestion.  I will look into this