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

Add SAADC peripheral (and others) to example project

I am using SES and nRF5 SDK v17.0.2.

I am tying to add a few peripherals (SAADC, I2C, SPI, etc.) to the peripheral UART example with EVK (ble_app_uart_pca10040_s112). 

To add SAADC, I modified the SDK_config.h file line 3298 to "#define NRFX_SAADC_ENABLED 1" but this had no effect until I also added .c and .h files to project files.  So far so good, after tracking down some compiling errors to make sure everything was included.

Then, I got a linking error which I traced to "NRFX_CHECK(NRFX_SAADC_ENABLED)" failiing in nrfx_saadc.c.  Commenting out that check allowed the build to complete.

Then, reverting link 3298 in SDK_config.h to #define NRFX_SAADC_ENABLED 0" and cleaning/rebuilding, and the build still succeeded!

My questions are:

  1. How to properly add peripherals to a project -- the documentation and Devzone are very incomplete on this topic.
  2. Why does NRFX_CHECK() fail in the case I described above?  
  3. Why does build succeed even with SDK_config.h disabling SAADC?  

Thanks,

Jackson

Parents
  • Thanks for the information about steps to include peripherals.  I have done this successfully with the SAADC.  

    However, even following these steps, there were several points where NRFX_CHECK() failed.  For example, the saadc_sampling_event_init() routine calls nrf_drv_timer_init(), which fails to build:

    This occurs because the first #define in nrfx_timer.c calls NRFX_CHECK(), which fails:

    This happens even though NRFX_TIMER_ENABLED has been set to "1" in sdk_config.h:

    If I comment out this NRFX_CHECK() (and several others) build succeeds.

    This situation appears for other drivers (like nrfx_ppi) as well.  The #define in sdk_config.h does not seem to be affecting the driver file's compilation. 

Reply
  • Thanks for the information about steps to include peripherals.  I have done this successfully with the SAADC.  

    However, even following these steps, there were several points where NRFX_CHECK() failed.  For example, the saadc_sampling_event_init() routine calls nrf_drv_timer_init(), which fails to build:

    This occurs because the first #define in nrfx_timer.c calls NRFX_CHECK(), which fails:

    This happens even though NRFX_TIMER_ENABLED has been set to "1" in sdk_config.h:

    If I comment out this NRFX_CHECK() (and several others) build succeeds.

    This situation appears for other drivers (like nrfx_ppi) as well.  The #define in sdk_config.h does not seem to be affecting the driver file's compilation. 

Children
No Data
Related