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

Writing to UICR + software reset

Hello,

I have a simple question. So, I'm trying to write some manufacturing information into the UICR but once I write to these addresses I can't see the device via bluetooth unless I do a hard reset. I tried using: NVIC_SystemReset(); but I was unsuccessful. Is there a way to do a soft reset so that I may see the device via a bluetooth scan without having to do a hard reset after writing to the UICR?

I need this functionality because in the future I plan on implementing DFU so that permanently enclosed devices may get updated firmware via bluetooth. When the firmware changes, the information in the UICR will change and I will have no way of hard resetting these enclosed devices. I.E. these enclosed devices become useless if I change the UICR information in the current case.

Thank you,

Nick

Parents
  • Hi Nick,

    In general, there is no problem writing to UICR and performing a soft reset. You can see an example of that in gpio_output_voltage_setup() in <SDK16>\components\boards\boards.c, so I suspect  is onto something. Which UICR address(es) do you write to, and what is these address(es) used for?

    Einar

  • Hi Einar,

    Thank you for that reference in boards.c it is helpful!

    I think I found the problem, at least, in this case. It seems as though, I can't see the device after programming it with a hex file via command line tools unless I invoke the following:

    nrfjprog -f nrf52 --reset (which is technically a hard reset)

    So technically it wasn't the UICR causing me to not be able to see the device... it was that I needed to hard reset the device after programming it with a hex file.

    This is odd to me. Does the UICR not need a soft reset after writing to it? Typically when I write to it using the command line tools, I need to initiate a reset so that the device will operate normally. I want to clarify this with you, the UICR can be changed and the device can operate normally after a soft reset? There is no hard reset required for this?

    Will I run into a problem like this with DFU (I.E. if I'm programming the device with DFU will it require a hard reset after changing the firmware)?

    Thank you,

    Nick

  • Hi Nick,

    I see. Thank you for letting us know.

    Nicholas_Nuti said:
    Does the UICR not need a soft reset after writing to it? Typically when I write to it using the command line tools, I need to initiate a reset so that the device will operate normally. I want to clarify this with you, the UICR can be changed and the device can operate normally after a soft reset? There is no hard reset required for this?

    Some of the registers in the UICR are only read after reset, so a change in those need a reset for it to take effect. That applies to changes in REG0 configuration, reset pin enable/disable, etc. But in those cases, a soft reset is enough. If you just write your own user data to available registers (typically serial number or similar), then there is no need to reset, and you can read the data back immediately after as you could any other flash region.

    Einar

  • Hi Einar,

    Some of the registers in the UICR are only read after reset, so a change in those need a reset for it to take effect.

    Thanks for the information! Im hoping that the registers that I'm using wont require a reset; do you know which do need a soft reset?

    If you just write your own user data to available registers (typically serial number or similar), then there is no need to reset, and you can read the data back immediately after as you could any other flash region.

    That's great to hear.

    Thank you for the info,

    Nick

  • Hi Nick,

    Nicholas_Nuti said:
    Thanks for the information! Im hoping that the registers that I'm using wont require a reset; do you know which do need a soft reset?

    All the UICR registers that configure HW, which are those with an offset of 0x200 or higher require a reset to take effect since it is only read during startup.

    Einar

  • Hi Einar,

    Ultimately, I think this is what I wanted to know. Thank you so much for the helpful information!

    Thank you,

    Nick

Reply Children
No Data
Related