NRF52840 Memory Layout

Hi guys,

I'm leading a project with the nrf52840 dongle connected to a Raspberry Pi via the GPIO header. 

The firmware updating options for the Nordic are a bit limited in the sense that the dongle needs DFU via USB port and I don't want to make this extra connection. So instead I'm exploring openocd for programming via the SWDIO & SWDCLK pins. I was able to get it to work with some ease but now I'm struggling to understand the flash memory regions. 

In my project, I'm using Bluetooth and my linker file looks something like this:

MEMORY
{
  FLASH (rx) : ORIGIN = 0x27000, LENGTH = 0xd9000
  RAM (rwx) :  ORIGIN = 0x20002300, LENGTH = 0x3dd00
}

Using the Nordic programming tool and dragging the hex file I can see the address starting in the position 0x27000 as expected and with the length of the program. Doing some calculations 0x27000+0xd9000 = 0x100000, so I was expecting the memory regions from 0x27000 to 0x100000 to be all program-related. However, when I type the command to erase everything from 0x27000 to 0x100000 the bootloader stops working, making me believe that I'm also messing with some bootloader regions... Is that true? Or it is openocd not working as expected?

Also, do you know in what region of the memory are the User Information Configuration Registers (UICR)? I want to avoid deleting it or erasing it by mistake since it would make the regulator use 1.8V instead of 3V.

Best regards,

Fernando Fontes

Parents Reply
  • Hi,
    Well, the bootloader is not a problem. It can stay as it is. I just want to be able to safely update the dongle using the GPIOs of the raspberry Pi since I will make a HAT for the dongle. 

    For that openocd seems to be the way. I've successfully erased the program partition without messing with the bootloader thanks to your answer. The only thing that is missing now is the write command. It writes and verifies OK but then the program does not boot. Am I missing something? I'm just writing the hex file.

    Best regards,

Children
Related