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

ADC operation

Hello,

I want to access the AIN input 6 ADC/LPCOMP input 6 to measure a current at two points with a defined time interval in between.

Since I am not familiar how to do that, I downloaded the ble_app_uart_adc_simple example. Isn't there any other very simple example how to do that (if anyone can upload one, I would appreciate) without BLE, just reading a value on the ADC input?

With the ble_app_uart_adc_simple example I am facing lots of errors:

*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'

compiling main.c...

C:\Users\test\Desktop\Programme\Keil\ADC programming\NRF examples\nrf51-ADC-examples-master\ble_app_uart_adc_simple\pca10028\s130\arm5_no_packs\_build\nrf_drv_config.h(17): warning:  #47-D: incompatible redefinition of macro "CLOCK_CONFIG_XTAL_FREQ"  (declared at line 353 of "C:\Users\test\Desktop\Programme\Keil\ADC programming\NRF examples\nrf51-ADC-examples-master\ble_app_uart_adc_simple\pca10028\s130\config\sdk_config.h")

  #define CLOCK_CONFIG_XTAL_FREQ          NRF_CLOCK_XTALFREQ_16MHz

C:\Users\test\Desktop\Programme\Keil\ADC programming\NRF examples\nrf51-ADC-examples-master\ble_app_uart_adc_simple\pca10028\s130\arm5_no_packs\_build\nrf_drv_config.h(18): warning:  #47-D: incompatible redefinition of macro "CLOCK_CONFIG_LF_SRC"  (declared at line 363 of "C:\Users\test\Desktop\Programme\Keil\ADC programming\NRF examples\nrf51-ADC-examples-master\ble_app_uart_adc_simple\pca10028\s130\config\sdk_config.h")

  #define CLOCK_CONFIG_LF_SRC             NRF_CLOCK_LF_SRC_Xtal

C:\Users\test\Desktop\Programme\Keil\ADC programming\NRF examples\nrf51-ADC-examples-master\ble_app_uart_adc_simple\pca10028\s130\arm5_no_packs\_build\nrf_drv_config.h(20): warning:  #47-D: incompatible redefinition of macro "CLOCK_CONFIG_IRQ_PRIORITY"  (declared at line 376 of "C:\Users\test\Desktop\Programme\Keil\ADC programming\NRF examples\nrf51-ADC-examples-master\ble_app_uart_adc_simple\pca10028\s130\config\sdk_config.h")

  #define CLOCK_CONFIG_IRQ_PRIORITY       APP_IRQ_PRIORITY_LOW

C:\Users\test\Desktop\Programme\Keil\ADC programming\NRF examples\nrf51-ADC-examples-master\ble_app_uart_adc_simple\pca10028\s130\arm5_no_packs\_build\nrf_drv_config.h(27): warning:  #47-D: incompatible redefinition of macro "GPIOTE_CONFIG_IRQ_PRIORITY"  (declared at line 659 of "C:\Users\test\Desktop\Programme\Keil\ADC programming\NRF examples\nrf51-ADC-examples-master\ble_app_uart_adc_simple\pca10028\s130\config\sdk_config.h")

  #define GPIOTE_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH

C:\Users\test\Desktop\Programme\Keil\ADC programming\NRF examples\nrf51-ADC-examples-master\ble_app_uart_adc_simple\pca10028\s130\arm5_no_packs\_build\nrf_drv_config.h(28): warning:  #47-D: incompatible redefinition of macro "GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS"  (declared at line 646 of "C:\Users\test\Desktop\Programme\Keil\ADC programming\NRF examples\nrf51-ADC-examples-master\ble_app_uart_adc_simple\pca10028\s130\config\sdk_config.h")

  #define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1

C:\Users\test\Desktop\Programme\Keil\ADC programming\NRF examples\nrf51-ADC-examples-master\ble_app_uart_adc_simple\pca10028\s130\arm5_no_packs\_build\nrf_drv_adc.h(156): error:  #20: identifier "ret_code_t" is undefined

  ret_code_t nrf_drv_adc_init(nrf_drv_adc_config_t const * p_config,

C:\Users\test\Desktop\Programme\Keil\ADC programming\NRF examples\nrf51-ADC-examples-master\ble_app_uart_adc_simple\pca10028\s130\arm5_no_packs\_build\nrf_drv_adc.h(207): error:  #20: identifier "ret_code_t" is undefined

  ret_code_t nrf_drv_adc_sample_convert(nrf_drv_adc_channel_t const * const p_channel,

C:\Users\test\Desktop\Programme\Keil\ADC programming\NRF examples\nrf51-ADC-examples-master\ble_app_uart_adc_simple\pca10028\s130\arm5_no_packs\_build\nrf_drv_adc.h(237): error:  #20: identifier "ret_code_t" is undefined

  ret_code_t nrf_drv_adc_buffer_convert(nrf_adc_value_t * buffer, uint16_t size);

C:\Users\test\Desktop\Programme\Keil\ADC programming\NRF examples\nrf51-ADC-examples-master\ble_app_uart_adc_simple\pca10028\s130\arm5_no_packs\_build\nrf_drv_adc.h(272): error:  #120: return value type does not match the function type

      return nrf_adc_task_address_get(NRF_ADC_TASK_START);

..\..\..\main.c(298): error:  #140: too many arguments in function call

              err_code = sd_ble_gap_sec_params_reply(m_conn_handle, BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, NULL, NULL);

..\..\..\main.c(304): error:  #140: too many arguments in function call

              err_code = sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0, 0);

..\..\..\main.c(398): error:  #20: identifier "nrf_clock_lf_cfg_t" is undefined

      nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;

..\..\..\main.c(398): error:  #20: identifier "NRF_CLOCK_LFCLKSRC" is undefined

      nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;

..\..\..\main.c(404): warning:  #223-D: function "softdevice_enable_get_default_config" declared implicitly

      err_code = softdevice_enable_get_default_config(CENTRAL_LINK_COUNT,

..\..\..\main.c(410): warning:  #223-D: function "CHECK_RAM_START_ADDR" declared implicitly

      CHECK_RAM_START_ADDR(CENTRAL_LINK_COUNT,PERIPHERAL_LINK_COUNT);

..\..\..\main.c(416): warning:  #223-D: function "softdevice_enable" declared implicitly

      err_code = softdevice_enable(&ble_enable_params);

..\..\..\main.c(446): error:  #20: identifier "BSP_EVENT_WHITELIST_OFF" is undefined

          case BSP_EVENT_WHITELIST_OFF:

..\..\..\main.c(493): warning:  #223-D: function "ble_nus_string_send" declared implicitly

                  err_code = ble_nus_string_send(&m_nus, data_array, index);

..\..\..\main.c(535): error:  #20: identifier "APP_IRQ_PRIORITY_LOWEST" is undefined

      APP_UART_FIFO_INIT( &comm_params,

..\..\..\main.c(559): error:  #513: a value of type "int" cannot be assigned to an entity of type "uint8_array_t"

      advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;

..\..\..\main.c(624): warning:  #223-D: function "ble_nus_string_send" declared implicitly

              ble_nus_string_send(&m_nus, &adc_result[0], ADC_BUFFER_SIZE*2);           //Send ADC result over BLE via NUS service

..\..\..\main.c(635): error:  #20: identifier "ret_code_t" is undefined

      ret_code_t ret_code;

..\..\..\main.c(652): error:  #54-D: too few arguments in invocation of macro "APP_TIMER_INIT"

      APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);

..\..\..\main.c(652): error:  #29: expected an expression

      APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);

..\..\..\main.c: 10 warnings, 14 errors

"..\..\..\main.c" - 14 Error(s), 10 Warning(s).

The warnings are not the biggest problem, I need to fix the errors.

Is there anything I can set in the sdk_config.h file?

I don't understand where the ret_code_t" is defined, since I included the nrf_drv_adc.h.

Thanks, 

BR,

Parents Reply Children
No Data
Related