From f7790b7fdcede52efe19bbddbc53d8975f970326 Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Sun, 21 Feb 2021 08:16:43 +0100 Subject: [PATCH] Sweep DAC on PA4 added --- NANOVNA_STM32_F072/board.h | 6 +++--- main.c | 8 +++----- sa_core.c | 2 ++ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/NANOVNA_STM32_F072/board.h b/NANOVNA_STM32_F072/board.h index b1fa657..6ec8e5e 100644 --- a/NANOVNA_STM32_F072/board.h +++ b/NANOVNA_STM32_F072/board.h @@ -128,7 +128,7 @@ PIN_MODE_INPUT(1U) | \ PIN_MODE_INPUT(2U) | \ PIN_MODE_INPUT(3U) | \ - PIN_MODE_INPUT(4U) | \ + PIN_MODE_ANALOG(4U) | \ PIN_MODE_INPUT(5U) | \ PIN_MODE_ANALOG(GPIOA_XP) | \ PIN_MODE_ANALOG(GPIOA_YP) | \ @@ -160,7 +160,7 @@ PIN_OSPEED_2M(1) | \ PIN_OSPEED_2M(2) | \ PIN_OSPEED_2M(3) | \ - PIN_OSPEED_100M(4) | \ + PIN_OSPEED_2M(4) | \ PIN_OSPEED_100M(5) | \ PIN_OSPEED_2M(6) | \ PIN_OSPEED_2M(7) | \ @@ -176,7 +176,7 @@ PIN_PUPDR_PULLDOWN(1) | \ PIN_PUPDR_PULLDOWN(2) | \ PIN_PUPDR_PULLDOWN(3) | \ - PIN_PUPDR_PULLDOWN(4) | \ + PIN_PUPDR_FLOATING(4) | \ PIN_PUPDR_PULLDOWN(5) | \ PIN_PUPDR_FLOATING(6) | \ PIN_PUPDR_FLOATING(7) | \ diff --git a/main.c b/main.c index 73606b3..0bb96b3 100644 --- a/main.c +++ b/main.c @@ -2710,12 +2710,12 @@ static const I2CConfig i2ccfg = { .cr1 = 0, // CR1 register initialization. .cr2 = 0 // CR2 register initialization. }; +#endif static DACConfig dac1cfg1 = { //init: 2047U, init: 1922U, datamode: DAC_DHRM_12BIT_RIGHT }; -#endif #pragma GCC pop_options @@ -2861,15 +2861,13 @@ int main(void) */ shell_init_connection(); -/* restore frequencies and calibration 0 slot properties from flash memory */ -#ifdef __VNA__ - dac1cfg1.init = config.dac_value; + dac1cfg1.init = 0; + /* * Starting DAC1 driver, setting up the output pin as analog as suggested * by the Reference Manual. */ dacStart(&DACD2, &dac1cfg1); -#endif setupSA(); set_sweep_points(POINTS_COUNT); diff --git a/sa_core.c b/sa_core.c index 3d04abc..f79bdc5 100644 --- a/sa_core.c +++ b/sa_core.c @@ -2171,6 +2171,8 @@ sweep_again: // stay in sweep loop when output mo return false; } + dacPutChannelX(&DACD2, 0, i*14); // Output sweep voltage + // ----------------------- in loop AGC --------------------------------- #ifdef __SI4432__