This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

saadc peripheral

Hi:

I want to use saadc peripheral,when i run the example "nRF5_SDK_17.0.2_d674dde\examples\peripheral\saadc",it worked well,but when I want to port this example to "nRF5_SDK_17.0.2_d674dde\examples\ble_peripheral\experimental\ble_app_hrs_nfc_pairing",something strange happened:

i enable the macro NRFX_SAADC_CONFIG_LOG_ENABLED in sdk_config.h

// <e> NRFX_SAADC_CONFIG_LOG_ENABLED - Enables logging in the module.
//==========================================================
#ifndef NRFX_SAADC_CONFIG_LOG_ENABLED
#define NRFX_SAADC_CONFIG_LOG_ENABLED 1
#endif

but in the *.c file,it goes wrong,the log is not enabled:

Here is the code at the beginning of this file:

#include "sdk_common.h"
#if NRFX_SAADC_ENABLED
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "nrf.h"
#include "nrf_drv_saadc.h"
#include "nrf_drv_ppi.h"
#include "nrf_drv_timer.h"
#include "boards.h"
#include "app_error.h"
#include "nrf_delay.h"
#include "app_util_platform.h"
#include "nrf_pwr_mgmt.h"

#define NRF_LOG_MODULE_NAME adc_test
#if NRFX_SAADC_CONFIG_LOG_ENABLED
#define NRF_LOG_LEVEL NRFX_SAADC_CONFIG_LOG_LEVEL
#define NRF_LOG_INFO_COLOR NRFX_SAADC_CONFIG_INFO_COLOR
#define NRF_LOG_DEBUG_COLOR NRFX_SAADC_CONFIG_DEBUG_COLOR
#else // NRFX_SAADC_CONFIG_LOG_ENABLED
#define NRF_LOG_LEVEL 0
#endif // NRFX_SAADC_CONFIG_LOG_ENABLED
#include "nrf_log.h"
NRF_LOG_MODULE_REGISTER();

and the same thing happened to other peripheral like timer:

i enabled NRFX_TIMER1_ENABLED:

#ifndef NRFX_TIMER1_ENABLED
#define NRFX_TIMER1_ENABLED 1
#endif

but in the nrfx_timer.c file,the result is not enabled:

and the same thing happened to PPI:

What's going wrong, can somebody help me?

Parents
  • Hello,

    Please make sure to remove any legacy *_ENABLED defines in your sdk_config.h file - if left defined they will overwrite your NRFX_*_ENABLED define and NRFX_* configurations.
    For example for the SAADC, make sure to only have NRFX_SAADC_ENABLED defined in your sdk_config - check to make sure that SAADC_ENABLED is not defined in the file.
    The same goes for the other peripherals such as timers and ppi as well.

    Please try this, and let me know if this resolves your issue.

    Best regards,
    Karl

  • Hi,

    Great, this successfully solved my problem,i enabled SAADC_ENABLED and NRFX_SAADC_ENABLED at the same time, the program can work normally,i didn't notice the SAADC_ENABLED macro in earlier time,thank you so much!

    Best regards,

    Abner

  • Hello again, Abner

    Abner said:
    thank you so much!

    No problem at all, I am happy to help!
    I am glad to hear that your issue is resolved now! :) 

    Please do not hesitate to open another ticket if you should encounter any other issues or questions in the future.

    Good luck with your development!

    Best regards,
    Karl

Reply
  • Hello again, Abner

    Abner said:
    thank you so much!

    No problem at all, I am happy to help!
    I am glad to hear that your issue is resolved now! :) 

    Please do not hesitate to open another ticket if you should encounter any other issues or questions in the future.

    Good luck with your development!

    Best regards,
    Karl

Children
No Data
Related