Dialog Semiconductor customer support - DA14585 ADC https://support.dialog-semiconductor.com/resource-keywords/da14585-adc en Connect Temperature Sensor in ADC VAL 1 https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/connect-temperature-sensor-adc-val-1

I am using DA14585-00ATDEVKT-P Development Kit - Pro with DA14585_SDK 6.0.2.243 and Keil uVersion V5.23.0.0.

I am following Pillar 3 (peripheral) example to connect a temperature sensor into ADC to read temperature.

1) line 63 of user_periph_setup.c: void periph_init(void)
At the end of this function, I added
adc_init(GP_ADC_SE, 0, GP_ADC_ATTN3X );
adc_enable_channel(0);

2) line 48 of user_periph_setup.c: void set_pad_functions(void)
At the end of this function, I added
GPIO_ConfigurePin(GPIO_ADC_PORT, GPIO_ADC_PIN, INPUT, PID_ADC, false);

3) after line 142 of user_periph_setup.h
I added
/****************************************************************************************/
/* ADC configuration */
/****************************************************************************************/

#if HW_CONFIG_BASIC_DK
#define GPIO_ADC_PORT GPIO_PORT_0
#define GPIO_ADC_PIN GPIO_PIN_0

#elif HW_CONFIG_PRO_DK
#define GPIO_ADC_PORT GPIO_PORT_0
#define GPIO_ADC_PIN GPIO_PIN_0

#elif HW_CONFIG_EXPERT_DK
#define GPIO_ADC_PORT GPIO_PORT_0
#define GPIO_ADC_PIN GPIO_PIN_0

#else // (other configuration)
#endif

4) At line 153 of user_custs1_impl.c, I commented out
//sample = (sample <= 0xffff) ? (sample + 1) : 0; and added
sample = adc_get_sample();

When executed the line on above 2) GPIO_ConfigurePin(GPIO_ADC_PORT, GPIO_ADC_PIN, INPUT, PID_ADC, false);
It stopped at gpio.c line 201:
#if DEVELOPMENT_DEBUG
#ifndef GPIO_DRV_PIN_ALLOC_MON_DISABLED
if ( !(GPIO_status & ( ((uint64_t)1 << pin) << (port * 16) )) )
__asm("BKPT #0\n"); // this pin has not been previously reserved!
#endif //GPIO_DRV_PIN_ALLOC_MON_DISABLED
#endif //DEVELOPMENT_DEBUG

Please guide me how to use ADC to read data from a real device instead of generated data.

Thanks

Keywords: 
Device: 
Mon, 07 Aug 2017 06:26:36 +0000 advanchip@pacbell.net 76822年https://support.dialog-semiconductor.com https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/connect-temperature-sensor-adc-val-1#comments