SWD programming NVMC maximum write size between wait for ready

Our application requires that we are able to program the nRF52832 device from our host microcontroller, in order to upgrade the nRF52832 firmware.

We are using an SPI peripheral on our host micro in order to communicate with the SWD peripheral on the nRF device. We have got to the point where we are able to write to the program memory via the NVMC, however we are stuck on something that is not mentioned explicitly in the documentation.

The NVMC seems to be locking up after some writes in between steps 3 and 4, writing and polling on the NVMC.READY register, where the NVMC stops reporting NVMC.READY == 1. The size we are writing at a time using auto-increment in the SWD for the write address is 1024 Bytes - we are now attempting 512 Bytes.

There are some mentions in other tickets for the NVMC indicating that you need to check NVMC.READY register in between each word.
https://devzone.nordicsemi.com/f/nordic-q-a/70012/how-to-write-the-data-in-nvmc-block-wise
https://devzone.nordicsemi.com/f/nordic-q-a/12428/regarding-flash-read-and-write

Question 1: What is the maximum size that can be written between NVMC.READY checks when using the SWD interface for writing to internal flash vis NVMC?

There are some articles that suggest that using auto-increment is possible, but what would be the point as you would need to write the NVMC.READY register to the TAR each time you need to poll the ready flag?

Question 2: Is there any other way to check the NVMC.READY register using SWD without writing to the TAR? This would enable the use of auto-increment in the SWD for the write address.

We are looking forward to your advice on this, thank you.

Parents
  • Hi,

    I consulted our toolchain team regarding your questions. They have the following suggestions:

    Instead of writing directly to flash through NVMC, write a small program in RAM that acts as a RAM bootloader. This program runs on the device and copies data from a RAM buffer to an address in flash. This small program can write to the NVMC and read the READY signal. If you implement double buffer method in RAM, you can write into one buffer while the bootloaders writes from the other buffer to flash. RAM can be written using auto incrementation without issue.

    There aren't any other ways to read the ready flag unfortunately.
    Best regards,
    Jørgen
Reply
  • Hi,

    I consulted our toolchain team regarding your questions. They have the following suggestions:

    Instead of writing directly to flash through NVMC, write a small program in RAM that acts as a RAM bootloader. This program runs on the device and copies data from a RAM buffer to an address in flash. This small program can write to the NVMC and read the READY signal. If you implement double buffer method in RAM, you can write into one buffer while the bootloaders writes from the other buffer to flash. RAM can be written using auto incrementation without issue.

    There aren't any other ways to read the ready flag unfortunately.
    Best regards,
    Jørgen
Children
No Data
Related