diff --git a/Makefile b/Makefile index cb3b96b..dd4f8f3 100644 --- a/Makefile +++ b/Makefile @@ -12,9 +12,9 @@ TARGET=F303 # Compiler options here. ifeq ($(USE_OPT),) ifeq ($(TARGET),F303) -USE_OPT = -O2 -fno-inline-small-functions -ggdb -fomit-frame-pointer -falign-functions=16 --specs=nano.specs -fstack-usage -std=c11 +USE_OPT = -Og -fno-inline-small-functions -ggdb -fomit-frame-pointer -falign-functions=16 --specs=nano.specs -fstack-usage -std=c11 else -USE_OPT = -O2 -fno-inline-small-functions -ggdb -fomit-frame-pointer -falign-functions=16 --specs=nano.specs -fstack-usage -std=c11 +USE_OPT = -Og -fno-inline-small-functions -ggdb -fomit-frame-pointer -falign-functions=16 --specs=nano.specs -fstack-usage -std=c11 endif endif diff --git a/NANOVNA_STM32_F303/board.h b/NANOVNA_STM32_F303/board.h index 8bfa51d..95c5af2 100644 --- a/NANOVNA_STM32_F303/board.h +++ b/NANOVNA_STM32_F303/board.h @@ -270,7 +270,7 @@ PIN_OTYPE_PUSHPULL(GPIOB_I2S2_MOSI)) #define VAL_GPIOB_OSPEEDR (PIN_PUPDR_FLOATING(GPIOB_XN) | \ PIN_PUPDR_FLOATING(GPIOB_YN) | \ - PIN_OSPEED_100M(GPIOB_RX_SEL) | \ + PIN_OSPEED_2M(GPIOB_RX_SEL) | \ PIN_OSPEED_100M(3) | \ PIN_OSPEED_100M(4) | \ PIN_OSPEED_100M(5) | \ @@ -278,7 +278,7 @@ PIN_OSPEED_100M(7) | \ PIN_OSPEED_100M(GPIOB_I2C1_SCL) | \ PIN_OSPEED_100M(GPIOB_I2C1_SDA) | \ - PIN_OSPEED_100M(GPIOB_LO_SEL) | \ + PIN_OSPEED_2M(GPIOB_LO_SEL) | \ PIN_OSPEED_100M(11) | \ PIN_OSPEED_100M(GPIOB_I2S2_WCLK) | \ PIN_OSPEED_100M(GPIOB_I2S2_BCLK) | \ diff --git a/main.c b/main.c index f552c9f..782ef75 100644 --- a/main.c +++ b/main.c @@ -1,6 +1,5 @@ /* * - * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. @@ -124,7 +123,7 @@ extern int dirty; bool completed = false; -static THD_WORKING_AREA(waThread1, 1024); +static THD_WORKING_AREA(waThread1, 1124); static THD_FUNCTION(Thread1, arg) { (void)arg; @@ -2352,7 +2351,8 @@ static const VNAShellCommand commands[] = #ifdef ENABLE_THREADS_COMMAND {"threads" , cmd_threads , 0}, #endif - { "y", cmd_y, 0 }, + { "y", cmd_y, CMD_WAIT_MUTEX }, + { "z", cmd_z, CMD_WAIT_MUTEX }, { "i", cmd_i, 0 }, { "v", cmd_v, 0 }, { "a", cmd_a, 0 }, diff --git a/sa_cmd.c b/sa_cmd.c index 06eadee..f885280 100644 --- a/sa_cmd.c +++ b/sa_cmd.c @@ -301,6 +301,31 @@ VNA_SHELL_FUNCTION(cmd_y) } } +VNA_SHELL_FUNCTION(cmd_z) +{ + static const char cmd_z_list[] = "t|r|i"; + if (argc != 1) { + shell_printf("usage: z %s\r\n", cmd_z_list); + return; + } + if (argc == 1) { + SI4432_Sel = VFO; + int type = get_str_index(argv[0], cmd_z_list); + switch(type) { + case 0: + SI4432_Transmit(3); + break; + case 1: + SI4432_Receive(); + break; + case 2: + SI4432_Reset(); + break; + } + } +} + + VNA_SHELL_FUNCTION(cmd_selftest) { if (argc < 1 || argc > 2) { diff --git a/si4432.c b/si4432.c index 96615f2..9f500bf 100644 --- a/si4432.c +++ b/si4432.c @@ -42,7 +42,8 @@ // Hardware or software SPI use #ifdef USE_HARDWARE_SPI_MODE #define SI4432_SPI SPI1 -#define SI4432_SPI_SPEED SPI_BR_DIV8 +//#define SI4432_SPI_SPEED SPI_BR_DIV8 +#define SI4432_SPI_SPEED SPI_BR_DIV64 static uint32_t old_spi_settings; #else static uint32_t old_port_moder; @@ -88,8 +89,8 @@ void start_SI4432_SPI_mode(void){ new_port_moder|= PIN_MODE_OUTPUT(GPIOB_SPI_SCLK)|PIN_MODE_INPUT(GPIOB_SPI_MISO)|PIN_MODE_OUTPUT(GPIOB_SPI_MOSI); GPIOB->MODER = new_port_moder; // Pull down SPI - SPI_SDI_LOW; - SPI_CLK_LOW; + SPI1_SDI_LOW; + SPI1_CLK_LOW; #endif }