~ Stuff I Learned About Tech+Hydroponics

Determining the Revision, FLASH and RAM size of the nRF51822

Philip in the comments noted the current version of the nRF51 Compatibility Matrix (discussed below) can be downloaded here. THANK YOU Philip!

End of Update

I just got another rev of the Ladybug Lite (LBL) PCB from OSH Park….excuse me for one second….YIPPEE!!!!….

The first thing I did was to solder a MDBT40 nRF51822 module (discussed in a previous post). I also soldered on the header pins that connect to the SWD pins on the MDBT40. So now I can “talk” to the MDBT40 on this rev of the LBL PCB by using the nRF51 DK’s debug out (discussed in a previous post).

The MDBT40 has the nRF51822 inside. Because of this, I can’t get to the markings on the chip that could identify the amount of RAM, Flash, and hardware identification into.

So how was I going to figure out the chip revision? How much RAM / Flash is on it?

The Goal

The goal of this post is to use the JLinkEXE SEGGER utility on my Mac to figure out the revision, amount of RAM and amount of Flash on the MDBT40 module I soldered onto the LBL Alpha 5 board.

Thanks to Those That Went Before

Lucky for me, Ron Sousa has been covering accessing micro controllers through registers in our Contextual Electronics Embedded course. Armed with the confidence to not only read a data sheet but figure out what to do :-)…

It’s All About the FICR

I found the Factory Information Configuration Registers (FICR) described in chapter 7 of the nRF51_Series_Reference_manual v3.0.pdf.

The FICR’s base address is 0x1000 0000. From the base address, there are several registers that can be used to ask the nRF51822 how much RAM, Flash, and the chip revision.

The challenge I was having is interpreting Table 13 in the nRF51_Series_Reference lists the registers. Perhaps my lack of background working with micro controller firmware makes it difficult for me to interpret the very brief descriptions……however, some of the naming was promising such as CODESIZE and SIZERAMBLOCKS and NUMRAMBLOCKS.

How do I take the values in these registers and turn them into the amount of RAM and Flash?

A nice thing about the Nordic’s nRF51 SDK is there are A LOT of helper APIs that help me figure out how to interact with the nRF51822’s registers. In this case, there is the .c and .h nrf_ic_info files. Looking at the nrf_ic_info.h file:

/**@brief Enum identifying the IC revision as described in the nRF51 Series Compatibility Matrix. */

the ic_data seems like “gobbly gook” to me. I found it more informative to check out the tables in the nRF51_Series_Compatibility_Matrix_v1.1.pdf (download link) against what is stored for the hardware ID in the NRF_FICR->CONFIGID register (which I’ll use below).

Figure out Flash/RAM/Revision

MDBT40

I then figured out the RAM/Flash/Revision for the MDBT40 nRF51822 module on the latest LBL:

Start JLinkExe

Hooking up the SWD cables on the LBL to the nRF51 DK’s P19 debug out port:

From a terminal window on the Mac, I started jlinkexe:

jlinkexe -device nRF51822

nRF51822 on the LBL Alpha 5

and looked at the contents of the NRF_FICR->CODESIZE register. The nRF51 Series Reference Manual gives the register offset of the CODESIZE register as 0x0014.

J-Link>mem32 10000014,1

10000014 = 00000100

and 0x100 = 256. This means the nRF51822 on the LBL has 256KB of Flash.

NRF_FICR->NUMRAMBLOCK’s register offset is 0x0034:

J-Link>mem32 10000034,1

10000034 = 00000002

NRF_FICR->SIZERAMBLOCKS’s register offset is 0x0038:

J-Link>mem32 10000038,1

10000038 = 00002000 0x2000 = 8192)

The amount of RAM = 2 * (8192/1024) = 16KB

Revision is in NRF_FICR->CONFIGID

J-Link>mem32 1000005C,1

1000005C = FFFF0072

the last four bytes – in this case 0x0072 give the revision number of the chip. Table 2 in the nRF51_Series_Compatibility_Matrix_v1.1.pdf (downloaded from this link) notes 72 = revision 3, packet variant QF AA in a QFN48 package. Revision 3 has three package variants: QF AA, QF AB, QF AC. The difference is in the amount of Flash and Ram. The QF AA – which is the one I am using in this build of the LBL PCB- has 256K Flash, 16KB RAM. The one that I have ordered – which has the same amount of Flash and Ram as the nRF51 chip on the nRF51 DK – is the QF AC. The QF AC is a FN-48 package containing 256K Flash and 32K Ram.

nRF51822 on the nRF51 DK

looking at the same register contents on the nRF51 DK:

NRF_FICR->NUMRAMBLOCK = 4

NRF_FICR->SIZERAMBLOCK = 8192

NRF_FICR->CODESIZE = 256

NRF_FICR->CONFIGID = FFFF 0086

RAM = 4 * (8192/1024) = 32KB, Flash = 256KB. The CONFIGID – 86 – is not listed in a table of the nRF_Series_Compatibility_Matrix_v1.1.pdf. The closest is 85 – which is a QF AC nRF51422 which is a QFN48 package containing 256K Flash and 32K Ram. Given what Nordic advertises about the chip on the nRF51 DK, I make a leap and assume the identification of 85 and 86 are the same.

i’m from the US…i am thankful to be able to discuss with folks like you what they are working on. It is especially exciting for me to hear about people working on projects outside of the US because it is interesting to learn about places I have not lived.