diff --git a/.mxproject b/.mxproject index 86a0d44..059088b 100644 --- a/.mxproject +++ b/.mxproject @@ -25,8 +25,6 @@ SourcePath#0=D:/Folders/Documents/STM32/Uberdevice/Core/Src SourcePath#1=C:/Users/And-STC/Documents/MDA/Uberdevice/USB_DEVICE/Target SourcePath#2=C:/Users/And-STC/Documents/MDA/Uberdevice/Core/Src SourceFiles#7=C:/Users/And-STC/Documents/MDA/Uberdevice/Core/Src/main.c -HeaderFiles=; -SourceFiles=; [PreviousLibFiles] LibFiles=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_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/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/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; diff --git a/Core/Inc/FreeRTOSConfig.h b/Core/Inc/FreeRTOSConfig.h index 8743294..6efff7d 100644 --- a/Core/Inc/FreeRTOSConfig.h +++ b/Core/Inc/FreeRTOSConfig.h @@ -73,7 +73,7 @@ #define configUSE_TICKLESS_IDLE 1 #define configUSE_IDLE_HOOK 0 #define configUSE_TICK_HOOK 0 -#define configCPU_CLOCK_HZ 24000000 +#define configCPU_CLOCK_HZ 48000000 #define configTICK_RATE_HZ ( ( TickType_t ) 1000 ) #define configMAX_PRIORITIES 5 #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 ) diff --git a/Core/Inc/stm32f1xx_hal_conf.h b/Core/Inc/stm32f1xx_hal_conf.h index c99e471..df6fa91 100644 --- a/Core/Inc/stm32f1xx_hal_conf.h +++ b/Core/Inc/stm32f1xx_hal_conf.h @@ -56,7 +56,7 @@ /*#define HAL_CORTEX_MODULE_ENABLED */ /*#define HAL_CRC_MODULE_ENABLED */ /*#define HAL_DAC_MODULE_ENABLED */ -#define HAL_DMA_MODULE_ENABLED +/*#define HAL_DMA_MODULE_ENABLED */ /*#define HAL_ETH_MODULE_ENABLED */ /*#define HAL_FLASH_MODULE_ENABLED */ #define HAL_GPIO_MODULE_ENABLED diff --git a/Core/Inc/stm32f1xx_it.h b/Core/Inc/stm32f1xx_it.h index 87558b4..de97341 100644 --- a/Core/Inc/stm32f1xx_it.h +++ b/Core/Inc/stm32f1xx_it.h @@ -56,8 +56,6 @@ void SVC_Handler(void); void DebugMon_Handler(void); void PendSV_Handler(void); void SysTick_Handler(void); -void DMA1_Channel4_IRQHandler(void); -void DMA1_Channel6_IRQHandler(void); void TIM4_IRQHandler(void); /* USER CODE BEGIN EFP */ diff --git a/Core/Src/lcd.c b/Core/Src/lcd.c index 5bd98fd..dd744b6 100644 --- a/Core/Src/lcd.c +++ b/Core/Src/lcd.c @@ -81,7 +81,7 @@ HAL_StatusTypeDef LCD_SendInternal(LCD_HandleTypeDef *lcd, uint8_t data, uint8_t res = HAL_I2C_Master_Transmit(lcd->I2C_Handle, lcd->address, data_arr, sizeof(data_arr), HAL_MAX_DELAY); - HAL_Delay(LCD_DELAY_MS); + vTaskDelay(LCD_DELAY_MS); return res; } diff --git a/Core/Src/main.c b/Core/Src/main.c index a214eb5..f3c6f18 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -63,13 +63,11 @@ typedef struct { /* Private variables ---------------------------------------------------------*/ I2C_HandleTypeDef hi2c1; -DMA_HandleTypeDef hdma_i2c1_tx; TIM_HandleTypeDef htim2; TIM_HandleTypeDef htim3; UART_HandleTypeDef huart1; -DMA_HandleTypeDef hdma_usart1_tx; /* USER CODE BEGIN PV */ @@ -125,7 +123,6 @@ extern uint32_t super_mario_len; /* Private function prototypes -----------------------------------------------*/ void SystemClock_Config(void); static void MX_GPIO_Init(void); -static void MX_DMA_Init(void); static void MX_I2C1_Init(void); static void MX_TIM2_Init(void); static void MX_TIM3_Init(void); @@ -168,13 +165,11 @@ int main(void) /* Initialize all configured peripherals */ MX_GPIO_Init(); - MX_DMA_Init(); MX_I2C1_Init(); MX_TIM2_Init(); MX_TIM3_Init(); MX_USART1_UART_Init(); /* USER CODE BEGIN 2 */ -// LCD_Init(&hlcd); InitGameEngine(); xTaskCreate(vTaskPlayerSetup, "Player", configMINIMAL_STACK_SIZE, NULL, 1, NULL); @@ -395,24 +390,6 @@ static void MX_USART1_UART_Init(void) } -/** - * Enable DMA controller clock - */ -static void MX_DMA_Init(void) -{ - /* DMA controller clock enable */ - __HAL_RCC_DMA1_CLK_ENABLE(); - - /* DMA interrupt init */ - /* DMA1_Channel4_IRQn interrupt configuration */ - HAL_NVIC_SetPriority(DMA1_Channel4_IRQn, 0, 0); - HAL_NVIC_EnableIRQ(DMA1_Channel4_IRQn); - /* DMA1_Channel6_IRQn interrupt configuration */ - HAL_NVIC_SetPriority(DMA1_Channel6_IRQn, 0, 0); - HAL_NVIC_EnableIRQ(DMA1_Channel6_IRQn); - -} - /** * @brief GPIO Initialization Function * @param None @@ -477,6 +454,7 @@ static void MX_GPIO_Init(void) void vTaskPlayerSetup(void *parameter) { + //LCD_Init(&hlcd); while (1) { if (plusButton->pressed) @@ -630,14 +608,15 @@ void vTaskButtonPoll(void *parameter) { for(int i = 0; ihdmatx); /* USER CODE BEGIN I2C1_MspDeInit 1 */ /* USER CODE END I2C1_MspDeInit 1 */ @@ -309,23 +286,6 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart) GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); - /* USART1 DMA Init */ - /* USART1_TX Init */ - hdma_usart1_tx.Instance = DMA1_Channel4; - hdma_usart1_tx.Init.Direction = DMA_MEMORY_TO_PERIPH; - hdma_usart1_tx.Init.PeriphInc = DMA_PINC_DISABLE; - hdma_usart1_tx.Init.MemInc = DMA_MINC_ENABLE; - hdma_usart1_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE; - hdma_usart1_tx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE; - hdma_usart1_tx.Init.Mode = DMA_NORMAL; - hdma_usart1_tx.Init.Priority = DMA_PRIORITY_LOW; - if (HAL_DMA_Init(&hdma_usart1_tx) != HAL_OK) - { - Error_Handler(); - } - - __HAL_LINKDMA(huart,hdmatx,hdma_usart1_tx); - /* USER CODE BEGIN USART1_MspInit 1 */ /* USER CODE END USART1_MspInit 1 */ @@ -355,8 +315,6 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart) */ HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9|GPIO_PIN_10); - /* USART1 DMA DeInit */ - HAL_DMA_DeInit(huart->hdmatx); /* USER CODE BEGIN USART1_MspDeInit 1 */ /* USER CODE END USART1_MspDeInit 1 */ diff --git a/Core/Src/stm32f1xx_it.c b/Core/Src/stm32f1xx_it.c index d2f8319..ec7b688 100644 --- a/Core/Src/stm32f1xx_it.c +++ b/Core/Src/stm32f1xx_it.c @@ -56,8 +56,6 @@ /* USER CODE END 0 */ /* External variables --------------------------------------------------------*/ -extern DMA_HandleTypeDef hdma_i2c1_tx; -extern DMA_HandleTypeDef hdma_usart1_tx; extern TIM_HandleTypeDef htim4; /* USER CODE BEGIN EV */ @@ -162,34 +160,6 @@ void DebugMon_Handler(void) /* please refer to the startup file (startup_stm32f1xx.s). */ /******************************************************************************/ -/** - * @brief This function handles DMA1 channel4 global interrupt. - */ -void DMA1_Channel4_IRQHandler(void) -{ - /* USER CODE BEGIN DMA1_Channel4_IRQn 0 */ - - /* USER CODE END DMA1_Channel4_IRQn 0 */ - HAL_DMA_IRQHandler(&hdma_usart1_tx); - /* USER CODE BEGIN DMA1_Channel4_IRQn 1 */ - - /* USER CODE END DMA1_Channel4_IRQn 1 */ -} - -/** - * @brief This function handles DMA1 channel6 global interrupt. - */ -void DMA1_Channel6_IRQHandler(void) -{ - /* USER CODE BEGIN DMA1_Channel6_IRQn 0 */ - - /* USER CODE END DMA1_Channel6_IRQn 0 */ - HAL_DMA_IRQHandler(&hdma_i2c1_tx); - /* USER CODE BEGIN DMA1_Channel6_IRQn 1 */ - - /* USER CODE END DMA1_Channel6_IRQn 1 */ -} - /** * @brief This function handles TIM4 global interrupt. */ diff --git a/Makefile b/Makefile index 6425ad0..0775186 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ ########################################################################################################################## -# File automatically-generated by tool: [projectgenerator] version: [3.3.0] date: [Wed Jul 10 23:08:22 MSK 2019] +# File automatically-generated by tool: [projectgenerator] version: [3.3.0] date: [Wed Jul 10 23:50:26 MSK 2019] ########################################################################################################################## # ------------------------------------------------ diff --git a/Uberdevice.ioc b/Uberdevice.ioc index e5f45c3..2605d35 100644 --- a/Uberdevice.ioc +++ b/Uberdevice.ioc @@ -1,37 +1,15 @@ #MicroXplorer Configuration settings - do not modify -Dma.I2C1_TX.0.Direction=DMA_MEMORY_TO_PERIPH -Dma.I2C1_TX.0.Instance=DMA1_Channel6 -Dma.I2C1_TX.0.MemDataAlignment=DMA_MDATAALIGN_BYTE -Dma.I2C1_TX.0.MemInc=DMA_MINC_ENABLE -Dma.I2C1_TX.0.Mode=DMA_NORMAL -Dma.I2C1_TX.0.PeriphDataAlignment=DMA_PDATAALIGN_BYTE -Dma.I2C1_TX.0.PeriphInc=DMA_PINC_DISABLE -Dma.I2C1_TX.0.Priority=DMA_PRIORITY_LOW -Dma.I2C1_TX.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority -Dma.Request0=I2C1_TX -Dma.Request1=USART1_TX -Dma.RequestsNb=2 -Dma.USART1_TX.1.Direction=DMA_MEMORY_TO_PERIPH -Dma.USART1_TX.1.Instance=DMA1_Channel4 -Dma.USART1_TX.1.MemDataAlignment=DMA_MDATAALIGN_BYTE -Dma.USART1_TX.1.MemInc=DMA_MINC_ENABLE -Dma.USART1_TX.1.Mode=DMA_NORMAL -Dma.USART1_TX.1.PeriphDataAlignment=DMA_PDATAALIGN_BYTE -Dma.USART1_TX.1.PeriphInc=DMA_PINC_DISABLE -Dma.USART1_TX.1.Priority=DMA_PRIORITY_LOW -Dma.USART1_TX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority File.Version=6 KeepUserPlacement=false Mcu.Family=STM32F1 -Mcu.IP0=DMA -Mcu.IP1=I2C1 -Mcu.IP2=NVIC -Mcu.IP3=RCC -Mcu.IP4=SYS -Mcu.IP5=TIM2 -Mcu.IP6=TIM3 -Mcu.IP7=USART1 -Mcu.IPNb=8 +Mcu.IP0=I2C1 +Mcu.IP1=NVIC +Mcu.IP2=RCC +Mcu.IP3=SYS +Mcu.IP4=TIM2 +Mcu.IP5=TIM3 +Mcu.IP6=USART1 +Mcu.IPNb=7 Mcu.Name=STM32F103C(8-B)Tx Mcu.Package=LQFP48 Mcu.Pin0=PD0-OSC_IN @@ -57,8 +35,6 @@ Mcu.UserName=STM32F103C8Tx MxCube.Version=5.2.1 MxDb.Version=DB.5.0.21 NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false -NVIC.DMA1_Channel4_IRQn=true\:0\:0\:false\:false\:true\:false\:true -NVIC.DMA1_Channel6_IRQn=true\:0\:0\:false\:false\:true\:false\:true NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false