diff --git a/projects/ad405x_iio/STM32/.extSettings b/projects/ad405x_iio/STM32/.extSettings index 99dd3a66..e634feb5 100644 --- a/projects/ad405x_iio/STM32/.extSettings +++ b/projects/ad405x_iio/STM32/.extSettings @@ -2,7 +2,7 @@ HeaderPath=../app;../../../libraries/no-OS/util;../../../libraries/no-OS/include;../../../libraries/no-OS/drivers/platform/stm32;../../../libraries/no-OS/iio;../../../libraries/no-OS/drivers/api;../../../libraries/precision-converters-library/board_info/;../../../libraries/no-OS/drivers/eeprom/24xx32a/;../../../libraries/precision-converters-library/sdp_k1_sdram/;../../../libraries/precision-converters-library/common/;../../../libraries/no-OS/drivers/adc/ad405x/; [Groups] -app/=../app/main.c;../app/ad405x.c;../app/ad405x.h;../app/ad405x_iio.c;../app/ad405x_iio.h;../app/app_config.h;../app/app_config.c;../app/app_config_stm32.c;../app/app_config_stm32.h;../app/stm32_gpio_irq_generated.c;../app/ad405x_user_config.c;../app/ad405x_user_config.h; +app/=../app/main.c;../app/ad405x_iio.c;../app/ad405x_iio.h;../app/app_config.h;../app/app_config.c;../app/app_config_stm32.c;../app/app_config_stm32.h;../app/stm32_gpio_irq_generated.c;../app/ad405x_user_config.c;../app/ad405x_user_config.h; app/libraries/precision-converters-library/board_info/=../../../libraries/precision-converters-library/board_info/board_info.c;../../../libraries/precision-converters-library/board_info/board_info.h; diff --git a/projects/ad405x_iio/STM32/ad405x_iio.ioc b/projects/ad405x_iio/STM32/ad405x_iio.ioc index 32d384d5..873b7423 100644 --- a/projects/ad405x_iio/STM32/ad405x_iio.ioc +++ b/projects/ad405x_iio/STM32/ad405x_iio.ioc @@ -80,8 +80,8 @@ Mcu.PinsNb=21 Mcu.ThirdPartyNb=0 Mcu.UserConstants= Mcu.UserName=STM32F469NIHx -MxCube.Version=6.10.0 -MxDb.Version=DB.6.0.100 +MxCube.Version=6.11.1 +MxDb.Version=DB.6.0.111 NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false NVIC.DMA2_Stream0_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false @@ -158,7 +158,7 @@ ProjectManager.CustomerFirmwarePackage= ProjectManager.DefaultFWLocation=true ProjectManager.DeletePrevious=true ProjectManager.DeviceId=STM32F469NIHx -ProjectManager.FirmwarePackage=STM32Cube FW_F4 V1.27.1 +ProjectManager.FirmwarePackage=STM32Cube FW_F4 V1.28.1 ProjectManager.FreePins=false ProjectManager.HalAssertFull=false ProjectManager.HeapSize=0x200 diff --git a/projects/ad405x_iio/app/ad405x_iio.c b/projects/ad405x_iio/app/ad405x_iio.c index 8101ac61..b3155d24 100644 --- a/projects/ad405x_iio/app/ad405x_iio.c +++ b/projects/ad405x_iio/app/ad405x_iio.c @@ -525,16 +525,6 @@ static int iio_ad405x_attr_get(void *device, switch (priv) { case ADC_RAW: -#if (ACTIVE_PLATFORM == MBED_PLATFORM) - /* By default Mbed configures the I/O direction of a gpio - * (when used for PWM) in analog mode, after disabling or - * removing the PWM object. - * In this applications, the conversion trigger pin is being shared with - * ad405x drivers as gpio output pin and is configured in output mode - * only when it is initialized. - * Hence we need to reinitialize the gpio so that ad405x drivers - * can gain access to pin configured in output mode. - * */ ret = no_os_gpio_remove(p_ad405x_dev->gpio_cnv); if (ret) { return ret; @@ -549,7 +539,7 @@ static int iio_ad405x_attr_get(void *device, if (ret) { return ret; } -#endif + #if (ADC_CAPTURE_MODE == SAMPLE_MODE) ret = ad405x_set_adc_mode(p_ad405x_dev); #elif (ADC_CAPTURE_MODE == BURST_AVERAGING_MODE) @@ -1482,11 +1472,11 @@ int32_t iio_ad405x_initialize(void) /* Read context attributes */ init_status = get_iio_context_attributes(&iio_init_params.ctx_attrs, - &iio_init_params.nb_ctx_attr, - eeprom_desc, - HW_MEZZANINE_NAME, - STR(HW_CARRIER_NAME), - &hw_mezzanine_is_valid); + &iio_init_params.nb_ctx_attr, + eeprom_desc, + HW_MEZZANINE_NAME, + STR(HW_CARRIER_NAME), + &hw_mezzanine_is_valid); if (init_status) { return init_status; } diff --git a/projects/ad405x_iio/app/app_config.h b/projects/ad405x_iio/app/app_config.h index bd061082..7edd3a94 100644 --- a/projects/ad405x_iio/app/app_config.h +++ b/projects/ad405x_iio/app/app_config.h @@ -75,7 +75,7 @@ #define ADC_CAPTURE_MODE SAMPLE_MODE #endif -/* Select the ADC output data format (default is straight binary mode) */ +/* Select the ADC output data format (default is twos complement mode) */ #if !defined(ADC_DATA_FORMAT) #define ADC_DATA_FORMAT TWOS_COMPLEMENT #endif @@ -104,18 +104,24 @@ #define DEVICE_NAME "DEV_AD4052" #define ACTIVE_DEVICE_ID ID_AD4052 #define HW_MEZZANINE_NAME "EVAL-AD4052-ARDZ" +#define ADC_SAMPLE_MODE_RESOLUTION 16 +#define ADC_AVERAGING_MODE_RESOLUTION 20 #define ADC_BURST_AVG_MODE_RESOLUTION 20 #elif defined(DEV_AD4050) #define ACTIVE_DEVICE_NAME "ad4050" #define DEVICE_NAME "DEV_AD4050" #define ACTIVE_DEVICE_ID ID_AD4050 #define HW_MEZZANINE_NAME "EVAL-AD4050-ARDZ" -#define ADC_BURST_AVG_MODE_RESOLUTION 16 +#define ADC_SAMPLE_MODE_RESOLUTION 12 +#define ADC_AVERAGING_MODE_RESOLUTION 14 +#define ADC_BURST_AVG_MODE_RESOLUTION 14 #else #define ACTIVE_DEVICE_NAME "ad4052" #define DEVICE_NAME "DEV_AD4052" #define ACTIVE_DEVICE_ID ID_AD4052 #define HW_MEZZANINE_NAME "EVAL-AD4052-ARDZ" +#define ADC_SAMPLE_MODE_RESOLUTION 16 +#define ADC_AVERAGING_MODE_RESOLUTION 20 #define ADC_BURST_AVG_MODE_RESOLUTION 20 #endif @@ -139,9 +145,6 @@ #error "No/Invalid active platform selected" #endif -/* ADC resolution for active device */ -#define ADC_SAMPLE_MODE_RESOLUTION 16 -#define ADC_AVERAGING_MODE_RESOLUTION 24 //TODO check if it works for AD4050 too #define DEFAULT_BURST_SAMPLE_RATE 2000000 /* ADC reference voltage (Range: 2.5 to 3.3v) */ diff --git a/projects/ad405x_iio/app/app_config_stm32.c b/projects/ad405x_iio/app/app_config_stm32.c index 2ba6ce66..3245fe64 100644 --- a/projects/ad405x_iio/app/app_config_stm32.c +++ b/projects/ad405x_iio/app/app_config_stm32.c @@ -223,6 +223,7 @@ void stm32_system_init(void) #endif } +#if (INTERFACE_MODE == SPI_DMA) /** * @brief Callback function to flag the capture of half the number * of requested samples. @@ -302,7 +303,6 @@ void stm32_timer_stop(void) * @return None */ -#if (INTERFACE_MODE == SPI_DMA) void receivecomplete_callback(DMA_HandleTypeDef * hdma) { if (!dma_cycle_count) { @@ -335,7 +335,6 @@ void receivecomplete_callback(DMA_HandleTypeDef * hdma) return; } -#endif /** * @brief Configures the chip select pin as output mode. @@ -431,3 +430,4 @@ void tim8_config(void) TIM8->DIER |= TIM_DIER_CC1DE; // Generate DMA request after overflow } +#endif