The nRF52840 contains 1024 kB of flash memory and 256 kB of RAM that can be used for code and data storage.
The CPU and peripherals with EasyDMA can access memory via the AHB multilayer interconnect. In additon, peripherals are accessed by the CPU via the AHB multilayer interconnect, as shown in the following figure.
See AHB multilayer and EasyDMA for more information about the AHB multilayer interconnect and EasyDMA.
The same physical RAM is mapped to both the Data RAM region and the Code RAM region. It is up to the application to partition the RAM within these regions so that one does not corrupt the other.
RAM - Random access memory
The RAM interface is divided into nine RAM AHB slaves.
RAM AHB slaves 0 to 7 are connected to two 4 kB RAM sections each, while RAM AHB slave 8 is connected to six 32 kB sections, as shown in Memory layout.
Each RAM section has separate power control for System ON and System OFF mode operation, which is configured via RAM register (see the POWER — Power supply).
Flash - Non-volatile memory
The CPU can read from flash memory an unlimited number of times, but is restricted in how it writes to flash and the number of writes and erases it can perform.
Writing to flash memory is managed by the non-volatile memory controller (NVMC), see NVMC — Non-volatile memory controller.
Flash memory is divided into 256 pages of 4 kB each that can be accessed by the CPU via the ICODE and DCODE buses as shown in Memory layout.
Memory map
The complete memory map for the nRF52840 is shown in the following figure. As described in Memory, Code RAM and Data RAM are the same physical RAM.
Instantiation
| ID | Base address | Instance | Description |
|---|---|---|---|
| 0 | 0x40000000 | APPROTECT |
APPROTECT control |
| 0 | 0x40000000 | CLOCK |
Clock control |
| 0 | 0x40000000 | POWER |
Power control |
| 0 | 0x50000000 | GPIO |
General purpose input and output This instance is deprecated. |
| 0 | 0x50000000 | P0 |
General purpose input and output, port 0 |
| 0 | 0x50000300 | P1 |
General purpose input and output, port 1 |
| 1 | 0x40001000 | RADIO |
2.4 GHz radio |
| 2 | 0x40002000 | UART0 |
Universal asynchronous receiver/transmitter This instance is deprecated. |
| 2 | 0x40002000 | UARTE0 |
Universal asynchronous receiver/transmitter with EasyDMA, unit 0 |
| 3 | 0x40003000 | SPI0 |
SPI master 0 This instance is deprecated. |
| 3 | 0x40003000 | SPIM0 |
SPI master 0 |
| 3 | 0x40003000 | SPIS0 |
SPI slave 0 |
| 3 | 0x40003000 | TWI0 |
Two-wire interface master 0 This instance is deprecated. |
| 3 | 0x40003000 | TWIM0 |
Two-wire interface master 0 |
| 3 | 0x40003000 | TWIS0 |
Two-wire interface slave 0 |
| 4 | 0x40004000 | SPI1 |
SPI master 1 This instance is deprecated. |
| 4 | 0x40004000 | SPIM1 |
SPI master 1 |
| 4 | 0x40004000 | SPIS1 |
SPI slave 1 |
| 4 | 0x40004000 | TWI1 |
Two-wire interface master 1 This instance is deprecated. |
| 4 | 0x40004000 | TWIM1 |
Two-wire interface master 1 |
| 4 | 0x40004000 | TWIS1 |
Two-wire interface slave 1 |
| 5 | 0x40005000 | NFCT |
Near field communication tag |
| 6 | 0x40006000 | GPIOTE |
GPIO tasks and events |
| 7 | 0x40007000 | SAADC |
Analog to digital converter |
| 8 | 0x40008000 | TIMER0 |
Timer 0 |
| 9 | 0x40009000 | TIMER1 |
Timer 1 |
| 10 | 0x4000A000 | TIMER2 |
Timer 2 |
| 11 | 0x4000B000 | RTC0 |
Real-time counter 0 |
| 12 | 0x4000C000 | TEMP |
Temperature sensor |
| 13 | 0x4000D000 | RNG |
Random number generator |
| 14 | 0x4000E000 | ECB |
AES electronic code book (ECB) mode block encryption |
| 15 | 0x4000F000 | AAR |
Accelerated address resolver |
| 15 | 0x4000F000 | CCM |
AES counter with CBC-MAC (CCM) mode block encryption |
| 16 | 0x40010000 | WDT |
Watchdog timer |
| 17 | 0x40011000 | RTC1 |
Real-time counter 1 |
| 18 | 0x40012000 | QDEC |
Quadrature decoder |
| 19 | 0x40013000 | COMP |
General purpose comparator |
| 19 | 0x40013000 | LPCOMP |
Low power comparator |
| 20 | 0x40014000 | EGU0 |
Event generator unit 0 |
| 20 | 0x40014000 | SWI0 |
Software interrupt 0 |
| 21 | 0x40015000 | EGU1 |
Event generator unit 1 |
| 21 | 0x40015000 | SWI1 |
Software interrupt 1 |
| 22 | 0x40016000 | EGU2 |
Event generator unit 2 |
| 22 | 0x40016000 | SWI2 |
Software interrupt 2 |
| 23 | 0x40017000 | EGU3 |
Event generator unit 3 |
| 23 | 0x40017000 | SWI3 |
Software interrupt 3 |
| 24 | 0x40018000 | EGU4 |
Event generator unit 4 |
| 24 | 0x40018000 | SWI4 |
Software interrupt 4 |
| 25 | 0x40019000 | EGU5 |
Event generator unit 5 |
| 25 | 0x40019000 | SWI5 |
Software interrupt 5 |
| 26 | 0x4001A000 | TIMER3 |
Timer 3 |
| 27 | 0x4001B000 | TIMER4 |
Timer 4 |
| 28 | 0x4001C000 | PWM0 |
Pulse width modulation unit 0 |
| 29 | 0x4001D000 | PDM |
Pulse Density modulation (digital microphone) interface |
| 30 | 0x4001E000 | ACL |
Access control lists |
| 30 | 0x4001E000 | NVMC |
Non-volatile memory controller |
| 31 | 0x4001F000 | PPI |
Programmable peripheral interconnect |
| 32 | 0x40020000 | MWU |
Memory watch unit |
| 33 | 0x40021000 | PWM1 |
Pulse width modulation unit 1 |
| 34 | 0x40022000 | PWM2 |
Pulse width modulation unit 2 |
| 35 | 0x40023000 | SPI2 |
SPI master 2 This instance is deprecated. |
| 35 | 0x40023000 | SPIM2 |
SPI master 2 |
| 35 | 0x40023000 | SPIS2 |
SPI slave 2 |
| 36 | 0x40024000 | RTC2 |
Real-time counter 2 |
| 37 | 0x40025000 | I2S |
Inter-IC sound interface |
| 38 | 0x40026000 | FPU |
FPU interrupt |
| 39 | 0x40027000 | USBD |
Universal serial bus device |
| 40 | 0x40028000 | UARTE1 |
Universal asynchronous receiver/transmitter with EasyDMA, unit 1 |
| 41 | 0x40029000 | QSPI |
External memory interface |
| 42 | 0x5002A000 | CRYPTOCELL |
CRYPTOCELL 310 security subsystem |
| 43 | 0x5002B000 | CC_AES |
CRYPTOCELL AES engine |
| 43 | 0x5002B000 | CC_CHACHA |
CRYPTOCELL CHACHA engine |
| 43 | 0x5002B000 | CC_CTL |
CRYPTOCELL CTL interface |
| 43 | 0x5002B000 | CC_DIN |
CRYPTOCELL DIN DMA engine |
| 43 | 0x5002B000 | CC_DOUT |
CRYPTOCELL DOUT DMA engine |
| 43 | 0x5002B000 | CC_HASH |
CRYPTOCELL HASH engine |
| 43 | 0x5002B000 | CC_HOST_RGF |
CRYPTOCELL HOST register interface |
| 43 | 0x5002B000 | CC_MISC |
CRYPTOCELL MISC interface |
| 43 | 0x5002B000 | CC_PKA |
CRYPTOCELL PKA engine |
| 43 | 0x5002B000 | CC_RNG |
CRYPTOCELL RNG engine |
| 43 | 0x5002B000 | CC_RNG_SRAM |
CRYPTOCELL RNG SRAM interface |
| 45 | 0x4002D000 | PWM3 |
Pulse width modulation unit 3 |
| 47 | 0x4002F000 | SPIM3 |
SPI master 3 |
| N/A | 0x10000000 | FICR |
Factory information configuration |
| N/A | 0x10001000 | UICR |
User information configuration |