This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

General Purpose Registers

Hi,

I am new to arm and ble development. I am used to work with AVR mcus and I am trying to migrate a project from AVR to nrf52.

AVR usually has some "General Purpose I/O Registers" free to use. They are called GPIORn and in spite of the name they are not related with configuring the I/O pins. I normally use them to store flags on my code, instead of using boolean variables for example.

Is there anything similar on nrf51 or nrf52 SoCs? The NRF_POWER->GPREGRET and GPREGRET2 could be used this way?

Any other suggestions?

Parents
  • Hi Alemons,

    Yes, the General Purpose Retained Registers(GPREGRET and GPREGRET2 ) can be freely used by the application to store flags etc.

    However, if you plan on adding DFU support to your product, then you should be aware that GPREGRET register is used by to signal the device to enter bootloader mode. (The application writes a specific value to the GPREGRET register and performs a soft-reset. Upon a reset the device will pass execution to the bootloader first, which then checks the value of the GPREGRET register to determine if the device should stay in bootloader mode or pass execution to the application.

    In short, any flags stored in GPREGRET will be overwritten during a DFU.

Reply
  • Hi Alemons,

    Yes, the General Purpose Retained Registers(GPREGRET and GPREGRET2 ) can be freely used by the application to store flags etc.

    However, if you plan on adding DFU support to your product, then you should be aware that GPREGRET register is used by to signal the device to enter bootloader mode. (The application writes a specific value to the GPREGRET register and performs a soft-reset. Upon a reset the device will pass execution to the bootloader first, which then checks the value of the GPREGRET register to determine if the device should stay in bootloader mode or pass execution to the application.

    In short, any flags stored in GPREGRET will be overwritten during a DFU.

Children
Related