Memory

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.

Figure 1. Memory layout

Memory layout

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.

Figure 2. Memory map

Memory map

Instantiation

Table 1. Instantiation table
IDBase addressInstanceDescription
00x40000000APPROTECT

APPROTECT control

00x40000000CLOCK

Clock control

00x40000000POWER

Power control

00x50000000GPIO

General purpose input and output

This instance is deprecated.

00x50000000P0

General purpose input and output, port 0

00x50000300P1

General purpose input and output, port 1

10x40001000RADIO

2.4 GHz radio

20x40002000UART0

Universal asynchronous receiver/transmitter

This instance is deprecated.

20x40002000UARTE0

Universal asynchronous receiver/transmitter with EasyDMA, unit 0

30x40003000SPI0

SPI master 0

This instance is deprecated.

30x40003000SPIM0

SPI master 0

30x40003000SPIS0

SPI slave 0

30x40003000TWI0

Two-wire interface master 0

This instance is deprecated.

30x40003000TWIM0

Two-wire interface master 0

30x40003000TWIS0

Two-wire interface slave 0

40x40004000SPI1

SPI master 1

This instance is deprecated.

40x40004000SPIM1

SPI master 1

40x40004000SPIS1

SPI slave 1

40x40004000TWI1

Two-wire interface master 1

This instance is deprecated.

40x40004000TWIM1

Two-wire interface master 1

40x40004000TWIS1

Two-wire interface slave 1

50x40005000NFCT

Near field communication tag

60x40006000GPIOTE

GPIO tasks and events

70x40007000SAADC

Analog to digital converter

80x40008000TIMER0

Timer 0

90x40009000TIMER1

Timer 1

100x4000A000TIMER2

Timer 2

110x4000B000RTC0

Real-time counter 0

120x4000C000TEMP

Temperature sensor

130x4000D000RNG

Random number generator

140x4000E000ECB

AES electronic code book (ECB) mode block encryption

150x4000F000AAR

Accelerated address resolver

150x4000F000CCM

AES counter with CBC-MAC (CCM) mode block encryption

160x40010000WDT

Watchdog timer

170x40011000RTC1

Real-time counter 1

180x40012000QDEC

Quadrature decoder

190x40013000COMP

General purpose comparator

190x40013000LPCOMP

Low power comparator

200x40014000EGU0

Event generator unit 0

200x40014000SWI0

Software interrupt 0

210x40015000EGU1

Event generator unit 1

210x40015000SWI1

Software interrupt 1

220x40016000EGU2

Event generator unit 2

220x40016000SWI2

Software interrupt 2

230x40017000EGU3

Event generator unit 3

230x40017000SWI3

Software interrupt 3

240x40018000EGU4

Event generator unit 4

240x40018000SWI4

Software interrupt 4

250x40019000EGU5

Event generator unit 5

250x40019000SWI5

Software interrupt 5

260x4001A000TIMER3

Timer 3

270x4001B000TIMER4

Timer 4

280x4001C000PWM0

Pulse width modulation unit 0

290x4001D000PDM

Pulse Density modulation (digital microphone) interface

300x4001E000ACL

Access control lists

300x4001E000NVMC

Non-volatile memory controller

310x4001F000PPI

Programmable peripheral interconnect

320x40020000MWU

Memory watch unit

330x40021000PWM1

Pulse width modulation unit 1

340x40022000PWM2

Pulse width modulation unit 2

350x40023000SPI2

SPI master 2

This instance is deprecated.

350x40023000SPIM2

SPI master 2

350x40023000SPIS2

SPI slave 2

360x40024000RTC2

Real-time counter 2

370x40025000I2S

Inter-IC sound interface

380x40026000FPU

FPU interrupt

390x40027000USBD

Universal serial bus device

400x40028000UARTE1

Universal asynchronous receiver/transmitter with EasyDMA, unit 1

410x40029000QSPI

External memory interface

420x5002A000CRYPTOCELL

CRYPTOCELL 310 security subsystem

430x5002B000CC_AES

CRYPTOCELL AES engine

430x5002B000CC_CHACHA

CRYPTOCELL CHACHA engine

430x5002B000CC_CTL

CRYPTOCELL CTL interface

430x5002B000CC_DIN

CRYPTOCELL DIN DMA engine

430x5002B000CC_DOUT

CRYPTOCELL DOUT DMA engine

430x5002B000CC_HASH

CRYPTOCELL HASH engine

430x5002B000CC_HOST_RGF

CRYPTOCELL HOST register interface

430x5002B000CC_MISC

CRYPTOCELL MISC interface

430x5002B000CC_PKA

CRYPTOCELL PKA engine

430x5002B000CC_RNG

CRYPTOCELL RNG engine

430x5002B000CC_RNG_SRAM

CRYPTOCELL RNG SRAM interface

450x4002D000PWM3

Pulse width modulation unit 3

470x4002F000SPIM3

SPI master 3

N/A0x10000000FICR

Factory information configuration

N/A0x10001000UICR

User information configuration