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
00x40000000APPROTECTAPPROTECT control
00x40000000CLOCKClock control
00x40000000POWERPower control
00x50000000GPIO

General purpose input and output

This instance is deprecated.

00x50000000P0General purpose input and output, port 0
00x50000300P1General purpose input and output, port 1
10x40001000RADIO2.4 GHz radio
20x40002000UART0

Universal asynchronous receiver/transmitter

This instance is deprecated.

20x40002000UARTE0Universal asynchronous receiver/transmitter with EasyDMA, unit 0
30x40003000SPI0

SPI master 0

This instance is deprecated.

30x40003000SPIM0SPI master 0
30x40003000SPIS0SPI slave 0
30x40003000TWI0

Two-wire interface master 0

This instance is deprecated.

30x40003000TWIM0Two-wire interface master 0
30x40003000TWIS0Two-wire interface slave 0
40x40004000SPI1

SPI master 1

This instance is deprecated.

40x40004000SPIM1SPI master 1
40x40004000SPIS1SPI slave 1
40x40004000TWI1

Two-wire interface master 1

This instance is deprecated.

40x40004000TWIM1Two-wire interface master 1
40x40004000TWIS1Two-wire interface slave 1
50x40005000NFCTNear field communication tag
60x40006000GPIOTEGPIO tasks and events
70x40007000SAADCAnalog to digital converter
80x40008000TIMER0Timer 0
90x40009000TIMER1Timer 1
100x4000A000TIMER2Timer 2
110x4000B000RTC0Real-time counter 0
120x4000C000TEMPTemperature sensor
130x4000D000RNGRandom number generator
140x4000E000ECBAES electronic code book (ECB) mode block encryption
150x4000F000AARAccelerated address resolver
150x4000F000CCMAES counter with CBC-MAC (CCM) mode block encryption
160x40010000WDTWatchdog timer
170x40011000RTC1Real-time counter 1
180x40012000QDECQuadrature decoder
190x40013000COMPGeneral purpose comparator
190x40013000LPCOMPLow power comparator
200x40014000EGU0Event generator unit 0
200x40014000SWI0Software interrupt 0
210x40015000EGU1Event generator unit 1
210x40015000SWI1Software interrupt 1
220x40016000EGU2Event generator unit 2
220x40016000SWI2Software interrupt 2
230x40017000EGU3Event generator unit 3
230x40017000SWI3Software interrupt 3
240x40018000EGU4Event generator unit 4
240x40018000SWI4Software interrupt 4
250x40019000EGU5Event generator unit 5
250x40019000SWI5Software interrupt 5
260x4001A000TIMER3Timer 3
270x4001B000TIMER4Timer 4
280x4001C000PWM0Pulse width modulation unit 0
290x4001D000PDMPulse Density modulation (digital microphone) interface
300x4001E000ACLAccess control lists
300x4001E000NVMCNon-volatile memory controller
310x4001F000PPIProgrammable peripheral interconnect
320x40020000MWUMemory watch unit
330x40021000PWM1Pulse width modulation unit 1
340x40022000PWM2Pulse width modulation unit 2
350x40023000SPI2

SPI master 2

This instance is deprecated.

350x40023000SPIM2SPI master 2
350x40023000SPIS2SPI slave 2
360x40024000RTC2Real-time counter 2
370x40025000I2SInter-IC sound interface
380x40026000FPUFPU interrupt
390x40027000USBDUniversal serial bus device
400x40028000UARTE1Universal asynchronous receiver/transmitter with EasyDMA, unit 1
410x40029000QSPIExternal memory interface
420x5002A000CRYPTOCELLCRYPTOCELL 310 security subsystem
430x5002B000CC_AESCRYPTOCELL AES engine
430x5002B000CC_CHACHACRYPTOCELL CHACHA engine
430x5002B000CC_CTLCRYPTOCELL CTL interface
430x5002B000CC_DINCRYPTOCELL DIN DMA engine
430x5002B000CC_DOUTCRYPTOCELL DOUT DMA engine
430x5002B000CC_HASHCRYPTOCELL HASH engine
430x5002B000CC_HOST_RGFCRYPTOCELL HOST register interface
430x5002B000CC_MISCCRYPTOCELL MISC interface
430x5002B000CC_PKACRYPTOCELL PKA engine
430x5002B000CC_RNGCRYPTOCELL RNG engine
430x5002B000CC_RNG_SRAMCRYPTOCELL RNG SRAM interface
450x4002D000PWM3Pulse width modulation unit 3
470x4002F000SPIM3SPI master 3
N/A0x10000000FICRFactory information configuration
N/A0x10001000UICRUser information configuration