This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

What are -DNRF_PAN_XX used for?

Most of the make files and project files within the nrf5 SDK contain a bunch of defines of the form -DNRF_PAN_XX. A search through the SDK v11.0.0 reveals only a few references to these defines.

Are the rest of these defines just artifacts of a previous version of the SDK or do they serve some other purpose?

For the ones that are referenced in the SDK should these always be defined or are there cases where it makes sense to not define them?

For example the hrs collector example for PCA10040 makefile contains:

CFLAGS += -DNRF52_PAN_12 CFLAGS += -DNRF52_PAN_15 CFLAGS += -DNRF52_PAN_58 CFLAGS += -DNRF52_PAN_55 CFLAGS += -DNRF52_PAN_54 CFLAGS += -DNRF52_PAN_31 CFLAGS += -DNRF52_PAN_30 CFLAGS += -DNRF52_PAN_51 CFLAGS += -DNRF52_PAN_36 CFLAGS += -DNRF52_PAN_53 CFLAGS += -DNRF52_PAN_20 CFLAGS += -DNRF52_PAN_64 CFLAGS += -DNRF52_PAN_62 CFLAGS += -DNRF52_PAN_63

But none of these even exist in the SDK: $ grep -rn --include *.h --include *.c --include *.s "NRF52_PAN" * components/drivers_nrf/hal/nrf_twis.h:36:#ifndef NRF52_PAN_30 /* STOP task is no t functional in MPW3 (PAN-30) */ components/drivers_nrf/hal/nrf_twis.h:90:#ifdef NRF52_PAN_29 components/drivers_nrf/saadc/nrf_drv_saadc.c:41:#ifdef NRF52_PAN_28 components/drivers_nrf/saadc/nrf_drv_saadc.c:50:#ifdef NRF52_PAN_28 components/drivers_nrf/saadc/nrf_drv_saadc.c:72:#ifdef NRF52_PAN_28 components/drivers_nrf/saadc/nrf_drv_saadc.c:94:#ifdef NRF52_PAN_28 components/drivers_nrf/saadc/nrf_drv_saadc.c:208:#ifdef NRF52_PAN_28 components/drivers_nrf/saadc/nrf_drv_saadc.c:278:#ifdef NRF52_PAN_28 components/drivers_nrf/saadc/nrf_drv_saadc.c:319:#ifndef NRF52_PAN_28 components/drivers_nrf/saadc/nrf_drv_saadc.c:340:#ifdef NRF52_PAN_28 components/drivers_nrf/saadc/nrf_drv_saadc.c:374:#ifdef NRF52_PAN_28 components/drivers_nrf/saadc/nrf_drv_saadc.c:389:#ifdef NRF52_PAN_28 components/drivers_nrf/saadc/nrf_drv_saadc.c:412:#ifdef NRF52_PAN_28 components/drivers_nrf/spi_master/nrf_drv_spi.c:60:#ifdef NRF52_PAN_23 components/drivers_nrf/spi_master/nrf_drv_spi.c:436:#ifndef NRF52_PAN_46 components/drivers_nrf/spi_master/nrf_drv_spi.c:474:#ifdef NRF52_PAN_23 components/drivers_nrf/spi_master/nrf_drv_spi.c:491:#ifdef NRF52_PAN_23 components/drivers_nrf/spi_master/nrf_drv_spi.c:562:#ifdef NRF52_PAN_23 components/drivers_nrf/twi_master/nrf_drv_twi.c:579:#ifndef NRF52_PAN_46

  • I agree that this is system is not perfect and I have reported this internally for investigation.

    SDK 11 is designed to support all revisions of nRF52 (rev1 and eng A-C). You can see the actual erratas (PAN) for all revisions here. Only the PAN defines corresponding to erratas on the chip revision should be included in the makefile.

    As for the PCA10040 hrs collector project this would mean that PAN 30, 63 and 64 should not be defined (even though they are).

    Some PAN workarounds is also implemented in the startup file (system_nrf52.c) instead of in the SDK.

  • Hi, Thing is, workaround don't use defines (they query magic addresses) and SDK12 have no reference to any NRF52_PAN_*:

    $ grep PAN . -R | grep '.[hc]' $

    (only matches are in Makefile, ewp & uvproj{,x} files)