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

How to start code execution from bootloader nRF24LE1

Hello,

I am developing a bootloader on nRF24LE1. The NUPP configuration is: the first 24 pages (page 0 - 23) are set to be unprotected and the last 8 pages (bootloader) are protected. The bootloader is polling-based and uses no interrupt.

I would like to start code execution from protected region, which means that I must set STP bit in the FSR register. To do this, I set the address region from 0x47F0 to 0x47FF (they are the "16 topmost addresses of the flash data memory" if I understand correctly) to value 0x01 and expect that the condition to set STP bit is met. (I am accessing the NV data memory through SPI)

However, it seems that the code execution is not started from bootloader. Because when I erase the reset vector at address 0x0000, the program fails to find the bootloader.

So the question is: how to set the STP bit so that the program will start from protected region?

Parents
  • Hi,

    http://infocenter.nordicsemi.com/pdf/nRF24LE1_PS_v1.6.pdf 

    See page 73:

    If you have split the flash main block in 2, the value of the STP bit in the FSR register will decide where the MCU starts code execution from. In the normal case STP is logic 0 and the code execution will start at code space address 0x0000. If STP is set to logic 1 the code execution will start from the start of the protected area. The STP bit is set during the reset/start up sequence and will be set to logic 1 if there are an odd number of ones in the 16 topmost addresses of the flash data memory. See Figure 32.

    Best regards,
    Kenneth

  • Hi,

    what I want to do is exactly to set "an odd number of ones in the 16 topmost addresses". I am just not sure whether I have understood this description correctly.

    I am modifying the value in these 16 addresses with SPI. If I understand the user manual correctly, the 16 topmost addresses are located in the last page of NV data memory, which is from 0x47F0 to 0x47FF when accessing through SPI.

    So is it correct to set ALL value to "0x01" in the address region from 0x47F0 to 0x47FF, or maybe I understand the address region wrong?

  • So I assume you set NUPP to 24 in this case, which means the protected start from address 0x3000. This means that the last 16bytes in NV data memory have specific usage, this is address 0xFFF0-0xFFFF. By default all are '1' (in total 16*8 = 128 of '1'), but if you write 0xFFF0 to 0xFE, then there is odd number of '1' (127 of '1'), and execution will start from protected area.

    Best regards,
    Kenneth

Reply
  • So I assume you set NUPP to 24 in this case, which means the protected start from address 0x3000. This means that the last 16bytes in NV data memory have specific usage, this is address 0xFFF0-0xFFFF. By default all are '1' (in total 16*8 = 128 of '1'), but if you write 0xFFF0 to 0xFE, then there is odd number of '1' (127 of '1'), and execution will start from protected area.

    Best regards,
    Kenneth

Children
No Data
Related