From 6137f2552ad24cdbd6b2f81e5cf84c09df4ca62d Mon Sep 17 00:00:00 2001 From: Piodabro Date: Tue, 5 Dec 2017 09:55:48 +0100 Subject: [PATCH] project structure rebuild, new CubeMX configuration, TIM3 at 400Hz interrupt --- PRO58/.cproject | 256 ++++++++ PRO58/.gitignore | 2 + PRO58/.mxproject | 10 +- PRO58/.project | 28 + PRO58/.settings/language.settings.xml | 27 + PRO58/Inc/main.h | 19 +- PRO58/Inc/stm32f1xx_hal_conf.h | 2 +- PRO58/Inc/stm32f1xx_it.h | 4 + PRO58/Inc/tim.h | 2 + PRO58/PRO58.ioc | 179 +++--- PRO58/{SW4STM32/PRO58 => }/PRO58.xml | 0 .../PRO58 Run.cfg => PRO58Pub Debug.cfg} | 0 ...Pub PublicRelease.cfg => PRO58Pub Run.cfg} | 0 .../PRO58 => }/STM32F103C8Tx_FLASH.ld | 33 +- PRO58/SW4STM32/PRO58/.cproject | 582 ------------------ PRO58/SW4STM32/PRO58/.gitignore | 5 - PRO58/SW4STM32/PRO58/.project | 325 ---------- .../PRO58/.settings/language.settings.xml | 63 -- .../.settings/org.eclipse.cdt.core.prefs | 3 - PRO58/SW4STM32/PRO58/NUCLEO-F103RB.xml | 20 - PRO58/SW4STM32/PRO58/PRO58 Nucleo.cfg | 28 - PRO58/SW4STM32/PRO58/PRO58 PublicRelease.cfg | 28 - PRO58/Src/adc.c | 2 +- PRO58/Src/dma.c | 3 + PRO58/Src/i2c.c | 18 + PRO58/Src/main.cpp | 194 +++--- PRO58/Src/state_settings.cpp | 41 +- PRO58/Src/stm32f1xx_it.cpp | 30 + PRO58/Src/tim.c | 65 +- PRO58/mx.scratch | 87 +++ .../startup_stm32f103xb.s | 0 31 files changed, 754 insertions(+), 1302 deletions(-) create mode 100644 PRO58/.cproject create mode 100644 PRO58/.gitignore create mode 100644 PRO58/.project create mode 100644 PRO58/.settings/language.settings.xml rename PRO58/{SW4STM32/PRO58 => }/PRO58.xml (100%) rename PRO58/{SW4STM32/PRO58/PRO58 Run.cfg => PRO58Pub Debug.cfg} (100%) rename PRO58/{SW4STM32/PRO58/PRO58Pub PublicRelease.cfg => PRO58Pub Run.cfg} (100%) rename PRO58/{SW4STM32/PRO58 => }/STM32F103C8Tx_FLASH.ld (70%) delete mode 100644 PRO58/SW4STM32/PRO58/.cproject delete mode 100644 PRO58/SW4STM32/PRO58/.gitignore delete mode 100644 PRO58/SW4STM32/PRO58/.project delete mode 100644 PRO58/SW4STM32/PRO58/.settings/language.settings.xml delete mode 100644 PRO58/SW4STM32/PRO58/.settings/org.eclipse.cdt.core.prefs delete mode 100644 PRO58/SW4STM32/PRO58/NUCLEO-F103RB.xml delete mode 100644 PRO58/SW4STM32/PRO58/PRO58 Nucleo.cfg delete mode 100644 PRO58/SW4STM32/PRO58/PRO58 PublicRelease.cfg create mode 100644 PRO58/mx.scratch rename PRO58/{SW4STM32 => startup}/startup_stm32f103xb.s (100%) diff --git a/PRO58/.cproject b/PRO58/.cproject new file mode 100644 index 0000000..19b5b87 --- /dev/null +++ b/PRO58/.cproject @@ -0,0 +1,256 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PRO58/.gitignore b/PRO58/.gitignore new file mode 100644 index 0000000..ac01e66 --- /dev/null +++ b/PRO58/.gitignore @@ -0,0 +1,2 @@ +/Debug/ +/Release/ diff --git a/PRO58/.mxproject b/PRO58/.mxproject index 5c8c3eb..d28d2c2 100644 --- a/PRO58/.mxproject +++ b/PRO58/.mxproject @@ -1,14 +1,14 @@ [PreviousGenFiles] HeaderPath=./Inc -HeaderFiles=gpio.h;adc.h;dma.h;i2c.h;usart.h;stm32f1xx_it.h;stm32f1xx_hal_conf.h;main.h; +HeaderFiles=gpio.h;adc.h;dma.h;i2c.h;tim.h;usart.h;stm32f1xx_it.h;stm32f1xx_hal_conf.h;main.h; SourcePath=./Src -SourceFiles=gpio.h;adc.h;dma.h;i2c.h;usart.h;stm32f1xx_it.h;stm32f1xx_hal_conf.h;main.h;gpio.c;adc.c;dma.c;i2c.c;usart.c;stm32f1xx_it.c;stm32f1xx_hal_msp.c;main.c; +SourceFiles=gpio.c;adc.c;dma.c;i2c.c;tim.c;usart.c;stm32f1xx_it.c;stm32f1xx_hal_msp.c;main.c; [PreviousLibFiles] LibFiles=Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_adc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_adc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_i2c.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h;Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Drivers/CMSIS/Include/arm_common_tables.h;Drivers/CMSIS/Include/arm_const_structs.h;Drivers/CMSIS/Include/arm_math.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/cmsis_armcc_V6.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_cmFunc.h;Drivers/CMSIS/Include/core_cmInstr.h;Drivers/CMSIS/Include/core_cmSimd.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_sc300.h; [PreviousUsedSW4STM32Files] -SourceFiles=../Src/main.c;../Src/gpio.c;../Src/adc.c;../Src/dma.c;../Src/i2c.c;../Src/usart.c;../Src/stm32f1xx_it.c;../Src/stm32f1xx_hal_msp.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;../Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;../Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xb.s; -HeaderPath=..\Drivers\STM32F1xx_HAL_Driver\Inc;..\Drivers\STM32F1xx_HAL_Driver\Inc\Legacy;..\Drivers\CMSIS\Device\ST\STM32F1xx\Include;..\Drivers\CMSIS\Include; -CDefines=__weak=__attribute__((weak));__packed=__attribute__((__packed__)); +SourceFiles=..\Src\main.c;..\Src\gpio.c;..\Src\adc.c;..\Src\dma.c;..\Src\i2c.c;..\Src\tim.c;..\Src\usart.c;..\Src\stm32f1xx_it.c;..\Src\stm32f1xx_hal_msp.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;../Src/system_stm32f1xx.c;../Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;../Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xb.s; +HeaderPath=..\Drivers\STM32F1xx_HAL_Driver\Inc;..\Drivers\STM32F1xx_HAL_Driver\Inc\Legacy;..\Drivers\CMSIS\Device\ST\STM32F1xx\Include;..\Drivers\CMSIS\Include;..\Inc; +CDefines=__weak:__attribute__((weak));__packed:__attribute__((__packed__)); diff --git a/PRO58/.project b/PRO58/.project new file mode 100644 index 0000000..44500b1 --- /dev/null +++ b/PRO58/.project @@ -0,0 +1,28 @@ + + + PRO58Pub + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + fr.ac6.mcu.ide.core.MCUProjectNature + org.eclipse.cdt.core.ccnature + + diff --git a/PRO58/.settings/language.settings.xml b/PRO58/.settings/language.settings.xml new file mode 100644 index 0000000..ce817ba --- /dev/null +++ b/PRO58/.settings/language.settings.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PRO58/Inc/main.h b/PRO58/Inc/main.h index aa4258f..fa3c0f3 100644 --- a/PRO58/Inc/main.h +++ b/PRO58/Inc/main.h @@ -1,6 +1,6 @@ /** ****************************************************************************** - * File Name : main.h + * File Name : main.hpp * Description : This file contains the common defines of the application ****************************************************************************** ** This notice applies to any and all portions of this file @@ -40,6 +40,7 @@ #define __MAIN_H /* Includes ------------------------------------------------------------------*/ +/* Includes ------------------------------------------------------------------*/ /* USER CODE BEGIN Includes */ /* USER CODE END Includes */ @@ -87,23 +88,23 @@ #define LED_A_Pin GPIO_PIN_9 #define LED_A_GPIO_Port GPIOB +/* ########################## Assert Selection ############################## */ +/** + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ +/* #define USE_FULL_ASSERT 1U */ + /* USER CODE BEGIN Private defines */ -#ifdef NUCLEO_TEST - #define LED_B_Pin GPIO_PIN_2 // - #define LED_B_GPIO_Port GPIOB // NUCLEO BOARDS HAS PA2 connected to USART of ST-LINK - #define RECEIVER_SW_Pin GPIO_PIN_1 - #define RECEIVER_SW_GPIO_Port GPIOB //LSE -#endif + /* USER CODE END Private defines */ #ifdef __cplusplus extern "C" { #endif - void _Error_Handler(const char *, int); #define Error_Handler() _Error_Handler(__FILE__, __LINE__) - #ifdef __cplusplus } #endif diff --git a/PRO58/Inc/stm32f1xx_hal_conf.h b/PRO58/Inc/stm32f1xx_hal_conf.h index 773353b..ebbd641 100644 --- a/PRO58/Inc/stm32f1xx_hal_conf.h +++ b/PRO58/Inc/stm32f1xx_hal_conf.h @@ -152,7 +152,7 @@ * @brief Uncomment the line below to expanse the "assert_param" macro in the * HAL drivers code */ -/* #define USE_FULL_ASSERT 1 */ +/* #define USE_FULL_ASSERT 1U */ /* ################## Ethernet peripheral configuration ##################### */ diff --git a/PRO58/Inc/stm32f1xx_it.h b/PRO58/Inc/stm32f1xx_it.h index 0d4c61b..ec5df49 100644 --- a/PRO58/Inc/stm32f1xx_it.h +++ b/PRO58/Inc/stm32f1xx_it.h @@ -40,6 +40,8 @@ #endif /* Includes ------------------------------------------------------------------*/ +#include "stm32f1xx_hal.h" +#include "main.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ @@ -58,6 +60,8 @@ void DMA1_Channel1_IRQHandler(void); void DMA1_Channel4_IRQHandler(void); void DMA1_Channel5_IRQHandler(void); void DMA1_Channel6_IRQHandler(void); +void DMA1_Channel7_IRQHandler(void); +void TIM3_IRQHandler(void); #ifdef __cplusplus } diff --git a/PRO58/Inc/tim.h b/PRO58/Inc/tim.h index 511d481..c56ecc7 100644 --- a/PRO58/Inc/tim.h +++ b/PRO58/Inc/tim.h @@ -51,6 +51,7 @@ /* USER CODE END Includes */ +extern TIM_HandleTypeDef htim3; extern TIM_HandleTypeDef htim4; /* USER CODE BEGIN Private defines */ @@ -59,6 +60,7 @@ extern TIM_HandleTypeDef htim4; extern void _Error_Handler(const char *, int); +void MX_TIM3_Init(void); void MX_TIM4_Init(void); void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim); diff --git a/PRO58/PRO58.ioc b/PRO58/PRO58.ioc index 0833708..41a1b8b 100644 --- a/PRO58/PRO58.ioc +++ b/PRO58/PRO58.ioc @@ -6,58 +6,69 @@ ADC1.DataAlign=ADC_DATAALIGN_RIGHT ADC1.DiscontinuousConvMode=DISABLE ADC1.EnableAnalogWatchDog=false ADC1.EnableRegularConversion=ENABLE +ADC1.ExternalTrigConv=ADC_SOFTWARE_START ADC1.ExternalTrigConvEdgeChoice=NONE -ADC1.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,NbrOfConversionFlag,master,DataAlign,ScanConvMode,ContinuousConvMode,DiscontinuousConvMode,EnableRegularConversion,NbrOfConversion,ExternalTrigConvEdgeChoice,InjNumberOfConversion,EnableAnalogWatchDog,Rank-1\#ChannelRegularConversion,Channel-1\#ChannelRegularConversion,SamplingTime-1\#ChannelRegularConversion +ADC1.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,NbrOfConversionFlag,master,DataAlign,ScanConvMode,ContinuousConvMode,DiscontinuousConvMode,EnableRegularConversion,NbrOfConversion,ExternalTrigConvEdgeChoice,InjNumberOfConversion,EnableAnalogWatchDog,Rank-1\#ChannelRegularConversion,Channel-1\#ChannelRegularConversion,SamplingTime-1\#ChannelRegularConversion,ExternalTrigConv ADC1.InjNumberOfConversion=0 ADC1.NbrOfConversion=2 ADC1.NbrOfConversionFlag=1 ADC1.Rank-0\#ChannelRegularConversion=1 ADC1.Rank-1\#ChannelRegularConversion=2 -ADC1.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_28CYCLES_5 -ADC1.SamplingTime-1\#ChannelRegularConversion=ADC_SAMPLETIME_28CYCLES_5 +ADC1.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_239CYCLES_5 +ADC1.SamplingTime-1\#ChannelRegularConversion=ADC_SAMPLETIME_239CYCLES_5 ADC1.ScanConvMode=ADC_SCAN_ENABLE ADC1.master=1 -Dma.ADC1.0.Direction=DMA_PERIPH_TO_MEMORY -Dma.ADC1.0.Instance=DMA1_Channel1 -Dma.ADC1.0.MemDataAlignment=DMA_MDATAALIGN_HALFWORD -Dma.ADC1.0.MemInc=DMA_MINC_ENABLE -Dma.ADC1.0.Mode=DMA_CIRCULAR -Dma.ADC1.0.PeriphDataAlignment=DMA_PDATAALIGN_HALFWORD -Dma.ADC1.0.PeriphInc=DMA_PINC_DISABLE -Dma.ADC1.0.Priority=DMA_PRIORITY_LOW -Dma.ADC1.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority -Dma.I2C1_TX.3.Direction=DMA_MEMORY_TO_PERIPH -Dma.I2C1_TX.3.Instance=DMA1_Channel6 -Dma.I2C1_TX.3.MemDataAlignment=DMA_MDATAALIGN_BYTE -Dma.I2C1_TX.3.MemInc=DMA_MINC_ENABLE -Dma.I2C1_TX.3.Mode=DMA_NORMAL -Dma.I2C1_TX.3.PeriphDataAlignment=DMA_PDATAALIGN_BYTE -Dma.I2C1_TX.3.PeriphInc=DMA_PINC_DISABLE -Dma.I2C1_TX.3.Priority=DMA_PRIORITY_MEDIUM -Dma.I2C1_TX.3.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority -Dma.I2C2_RX.2.Direction=DMA_PERIPH_TO_MEMORY -Dma.I2C2_RX.2.Instance=DMA1_Channel5 -Dma.I2C2_RX.2.MemDataAlignment=DMA_MDATAALIGN_BYTE -Dma.I2C2_RX.2.MemInc=DMA_MINC_ENABLE -Dma.I2C2_RX.2.Mode=DMA_NORMAL -Dma.I2C2_RX.2.PeriphDataAlignment=DMA_PDATAALIGN_BYTE -Dma.I2C2_RX.2.PeriphInc=DMA_PINC_DISABLE -Dma.I2C2_RX.2.Priority=DMA_PRIORITY_LOW -Dma.I2C2_RX.2.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority -Dma.I2C2_TX.1.Direction=DMA_MEMORY_TO_PERIPH -Dma.I2C2_TX.1.Instance=DMA1_Channel4 -Dma.I2C2_TX.1.MemDataAlignment=DMA_MDATAALIGN_BYTE -Dma.I2C2_TX.1.MemInc=DMA_MINC_ENABLE -Dma.I2C2_TX.1.Mode=DMA_NORMAL -Dma.I2C2_TX.1.PeriphDataAlignment=DMA_PDATAALIGN_BYTE -Dma.I2C2_TX.1.PeriphInc=DMA_PINC_DISABLE -Dma.I2C2_TX.1.Priority=DMA_PRIORITY_LOW -Dma.I2C2_TX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority -Dma.Request0=ADC1 -Dma.Request1=I2C2_TX -Dma.Request2=I2C2_RX -Dma.Request3=I2C1_TX -Dma.RequestsNb=4 +Dma.ADC1.4.Direction=DMA_PERIPH_TO_MEMORY +Dma.ADC1.4.Instance=DMA1_Channel1 +Dma.ADC1.4.MemDataAlignment=DMA_MDATAALIGN_HALFWORD +Dma.ADC1.4.MemInc=DMA_MINC_ENABLE +Dma.ADC1.4.Mode=DMA_CIRCULAR +Dma.ADC1.4.PeriphDataAlignment=DMA_PDATAALIGN_HALFWORD +Dma.ADC1.4.PeriphInc=DMA_PINC_DISABLE +Dma.ADC1.4.Priority=DMA_PRIORITY_LOW +Dma.ADC1.4.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority +Dma.I2C1_RX.3.Direction=DMA_PERIPH_TO_MEMORY +Dma.I2C1_RX.3.Instance=DMA1_Channel7 +Dma.I2C1_RX.3.MemDataAlignment=DMA_MDATAALIGN_BYTE +Dma.I2C1_RX.3.MemInc=DMA_MINC_ENABLE +Dma.I2C1_RX.3.Mode=DMA_NORMAL +Dma.I2C1_RX.3.PeriphDataAlignment=DMA_PDATAALIGN_BYTE +Dma.I2C1_RX.3.PeriphInc=DMA_PINC_DISABLE +Dma.I2C1_RX.3.Priority=DMA_PRIORITY_MEDIUM +Dma.I2C1_RX.3.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority +Dma.I2C1_TX.2.Direction=DMA_MEMORY_TO_PERIPH +Dma.I2C1_TX.2.Instance=DMA1_Channel6 +Dma.I2C1_TX.2.MemDataAlignment=DMA_MDATAALIGN_BYTE +Dma.I2C1_TX.2.MemInc=DMA_MINC_ENABLE +Dma.I2C1_TX.2.Mode=DMA_NORMAL +Dma.I2C1_TX.2.PeriphDataAlignment=DMA_PDATAALIGN_BYTE +Dma.I2C1_TX.2.PeriphInc=DMA_PINC_DISABLE +Dma.I2C1_TX.2.Priority=DMA_PRIORITY_MEDIUM +Dma.I2C1_TX.2.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority +Dma.I2C2_RX.1.Direction=DMA_PERIPH_TO_MEMORY +Dma.I2C2_RX.1.Instance=DMA1_Channel5 +Dma.I2C2_RX.1.MemDataAlignment=DMA_MDATAALIGN_BYTE +Dma.I2C2_RX.1.MemInc=DMA_MINC_ENABLE +Dma.I2C2_RX.1.Mode=DMA_NORMAL +Dma.I2C2_RX.1.PeriphDataAlignment=DMA_PDATAALIGN_BYTE +Dma.I2C2_RX.1.PeriphInc=DMA_PINC_DISABLE +Dma.I2C2_RX.1.Priority=DMA_PRIORITY_LOW +Dma.I2C2_RX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority +Dma.I2C2_TX.0.Direction=DMA_MEMORY_TO_PERIPH +Dma.I2C2_TX.0.Instance=DMA1_Channel4 +Dma.I2C2_TX.0.MemDataAlignment=DMA_MDATAALIGN_BYTE +Dma.I2C2_TX.0.MemInc=DMA_MINC_ENABLE +Dma.I2C2_TX.0.Mode=DMA_NORMAL +Dma.I2C2_TX.0.PeriphDataAlignment=DMA_PDATAALIGN_BYTE +Dma.I2C2_TX.0.PeriphInc=DMA_PINC_DISABLE +Dma.I2C2_TX.0.Priority=DMA_PRIORITY_LOW +Dma.I2C2_TX.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority +Dma.Request0=I2C2_TX +Dma.Request1=I2C2_RX +Dma.Request2=I2C1_TX +Dma.Request3=I2C1_RX +Dma.Request4=ADC1 +Dma.RequestsNb=5 File.Version=6 I2C1.I2C_Mode=I2C_Fast I2C1.IPParameters=I2C_Mode @@ -72,8 +83,10 @@ Mcu.IP3=I2C2 Mcu.IP4=NVIC Mcu.IP5=RCC Mcu.IP6=SYS -Mcu.IP7=USART1 -Mcu.IPNb=8 +Mcu.IP7=TIM3 +Mcu.IP8=TIM4 +Mcu.IP9=USART1 +Mcu.IPNb=10 Mcu.Name=STM32F103C(8-B)Tx Mcu.Package=LQFP48 Mcu.Pin0=PC15-OSC32_OUT @@ -96,6 +109,8 @@ Mcu.Pin23=PB7 Mcu.Pin24=PB8 Mcu.Pin25=PB9 Mcu.Pin26=VP_SYS_VS_Systick +Mcu.Pin27=VP_TIM3_VS_ClockSourceINT +Mcu.Pin28=VP_TIM4_VS_ClockSourceINT Mcu.Pin3=PA0-WKUP Mcu.Pin4=PA1 Mcu.Pin5=PA2 @@ -103,25 +118,27 @@ Mcu.Pin6=PA3 Mcu.Pin7=PA4 Mcu.Pin8=PA5 Mcu.Pin9=PA7 -Mcu.PinsNb=27 +Mcu.PinsNb=29 Mcu.UserConstants= Mcu.UserName=STM32F103C8Tx -MxCube.Version=4.22.0 -MxDb.Version=DB.4.0.220 -NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true -NVIC.DMA1_Channel1_IRQn=true\:0\:0\:false\:false\:true -NVIC.DMA1_Channel4_IRQn=true\:0\:0\:false\:false\:true -NVIC.DMA1_Channel5_IRQn=true\:0\:0\:false\:false\:true -NVIC.DMA1_Channel6_IRQn=true\:0\:0\:false\:false\:true -NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true -NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true -NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true -NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true -NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true +MxCube.Version=4.23.0 +MxDb.Version=DB.4.0.230 +NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:true +NVIC.DMA1_Channel1_IRQn=true\:0\:0\:false\:false\:true\:false +NVIC.DMA1_Channel4_IRQn=true\:0\:0\:false\:false\:true\:true +NVIC.DMA1_Channel5_IRQn=true\:0\:0\:false\:false\:true\:true +NVIC.DMA1_Channel6_IRQn=true\:0\:0\:false\:false\:true\:true +NVIC.DMA1_Channel7_IRQn=true\:0\:0\:false\:false\:true\:false +NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:true +NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:true +NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:true +NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:true +NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:true NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 -NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true -NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true -NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true +NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:true +NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:true +NVIC.TIM3_IRQn=true\:0\:0\:false\:false\:true\:true +NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:true PA0-WKUP.GPIOParameters=GPIO_Label PA0-WKUP.GPIO_Label=RSSI_A_ADC PA0-WKUP.Locked=true @@ -133,8 +150,8 @@ PA1.Signal=ADCx_IN1 PA10.Mode=Asynchronous PA10.Signal=USART1_RX PA11.GPIOParameters=GPIO_PuPd,GPIO_Label -PA11.GPIO_Label=BUTTON_EB1 -PA11.GPIO_PuPd=GPIO_PULLUP +PA11.GPIO_Label=FS_PIN_EB1 +PA11.GPIO_PuPd=GPIO_PULLDOWN PA11.Locked=true PA11.Signal=GPIO_Input PA13.Mode=Serial_Wire @@ -190,8 +207,8 @@ PB12.GPIO_PuPd=GPIO_PULLUP PB12.Locked=true PB12.Signal=GPIO_Input PB13.GPIOParameters=GPIO_PuPd,GPIO_Label -PB13.GPIO_Label=BUTTON_EB0 -PB13.GPIO_PuPd=GPIO_PULLUP +PB13.GPIO_Label=FS_PIN_EB0 +PB13.GPIO_PuPd=GPIO_PULLDOWN PB13.Locked=true PB13.Signal=GPIO_Input PB14.GPIOParameters=GPIO_PuPd,GPIO_Label @@ -200,8 +217,8 @@ PB14.GPIO_PuPd=GPIO_PULLUP PB14.Locked=true PB14.Signal=GPIO_Input PB15.GPIOParameters=GPIO_PuPd,GPIO_Label -PB15.GPIO_Label=BUTTON_EB2 -PB15.GPIO_PuPd=GPIO_PULLUP +PB15.GPIO_Label=FS_PIN_EB2 +PB15.GPIO_PuPd=GPIO_PULLDOWN PB15.Locked=true PB15.Signal=GPIO_Input PB6.GPIOParameters=GPIO_Label @@ -212,13 +229,10 @@ PB7.GPIOParameters=GPIO_Label PB7.GPIO_Label=I2C_DISPLAY_SDA PB7.Mode=I2C PB7.Signal=I2C1_SDA -PB8.GPIOParameters=GPIO_Speed,PinState,GPIO_Label,GPIO_ModeDefaultOutputPP +PB8.GPIOParameters=GPIO_Label PB8.GPIO_Label=BUZZER -PB8.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_PP -PB8.GPIO_Speed=GPIO_SPEED_FREQ_MEDIUM PB8.Locked=true -PB8.PinState=GPIO_PIN_RESET -PB8.Signal=GPIO_Output +PB8.Signal=S_TIM4_CH3 PB9.GPIOParameters=GPIO_Speed,PinState,GPIO_Label PB9.GPIO_Label=LED_A PB9.GPIO_Speed=GPIO_SPEED_FREQ_MEDIUM @@ -250,7 +264,7 @@ ProjectManager.BackupPrevious=false ProjectManager.CompilerOptimize=2 ProjectManager.ComputerToolchain=false ProjectManager.CoupleFile=true -ProjectManager.CustomerFirmwarePackage= +ProjectManager.CustomerFirmwarePackage=C\:/Users/PDabrowski.GPXR-PDABROWS/STM32Cube/Repository/STM32Cube_FW_F1_V1.4.0 ProjectManager.DefaultFWLocation=true ProjectManager.DeletePrevious=true ProjectManager.DeviceId=STM32F103C8Tx @@ -268,8 +282,8 @@ ProjectManager.ProjectName=PRO58 ProjectManager.StackSize=0x400 ProjectManager.TargetToolchain=SW4STM32 ProjectManager.ToolChainLocation= -ProjectManager.UnderRoot=false -ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL,2-MX_DMA_Init-DMA-false-HAL,3-MX_ADC1_Init-ADC1-false-HAL,4-MX_I2C1_Init-I2C1-false-HAL,5-MX_I2C2_Init-I2C2-false-HAL,6-MX_USART1_UART_Init-USART1-false-HAL,7-SystemClock_Config-RCC-false-HAL +ProjectManager.UnderRoot=true +ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL,2-MX_DMA_Init-DMA-false-HAL,3-MX_ADC1_Init-ADC1-false-HAL,4-MX_I2C1_Init-I2C1-false-HAL,5-MX_I2C2_Init-I2C2-false-HAL,6-MX_USART1_UART_Init-USART1-false-HAL,7-SystemClock_Config-RCC-false-HAL,8-MX_TIM4_Init-TIM4-false-HAL,9-MX_TIM3_Init-TIM3-false-HAL RCC.ADCFreqValue=12000000 RCC.ADCPresc=RCC_ADCPCLK2_DIV6 RCC.AHBFreq_Value=72000000 @@ -296,8 +310,21 @@ SH.ADCx_IN0.0=ADC1_IN0,IN0 SH.ADCx_IN0.ConfNb=1 SH.ADCx_IN1.0=ADC1_IN1,IN1 SH.ADCx_IN1.ConfNb=1 +SH.S_TIM4_CH3.0=TIM4_CH3,PWM Generation3 CH3 +SH.S_TIM4_CH3.ConfNb=1 +TIM3.IPParameters=Prescaler,Period +TIM3.Period=180 +TIM3.Prescaler=999 +TIM4.Channel-PWM\ Generation3\ CH3=TIM_CHANNEL_3 +TIM4.IPParameters=Channel-PWM Generation3 CH3,Period,Prescaler +TIM4.Period=99 +TIM4.Prescaler=1637 USART1.IPParameters=VirtualMode USART1.VirtualMode=VM_ASYNC VP_SYS_VS_Systick.Mode=SysTick VP_SYS_VS_Systick.Signal=SYS_VS_Systick +VP_TIM3_VS_ClockSourceINT.Mode=Internal +VP_TIM3_VS_ClockSourceINT.Signal=TIM3_VS_ClockSourceINT +VP_TIM4_VS_ClockSourceINT.Mode=Internal +VP_TIM4_VS_ClockSourceINT.Signal=TIM4_VS_ClockSourceINT board=PRO58 diff --git a/PRO58/SW4STM32/PRO58/PRO58.xml b/PRO58/PRO58.xml similarity index 100% rename from PRO58/SW4STM32/PRO58/PRO58.xml rename to PRO58/PRO58.xml diff --git a/PRO58/SW4STM32/PRO58/PRO58 Run.cfg b/PRO58/PRO58Pub Debug.cfg similarity index 100% rename from PRO58/SW4STM32/PRO58/PRO58 Run.cfg rename to PRO58/PRO58Pub Debug.cfg diff --git a/PRO58/SW4STM32/PRO58/PRO58Pub PublicRelease.cfg b/PRO58/PRO58Pub Run.cfg similarity index 100% rename from PRO58/SW4STM32/PRO58/PRO58Pub PublicRelease.cfg rename to PRO58/PRO58Pub Run.cfg diff --git a/PRO58/SW4STM32/PRO58/STM32F103C8Tx_FLASH.ld b/PRO58/STM32F103C8Tx_FLASH.ld similarity index 70% rename from PRO58/SW4STM32/PRO58/STM32F103C8Tx_FLASH.ld rename to PRO58/STM32F103C8Tx_FLASH.ld index 37cf590..55d753a 100644 --- a/PRO58/SW4STM32/PRO58/STM32F103C8Tx_FLASH.ld +++ b/PRO58/STM32F103C8Tx_FLASH.ld @@ -18,32 +18,13 @@ ** Distribution: The file is distributed as is, without any warranty ** of any kind. ** -***************************************************************************** -** @attention -** -**

© COPYRIGHT(c) 2014 Ac6

-** -** Redistribution and use in source and binary forms, with or without modification, -** are permitted provided that the following conditions are met: -** 1. Redistributions of source code must retain the above copyright notice, -** this list of conditions and the following disclaimer. -** 2. Redistributions in binary form must reproduce the above copyright notice, -** this list of conditions and the following disclaimer in the documentation -** and/or other materials provided with the distribution. -** 3. Neither the name of Ac6 nor the names of its contributors -** may be used to endorse or promote products derived from this software -** without specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +** (c)Copyright Ac6. +** You may use this file as-is or modify it according to the needs of your +** project. Distribution of this file (unmodified or modified) is not +** permitted. Ac6 permit registered System Workbench for MCU users the +** rights to distribute the assembled, compiled & linked contents of this +** file as part of an application binary file, provided that it is built +** using the System Workbench for MCU toolchain. ** ***************************************************************************** */ diff --git a/PRO58/SW4STM32/PRO58/.cproject b/PRO58/SW4STM32/PRO58/.cproject deleted file mode 100644 index a54f746..0000000 --- a/PRO58/SW4STM32/PRO58/.cproject +++ /dev/null @@ -1,582 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/PRO58/SW4STM32/PRO58/.gitignore b/PRO58/SW4STM32/PRO58/.gitignore deleted file mode 100644 index 89f2bbe..0000000 --- a/PRO58/SW4STM32/PRO58/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/Debug/ -/Nucleo/ -/Release/ -/PublicRelease/ -/PublicNucleo/ diff --git a/PRO58/SW4STM32/PRO58/.project b/PRO58/SW4STM32/PRO58/.project deleted file mode 100644 index ae2ad11..0000000 --- a/PRO58/SW4STM32/PRO58/.project +++ /dev/null @@ -1,325 +0,0 @@ - - - PRO58Pub - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - fr.ac6.mcu.ide.core.MCUProjectNature - org.eclipse.cdt.core.ccnature - - - - Application/SW4STM32/startup_stm32f103xb.s - 1 - copy_PARENT/startup_stm32f103xb.s - - - Application/User/Adafruit_GFX_AS.cpp - 1 - copy_PARENT1/Src/Adafruit_GFX_AS.cpp - - - Application/User/Adafruit_SSD1306_STM32.cpp - 1 - copy_PARENT1/Src/Adafruit_SSD1306_STM32.cpp - - - Application/User/DWT_Delay.c - 1 - copy_PARENT1/Src/DWT_Delay.c - - - Application/User/Eeprom24C01_02.cpp - 1 - copy_PARENT1/Src/Eeprom24C01_02.cpp - - - Application/User/Print.cpp - 1 - copy_PARENT1/Src/Print.cpp - - - Application/User/adc.c - 1 - copy_PARENT1/Src/adc.c - - - Application/User/beeper.cpp - 1 - PARENT-2-PROJECT_LOC/Src/beeper.cpp - - - Application/User/buttons.cpp - 1 - copy_PARENT1/Src/buttons.cpp - - - Application/User/channels.cpp - 1 - copy_PARENT1/Src/channels.cpp - - - Application/User/dma.c - 1 - copy_PARENT1/Src/dma.c - - - Application/User/fatshark_pins.cpp - 1 - PARENT-2-PROJECT_LOC/Src/fatshark_pins.cpp - - - Application/User/glcdfont.c - 1 - copy_PARENT1/Src/glcdfont.c - - - Application/User/gpio.c - 1 - copy_PARENT1/Src/gpio.c - - - Application/User/i2c.c - 1 - copy_PARENT1/Src/i2c.c - - - Application/User/i2c_reset.c - 1 - copy_PARENT1/Src/i2c_reset.c - - - Application/User/main.cpp - 1 - copy_PARENT1/Src/main.cpp - - - Application/User/receiver.cpp - 1 - copy_PARENT1/Src/receiver.cpp - - - Application/User/receiver_spi.cpp - 1 - copy_PARENT1/Src/receiver_spi.cpp - - - Application/User/settings_eeprom.cpp - 1 - copy_PARENT1/Src/settings_eeprom.cpp - - - Application/User/state.cpp - 1 - copy_PARENT1/Src/state.cpp - - - Application/User/state_bandscan.cpp - 1 - copy_PARENT1/Src/state_bandscan.cpp - - - Application/User/state_menu.cpp - 1 - copy_PARENT1/Src/state_menu.cpp - - - Application/User/state_menu_ui.cpp - 1 - copy_PARENT1/Src/state_menu_ui.cpp - - - Application/User/state_screensaver.cpp - 1 - copy_PARENT1/Src/state_screensaver.cpp - - - Application/User/state_search.cpp - 1 - copy_PARENT1/Src/state_search.cpp - - - Application/User/state_search_ui.cpp - 1 - copy_PARENT1/Src/state_search_ui.cpp - - - Application/User/state_settings.cpp - 1 - copy_PARENT1/Src/state_settings.cpp - - - Application/User/state_settings_callsign.cpp - 1 - copy_PARENT1/Src/state_settings_callsign.cpp - - - Application/User/state_settings_diversity_mode.cpp - 1 - copy_PARENT1/Src/state_settings_diversity_mode.cpp - - - Application/User/state_settings_rssi.cpp - 1 - copy_PARENT1/Src/state_settings_rssi.cpp - - - Application/User/state_settings_ui.cpp - 1 - copy_PARENT1/Src/state_settings_ui.cpp - - - Application/User/stm32f1xx_hal_msp.cpp - 1 - copy_PARENT1/Src/stm32f1xx_hal_msp.cpp - - - Application/User/stm32f1xx_it.cpp - 1 - copy_PARENT1/Src/stm32f1xx_it.cpp - - - Application/User/tim.c - 1 - PARENT-2-PROJECT_LOC/Src/tim.c - - - Application/User/timer.cpp - 1 - copy_PARENT1/Src/timer.cpp - - - Application/User/ui.cpp - 1 - copy_PARENT1/Src/ui.cpp - - - Application/User/ui_menu.cpp - 1 - copy_PARENT1/Src/ui_menu.cpp - - - Application/User/ui_state_menu.cpp - 1 - copy_PARENT1/Src/ui_state_menu.cpp - - - Application/User/usart.c - 1 - copy_PARENT1/Src/usart.c - - - Drivers/CMSIS/system_stm32f1xx.c - 1 - copy_PARENT1/Src/system_stm32f1xx.c - - - Drivers/STM32F1xx_HAL_Driver/stm32f1xx_hal.c - 1 - copy_PARENT1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c - - - Drivers/STM32F1xx_HAL_Driver/stm32f1xx_hal_adc.c - 1 - copy_PARENT1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c - - - Drivers/STM32F1xx_HAL_Driver/stm32f1xx_hal_adc_ex.c - 1 - copy_PARENT1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c - - - Drivers/STM32F1xx_HAL_Driver/stm32f1xx_hal_cortex.c - 1 - copy_PARENT1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c - - - Drivers/STM32F1xx_HAL_Driver/stm32f1xx_hal_dma.c - 1 - copy_PARENT1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c - - - Drivers/STM32F1xx_HAL_Driver/stm32f1xx_hal_flash.c - 1 - copy_PARENT1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c - - - Drivers/STM32F1xx_HAL_Driver/stm32f1xx_hal_flash_ex.c - 1 - copy_PARENT1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c - - - Drivers/STM32F1xx_HAL_Driver/stm32f1xx_hal_gpio.c - 1 - copy_PARENT1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c - - - Drivers/STM32F1xx_HAL_Driver/stm32f1xx_hal_gpio_ex.c - 1 - copy_PARENT1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c - - - Drivers/STM32F1xx_HAL_Driver/stm32f1xx_hal_i2c.c - 1 - copy_PARENT1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c - - - Drivers/STM32F1xx_HAL_Driver/stm32f1xx_hal_pwr.c - 1 - copy_PARENT1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c - - - Drivers/STM32F1xx_HAL_Driver/stm32f1xx_hal_rcc.c - 1 - copy_PARENT1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c - - - Drivers/STM32F1xx_HAL_Driver/stm32f1xx_hal_rcc_ex.c - 1 - copy_PARENT1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c - - - Drivers/STM32F1xx_HAL_Driver/stm32f1xx_hal_tim.c - 1 - copy_PARENT1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c - - - Drivers/STM32F1xx_HAL_Driver/stm32f1xx_hal_tim_ex.c - 1 - copy_PARENT1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c - - - Drivers/STM32F1xx_HAL_Driver/stm32f1xx_hal_uart.c - 1 - copy_PARENT1/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c - - - - - copy_PARENT - $%7BPARENT-3-PROJECT_LOC%7D/PRO58/SW4STM32 - - - copy_PARENT1 - $%7BPARENT-3-PROJECT_LOC%7D/PRO58 - - - diff --git a/PRO58/SW4STM32/PRO58/.settings/language.settings.xml b/PRO58/SW4STM32/PRO58/.settings/language.settings.xml deleted file mode 100644 index 4a55074..0000000 --- a/PRO58/SW4STM32/PRO58/.settings/language.settings.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/PRO58/SW4STM32/PRO58/.settings/org.eclipse.cdt.core.prefs b/PRO58/SW4STM32/PRO58/.settings/org.eclipse.cdt.core.prefs deleted file mode 100644 index c1138ab..0000000 --- a/PRO58/SW4STM32/PRO58/.settings/org.eclipse.cdt.core.prefs +++ /dev/null @@ -1,3 +0,0 @@ -eclipse.preferences.version=1 -environment/project/fr.ac6.managedbuild.config.gnu.cross.exe.debug.2025156518.1962288373/append=true -environment/project/fr.ac6.managedbuild.config.gnu.cross.exe.debug.2025156518.1962288373/appendContributed=true diff --git a/PRO58/SW4STM32/PRO58/NUCLEO-F103RB.xml b/PRO58/SW4STM32/PRO58/NUCLEO-F103RB.xml deleted file mode 100644 index 53f7ce5..0000000 --- a/PRO58/SW4STM32/PRO58/NUCLEO-F103RB.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - -]> - - - - NUCLEO-F103RB - JTAG - SWD - ST-Link - stm32f103rbtx - - diff --git a/PRO58/SW4STM32/PRO58/PRO58 Nucleo.cfg b/PRO58/SW4STM32/PRO58/PRO58 Nucleo.cfg deleted file mode 100644 index 40bb31b..0000000 --- a/PRO58/SW4STM32/PRO58/PRO58 Nucleo.cfg +++ /dev/null @@ -1,28 +0,0 @@ -# This is an PRO58 board with a single STM32F103C8Tx chip -# -# Generated by System Workbench for STM32 -# Take care that such file, as generated, may be overridden without any early notice. Please have a look to debug launch configuration setup(s) - -source [find interface/stlink.cfg] - -set WORKAREASIZE 0x5000 - -transport select "hla_swd" - -set CHIPNAME STM32F103C8Tx - -# Enable debug when in low power modes -set ENABLE_LOW_POWER 1 - -# Stop Watchdog counters when halt -set STOP_WATCHDOG 1 - -# STlink Debug clock frequency -set CLOCK_FREQ 4000 - -# use hardware reset, connect under reset -# connect_assert_srst needed if low power mode application running (WFI...) -reset_config srst_only srst_nogate connect_assert_srst -set CONNECT_UNDER_RESET 1 - -source [find target/stm32f1x.cfg] diff --git a/PRO58/SW4STM32/PRO58/PRO58 PublicRelease.cfg b/PRO58/SW4STM32/PRO58/PRO58 PublicRelease.cfg deleted file mode 100644 index 40bb31b..0000000 --- a/PRO58/SW4STM32/PRO58/PRO58 PublicRelease.cfg +++ /dev/null @@ -1,28 +0,0 @@ -# This is an PRO58 board with a single STM32F103C8Tx chip -# -# Generated by System Workbench for STM32 -# Take care that such file, as generated, may be overridden without any early notice. Please have a look to debug launch configuration setup(s) - -source [find interface/stlink.cfg] - -set WORKAREASIZE 0x5000 - -transport select "hla_swd" - -set CHIPNAME STM32F103C8Tx - -# Enable debug when in low power modes -set ENABLE_LOW_POWER 1 - -# Stop Watchdog counters when halt -set STOP_WATCHDOG 1 - -# STlink Debug clock frequency -set CLOCK_FREQ 4000 - -# use hardware reset, connect under reset -# connect_assert_srst needed if low power mode application running (WFI...) -reset_config srst_only srst_nogate connect_assert_srst -set CONNECT_UNDER_RESET 1 - -source [find target/stm32f1x.cfg] diff --git a/PRO58/Src/adc.c b/PRO58/Src/adc.c index 799b907..347b2d4 100644 --- a/PRO58/Src/adc.c +++ b/PRO58/Src/adc.c @@ -73,7 +73,7 @@ void MX_ADC1_Init(void) */ sConfig.Channel = ADC_CHANNEL_0; sConfig.Rank = 1; - sConfig.SamplingTime = ADC_SAMPLETIME_28CYCLES_5; + sConfig.SamplingTime = ADC_SAMPLETIME_239CYCLES_5; if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK) { _Error_Handler(__FILE__, __LINE__); diff --git a/PRO58/Src/dma.c b/PRO58/Src/dma.c index 11f99ef..10d01e4 100644 --- a/PRO58/Src/dma.c +++ b/PRO58/Src/dma.c @@ -72,6 +72,9 @@ void MX_DMA_Init(void) /* DMA1_Channel6_IRQn interrupt configuration */ HAL_NVIC_SetPriority(DMA1_Channel6_IRQn, 0, 0); HAL_NVIC_EnableIRQ(DMA1_Channel6_IRQn); + /* DMA1_Channel7_IRQn interrupt configuration */ + HAL_NVIC_SetPriority(DMA1_Channel7_IRQn, 0, 0); + HAL_NVIC_EnableIRQ(DMA1_Channel7_IRQn); } diff --git a/PRO58/Src/i2c.c b/PRO58/Src/i2c.c index 7ee4d69..0319428 100644 --- a/PRO58/Src/i2c.c +++ b/PRO58/Src/i2c.c @@ -50,6 +50,7 @@ I2C_HandleTypeDef hi2c1; I2C_HandleTypeDef hi2c2; DMA_HandleTypeDef hdma_i2c1_tx; +DMA_HandleTypeDef hdma_i2c1_rx; DMA_HandleTypeDef hdma_i2c2_tx; DMA_HandleTypeDef hdma_i2c2_rx; @@ -131,6 +132,22 @@ void HAL_I2C_MspInit(I2C_HandleTypeDef* i2cHandle) __HAL_LINKDMA(i2cHandle,hdmatx,hdma_i2c1_tx); + /* I2C1_RX Init */ + hdma_i2c1_rx.Instance = DMA1_Channel7; + hdma_i2c1_rx.Init.Direction = DMA_PERIPH_TO_MEMORY; + hdma_i2c1_rx.Init.PeriphInc = DMA_PINC_DISABLE; + hdma_i2c1_rx.Init.MemInc = DMA_MINC_ENABLE; + hdma_i2c1_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE; + hdma_i2c1_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE; + hdma_i2c1_rx.Init.Mode = DMA_NORMAL; + hdma_i2c1_rx.Init.Priority = DMA_PRIORITY_MEDIUM; + if (HAL_DMA_Init(&hdma_i2c1_rx) != HAL_OK) + { + _Error_Handler(__FILE__, __LINE__); + } + + __HAL_LINKDMA(i2cHandle,hdmarx,hdma_i2c1_rx); + /* USER CODE BEGIN I2C1_MspInit 1 */ /* USER CODE END I2C1_MspInit 1 */ @@ -211,6 +228,7 @@ void HAL_I2C_MspDeInit(I2C_HandleTypeDef* i2cHandle) /* I2C1 DMA DeInit */ HAL_DMA_DeInit(i2cHandle->hdmatx); + HAL_DMA_DeInit(i2cHandle->hdmarx); /* USER CODE BEGIN I2C1_MspDeInit 1 */ /* USER CODE END I2C1_MspDeInit 1 */ diff --git a/PRO58/Src/main.cpp b/PRO58/Src/main.cpp index d444690..8fa918c 100644 --- a/PRO58/Src/main.cpp +++ b/PRO58/Src/main.cpp @@ -3,6 +3,11 @@ * File Name : main.c * Description : Main program body ****************************************************************************** + ** This notice applies to any and all portions of this file + * that are not between comment pairs USER CODE BEGIN and + * USER CODE END. Other portions of this file, whether + * inserted by the user or by software development tools + * are owned by their respective copyright owners. * * COPYRIGHT(c) 2017 STMicroelectronics * @@ -30,6 +35,7 @@ * ****************************************************************************** */ + /* Includes ------------------------------------------------------------------*/ #include "main.h" #include "stm32f1xx_hal.h" @@ -41,7 +47,6 @@ #include "gpio.h" /* USER CODE BEGIN Includes */ - #include "settings_eeprom.h" #include "channels.h" @@ -60,7 +65,6 @@ #include "logo.h" #include "fatshark_pins.h" - /* USER CODE END Includes */ /* Private variables ---------------------------------------------------------*/ @@ -116,74 +120,73 @@ int main(void) MX_I2C2_Init(); MX_USART1_UART_Init(); MX_TIM4_Init(); + MX_TIM3_Init(); /* USER CODE BEGIN 2 */ - if(DWT_Delay_Init()){ - _Error_Handler(__FILE__,__LINE__); /* Call Error Handler */ - } - - HAL_GPIO_WritePin(RECEIVER_SW_GPIO_Port,RECEIVER_SW_Pin,GPIO_PIN_RESET); - HAL_GPIO_WritePin(SPI_SLAVE_SELECT_A_GPIO_Port,SPI_SLAVE_SELECT_A_Pin,GPIO_PIN_SET); - HAL_GPIO_WritePin(SPI_SLAVE_SELECT_B_GPIO_Port,SPI_SLAVE_SELECT_B_Pin,GPIO_PIN_SET); - HAL_GPIO_WritePin(SPI_CLOCK_GPIO_Port,SPI_CLOCK_Pin,GPIO_PIN_RESET); - HAL_GPIO_WritePin(SPI_DATA_GPIO_Port,SPI_DATA_Pin,GPIO_PIN_RESET); - - HAL_Delay(100); //Delay 1000ms to allow RX5808 startup. - - I2C_Reset(hi2c1, MX_I2C1_Init); - Ui::setup(&hi2c1); - - Ui::display.drawBitmap( - 0, - 0, - logo, - SCREEN_WIDTH, - SCREEN_HEIGHT, - WHITE - ); - Ui::display.display(); - - Beeper::init(); - Beeper::beepC(200); //welcome beeep ;) - while(Beeper::beeping){ - Beeper::update(); - } - Beeper::beepE(200); //welcome beeep ;) - while(Beeper::beeping){ - Beeper::update(); - } - Beeper::beepG(200); //welcome beeep ;) - while(Beeper::beeping){ - Beeper::update(); - } - HAL_Delay(200); - Beeper::beepE(200); //welcome beeep ;) - while(Beeper::beeping){ - Beeper::update(); - } - Beeper::beepG(400); //welcome beeep ;) - while(Beeper::beeping){ - Beeper::update(); - } - - HAL_Delay(200); - I2C_Reset(hi2c2, MX_I2C2_Init); - EepromSettings.init(&hi2c2); - EepromSettings.load(); - Receiver::setup(&hadc1); - Receiver::setChannel(EepromSettings.startChannel); - - FatSharkPins::init(); - - StateMachine::setup(); - - Receiver::setActiveReceiver(Receiver::ReceiverId::A); - - Buttons::registerChangeFunc(globalMenuButtonHandler); - // Switch to initial state. - StateMachine::switchState(StateMachine::State::SEARCH); - + _Error_Handler(__FILE__,__LINE__); /* Call Error Handler */ + } + + HAL_GPIO_WritePin(RECEIVER_SW_GPIO_Port,RECEIVER_SW_Pin,GPIO_PIN_RESET); + HAL_GPIO_WritePin(SPI_SLAVE_SELECT_A_GPIO_Port,SPI_SLAVE_SELECT_A_Pin,GPIO_PIN_SET); + HAL_GPIO_WritePin(SPI_SLAVE_SELECT_B_GPIO_Port,SPI_SLAVE_SELECT_B_Pin,GPIO_PIN_SET); + HAL_GPIO_WritePin(SPI_CLOCK_GPIO_Port,SPI_CLOCK_Pin,GPIO_PIN_RESET); + HAL_GPIO_WritePin(SPI_DATA_GPIO_Port,SPI_DATA_Pin,GPIO_PIN_RESET); + + HAL_Delay(100); //Delay 1000ms to allow RX5808 startup. + + I2C_Reset(hi2c1, MX_I2C1_Init); + Ui::setup(&hi2c1); + + Ui::display.drawBitmap( + 0, + 0, + logo, + SCREEN_WIDTH, + SCREEN_HEIGHT, + WHITE + ); + Ui::display.display(); + + Beeper::init(); + Beeper::beepC(200); //welcome beeep ;) + while(Beeper::beeping){ + Beeper::update(); + } + Beeper::beepE(200); //welcome beeep ;) + while(Beeper::beeping){ + Beeper::update(); + } + Beeper::beepG(200); //welcome beeep ;) + while(Beeper::beeping){ + Beeper::update(); + } + HAL_Delay(200); + Beeper::beepE(200); //welcome beeep ;) + while(Beeper::beeping){ + Beeper::update(); + } + Beeper::beepG(400); //welcome beeep ;) + while(Beeper::beeping){ + Beeper::update(); + } + + HAL_Delay(200); + I2C_Reset(hi2c2, MX_I2C2_Init); + EepromSettings.init(&hi2c2); + EepromSettings.load(); + Receiver::setup(&hadc1); + Receiver::setChannel(EepromSettings.startChannel); + + FatSharkPins::init(); + + StateMachine::setup(); + + Receiver::setActiveReceiver(Receiver::ReceiverId::A); + + Buttons::registerChangeFunc(globalMenuButtonHandler); + // Switch to initial state. + StateMachine::switchState(StateMachine::State::SEARCH); /* USER CODE END 2 */ /* Infinite loop */ @@ -191,24 +194,23 @@ int main(void) while (1) { Beeper::update(); - Receiver::update(); - Buttons::update(); - FatSharkPins::update(); - StateMachine::update(); - Ui::update(); - EepromSettings.update(); - - if ( -// StateMachine::currentState != StateMachine::State::SCREENSAVER -// && StateMachine::currentState != StateMachine::State::BANDSCAN -// && StateMachine::currentState != StateMachine::State::SETTINGS_RSSI - StateMachine::currentState == StateMachine::State::SEARCH - && (HAL_GetTick() - Buttons::lastChangeTime) > - (SCREENSAVER_TIMEOUT * 1000) - ) { - StateMachine::switchState(StateMachine::State::SCREENSAVER); - } - + Receiver::update(); + Buttons::update(); + FatSharkPins::update(); + StateMachine::update(); + Ui::update(); + EepromSettings.update(); + + if ( + // StateMachine::currentState != StateMachine::State::SCREENSAVER + // && StateMachine::currentState != StateMachine::State::BANDSCAN + // && StateMachine::currentState != StateMachine::State::SETTINGS_RSSI + StateMachine::currentState == StateMachine::State::SEARCH + && (HAL_GetTick() - Buttons::lastChangeTime) > + (SCREENSAVER_TIMEOUT * 1000) + ) { + StateMachine::switchState(StateMachine::State::SCREENSAVER); + } /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ @@ -227,7 +229,7 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct; RCC_PeriphCLKInitTypeDef PeriphClkInit; - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -241,7 +243,7 @@ void SystemClock_Config(void) _Error_Handler(__FILE__, __LINE__); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; @@ -262,11 +264,11 @@ void SystemClock_Config(void) _Error_Handler(__FILE__, __LINE__); } - /**Configure the Systick interrupt time + /**Configure the Systick interrupt time */ HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000); - /**Configure the Systick + /**Configure the Systick */ HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK); @@ -288,11 +290,11 @@ static void globalMenuButtonHandler( } } -/* USER CODE END 4 */ - #ifdef __cplusplus extern "C" { #endif +/* USER CODE END 4 */ + /** * @brief This function is executed in case of error occurrence. * @param None @@ -305,9 +307,13 @@ void _Error_Handler(const char * file, int line) while(1) { } - /* USER CODE END Error_Handler_Debug */ + /* USER CODE END Error_Handler_Debug */ } +#ifdef __cplusplus + } +#endif + #ifdef USE_FULL_ASSERT /** @@ -328,10 +334,6 @@ void assert_failed(uint8_t* file, uint32_t line) #endif -#ifdef __cplusplus - } -#endif - /** * @} */ diff --git a/PRO58/Src/state_settings.cpp b/PRO58/Src/state_settings.cpp index 5a43ed1..e50ec84 100644 --- a/PRO58/Src/state_settings.cpp +++ b/PRO58/Src/state_settings.cpp @@ -39,39 +39,16 @@ static const unsigned char exitIcon [] = { 0x03, 0x00, 0x3F, 0x40, 0x03, 0x00, 0x3F, 0x40, 0x03, 0x00, 0x3F, 0x40, 0x03, 0x7F, 0xBF, 0x40, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + static const unsigned char callsignIcon [] = { - 0x00,0x3f,0xfc,0x00, - 0x01,0xff,0xff,0x80, - 0x03,0xe0,0x0f,0xc0, - 0x07,0x80,0x03,0xe0, - 0x0f,0x80,0x01,0xf0, - 0x0f,0x00,0x00,0xf0, - 0x0f,0x00,0x00,0xf0, - 0x0f,0x80,0x01,0xf0, - 0x07,0xc0,0x03,0xe0, - 0x01,0xfc,0x3f,0x80, - 0x00,0x7f,0xfe,0x00, - 0x00,0x0f,0xf0,0x00, - 0x1f,0xff,0xff,0xf8, - 0x7f,0xff,0xff,0xfe, - 0xf8,0x00,0x00,0x1e, - 0xf0,0x00,0x00,0x0e, - 0xf0,0x00,0x00,0x0e, - 0xf0,0x00,0x00,0x0e, - 0xf0,0xf0,0x0f,0x0e, - 0xf0,0xf0,0x0f,0x0e, - 0xf0,0xf0,0x0f,0x0e, - 0x7c,0xf0,0x0f,0x3e, - 0x3f,0xf0,0x0f,0xfc, - 0x07,0xf0,0x0f,0xe0, - 0x00,0xf0,0x0f,0x00, - 0x00,0xf0,0x0f,0x00, - 0x00,0xf0,0x0f,0x00, - 0x00,0xf0,0x0f,0x00, - 0x00,0xf0,0x0f,0x00, - 0x00,0xf0,0x0f,0x00, - 0x00,0xff,0xff,0x00, - 0x00,0xff,0xff,0x00 + 0x00, 0x3F, 0xFC, 0x00, 0x01, 0xFF, 0xFF, 0x80, 0x03, 0xE0, 0x0F, 0xC0, 0x07, 0x80, 0x03, 0xE0, + 0x0F, 0x80, 0x01, 0xF0, 0x0F, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, 0xF0, 0x0F, 0x80, 0x01, 0xF0, + 0x07, 0xC0, 0x03, 0xE0, 0x01, 0xFC, 0x3F, 0x80, 0x00, 0x7F, 0xFE, 0x00, 0x00, 0x0F, 0xF0, 0x00, + 0x1F, 0xFF, 0xFF, 0xF8, 0x7F, 0xFF, 0xFF, 0xFE, 0xF8, 0x00, 0x00, 0x1E, 0xF0, 0x00, 0x00, 0x0E, + 0xF0, 0x00, 0x00, 0x0E, 0xF0, 0x00, 0x00, 0x0E, 0xF0, 0xF0, 0x0F, 0x0E, 0xF0, 0xF0, 0x0F, 0x0E, + 0xF0, 0xF0, 0x0F, 0x0E, 0x7C, 0xF0, 0x0F, 0x3E, 0x3F, 0xF0, 0x0F, 0xFC, 0x07, 0xF0, 0x0F, 0xE0, + 0x00, 0xF0, 0x0F, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, 0xF0, 0x0F, 0x00, + 0x00, 0xF0, 0x0F, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00 }; static void diveristyModeMenuHandler(); diff --git a/PRO58/Src/stm32f1xx_it.cpp b/PRO58/Src/stm32f1xx_it.cpp index 7c4e2e5..96a9b50 100644 --- a/PRO58/Src/stm32f1xx_it.cpp +++ b/PRO58/Src/stm32f1xx_it.cpp @@ -42,8 +42,10 @@ /* External variables --------------------------------------------------------*/ extern DMA_HandleTypeDef hdma_adc1; extern DMA_HandleTypeDef hdma_i2c1_tx; +extern DMA_HandleTypeDef hdma_i2c1_rx; extern DMA_HandleTypeDef hdma_i2c2_tx; extern DMA_HandleTypeDef hdma_i2c2_rx; +extern TIM_HandleTypeDef htim3; /******************************************************************************/ /* Cortex-M3 Processor Interruption and Exception Handlers */ @@ -243,6 +245,34 @@ void DMA1_Channel6_IRQHandler(void) /* USER CODE END DMA1_Channel6_IRQn 1 */ } +/** +* @brief This function handles DMA1 channel7 global interrupt. +*/ +void DMA1_Channel7_IRQHandler(void) +{ + /* USER CODE BEGIN DMA1_Channel7_IRQn 0 */ + + /* USER CODE END DMA1_Channel7_IRQn 0 */ + HAL_DMA_IRQHandler(&hdma_i2c1_rx); + /* USER CODE BEGIN DMA1_Channel7_IRQn 1 */ + + /* USER CODE END DMA1_Channel7_IRQn 1 */ +} + +/** +* @brief This function handles TIM3 global interrupt. +*/ +void TIM3_IRQHandler(void) +{ + /* USER CODE BEGIN TIM3_IRQn 0 */ + + /* USER CODE END TIM3_IRQn 0 */ + HAL_TIM_IRQHandler(&htim3); + /* USER CODE BEGIN TIM3_IRQn 1 */ + + /* USER CODE END TIM3_IRQn 1 */ +} + /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ diff --git a/PRO58/Src/tim.c b/PRO58/Src/tim.c index de1dec7..60b0403 100644 --- a/PRO58/Src/tim.c +++ b/PRO58/Src/tim.c @@ -44,8 +44,40 @@ /* USER CODE END 0 */ +TIM_HandleTypeDef htim3; TIM_HandleTypeDef htim4; +/* TIM3 init function */ +void MX_TIM3_Init(void) +{ + TIM_ClockConfigTypeDef sClockSourceConfig; + TIM_MasterConfigTypeDef sMasterConfig; + + htim3.Instance = TIM3; + htim3.Init.Prescaler = 999; + htim3.Init.CounterMode = TIM_COUNTERMODE_UP; + htim3.Init.Period = 180; + htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; +// htim3.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; + if (HAL_TIM_Base_Init(&htim3) != HAL_OK) + { + _Error_Handler(__FILE__, __LINE__); + } + + sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL; + if (HAL_TIM_ConfigClockSource(&htim3, &sClockSourceConfig) != HAL_OK) + { + _Error_Handler(__FILE__, __LINE__); + } + + sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET; + sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE; + if (HAL_TIMEx_MasterConfigSynchronization(&htim3, &sMasterConfig) != HAL_OK) + { + _Error_Handler(__FILE__, __LINE__); + } + +} /* TIM4 init function */ void MX_TIM4_Init(void) { @@ -98,7 +130,22 @@ void MX_TIM4_Init(void) void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle) { - if(tim_baseHandle->Instance==TIM4) + if(tim_baseHandle->Instance==TIM3) + { + /* USER CODE BEGIN TIM3_MspInit 0 */ + + /* USER CODE END TIM3_MspInit 0 */ + /* TIM3 clock enable */ + __HAL_RCC_TIM3_CLK_ENABLE(); + + /* TIM3 interrupt Init */ + HAL_NVIC_SetPriority(TIM3_IRQn, 0, 0); + HAL_NVIC_EnableIRQ(TIM3_IRQn); + /* USER CODE BEGIN TIM3_MspInit 1 */ + + /* USER CODE END TIM3_MspInit 1 */ + } + else if(tim_baseHandle->Instance==TIM4) { /* USER CODE BEGIN TIM4_MspInit 0 */ @@ -138,7 +185,21 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* timHandle) void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* tim_baseHandle) { - if(tim_baseHandle->Instance==TIM4) + if(tim_baseHandle->Instance==TIM3) + { + /* USER CODE BEGIN TIM3_MspDeInit 0 */ + + /* USER CODE END TIM3_MspDeInit 0 */ + /* Peripheral clock disable */ + __HAL_RCC_TIM3_CLK_DISABLE(); + + /* TIM3 interrupt Deinit */ + HAL_NVIC_DisableIRQ(TIM3_IRQn); + /* USER CODE BEGIN TIM3_MspDeInit 1 */ + + /* USER CODE END TIM3_MspDeInit 1 */ + } + else if(tim_baseHandle->Instance==TIM4) { /* USER CODE BEGIN TIM4_MspDeInit 0 */ diff --git a/PRO58/mx.scratch b/PRO58/mx.scratch new file mode 100644 index 0000000..1543a53 --- /dev/null +++ b/PRO58/mx.scratch @@ -0,0 +1,87 @@ + + +.\PRO58 +..\Drivers\CMSIS + + +SW4STM32 +0 + + + + + + + + + + + + + + + + + PRO58 + STM32F103C8Tx + 0x200 + 0x400 + + custom + + true + swd + 6 + 1 + + + + + + + + + + + + __weak=__attribute__((weak)) + __packed=__attribute__((__packed__)) + + + + + + + USE_FULL_LL_DRIVER + MBEDTLS_CONFIG_FILE="mbedtls_config.h" + _TIMEVAL_DEFINED + _SYS_TIME_H_ + + + + + ..\Inc + ..\Drivers\STM32F1xx_HAL_Driver\Inc + ..\Drivers\STM32F1xx_HAL_Driver\Inc\Legacy + ..\Drivers\CMSIS\Device\ST\STM32F1xx\Include + ..\Drivers\CMSIS\Include + + + + + + true + false + + + Inc + + + Src + + + Drivers + + + + diff --git a/PRO58/SW4STM32/startup_stm32f103xb.s b/PRO58/startup/startup_stm32f103xb.s similarity index 100% rename from PRO58/SW4STM32/startup_stm32f103xb.s rename to PRO58/startup/startup_stm32f103xb.s