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. */



    IC_REVISION_NRF51_REV1,    /**< IC Revision 1. */

    IC_REVISION_NRF51_REV2,    /**< IC Revision 2. */

    IC_REVISION_NRF51_REV3,    /**< IC Revision 3. */

    IC_REVISION_NRF51_UNKNOWN  /**< IC Revision unknown. */

} nrf_ic_revision_t;


 /**@brief IC information struct containing the IC revision, RAM size, and FLASH size. */



    nrf_ic_revision_t ic_revision;    /**< IC revision. */

    uint16_t          ram_size;       /**< RAM size in kB (16 = 16 kB RAM). */

    uint16_t          flash_size;     /**< FLASH size in kB (256 = 256 kB FLASH). */

} nrf_ic_info_t;



/**@brief  Function for returning information about the IC revision, the RAM size, and the FLASH size.


 * @param[out]  p_ic_info  Struct containing IC revision, RAM size, and FLASH size.

and then at the function that uses these typedefs:

void nrf_ic_info_get(nrf_ic_info_t * p_ic_info)


    uint32_t ic_data;


    ic_data = (((*((uint32_t volatile *)0xF0000FE8)) & 0x000000F0) >> 4);


    p_ic_info->ram_size = (uint16_t) NRF_FICR->NUMRAMBLOCK * (NRF_FICR->SIZERAMBLOCKS / 1024);

    p_ic_info->flash_size = (uint16_t) NRF_FICR->CODESIZE;

    switch (ic_data)


        /** IC revision 1 */

        case 1:

            p_ic_info->ic_revision = IC_REVISION_NRF51_REV1;



        /** IC revision 2 */

        case 4:

            p_ic_info->ic_revision = IC_REVISION_NRF51_REV2;



        /** IC revision 3 */

        case 7:

            /* fall through */

        case 8:

            /* fall through */

        case 9:

            p_ic_info->ic_revision = IC_REVISION_NRF51_REV3;




            p_ic_info->ic_revision = IC_REVISION_NRF51_UNKNOWN;



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


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

Amount of RAM = NRF_FICR->NUMRAMBLOCK * (NRF_FICR->SIZERAMBLOCKS / 1024);  /**< RAM size in kB (16 = 16 kB RAM). */

Amount of Flash = NRF_FICR->CODESIZE  /**< FLASH size in kB (256 = 256 kB FLASH). */ 

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:


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.



That was fun!  Please find many things to smile about.