From: Federica Di Lauro Date: Tue, 11 Feb 2020 11:04:57 +0000 (+0100) Subject: dma tests X-Git-Url: http://git.leonardobizzoni.com/?a=commitdiff_plain;h=80b326956c0cf5c97f4ad725f3440fc9649ffdde;p=pioneer-stm32 dma tests --- diff --git a/otto_controller/.mxproject b/otto_controller/.mxproject index b4aeebb..d4029ca 100644 --- a/otto_controller/.mxproject +++ b/otto_controller/.mxproject @@ -1,33 +1,31 @@ [PreviousGenFiles] AdvancedFolderStructure=true -HeaderFileListSize=7 +HeaderFileListSize=6 HeaderFiles#0=/home/fdila/Projects/otto/otto_controller/Core/Inc/gpio.h -HeaderFiles#1=/home/fdila/Projects/otto/otto_controller/Core/Inc/dma.h -HeaderFiles#2=/home/fdila/Projects/otto/otto_controller/Core/Inc/tim.h +HeaderFiles#1=/home/fdila/Projects/otto/otto_controller/Core/Inc/tim.h +HeaderFiles#2=/home/fdila/Projects/otto/otto_controller/Core/Inc/usart.h HeaderFolderListSize=1 HeaderPath#0=/home/fdila/Projects/otto/otto_controller/Core/Inc -SourceFileListSize=7 +SourceFileListSize=6 SourceFiles#0=/home/fdila/Projects/otto/otto_controller/Core/Src/gpio.c -SourceFiles#1=/home/fdila/Projects/otto/otto_controller/Core/Src/dma.c -SourceFiles#2=/home/fdila/Projects/otto/otto_controller/Core/Src/tim.c +SourceFiles#1=/home/fdila/Projects/otto/otto_controller/Core/Src/tim.c +SourceFiles#2=/home/fdila/Projects/otto/otto_controller/Core/Src/usart.c SourceFolderListSize=1 SourcePath#0=/home/fdila/Projects/otto/otto_controller/Core/Src -HeaderFiles#3=/home/fdila/Projects/otto/otto_controller/Core/Inc/usart.h -HeaderFiles#4=/home/fdila/Projects/otto/otto_controller/Core/Inc/stm32f7xx_it.h -HeaderFiles#5=/home/fdila/Projects/otto/otto_controller/Core/Inc/stm32f7xx_hal_conf.h -SourceFiles#3=/home/fdila/Projects/otto/otto_controller/Core/Src/usart.c -SourceFiles#4=/home/fdila/Projects/otto/otto_controller/Core/Src/stm32f7xx_it.c -SourceFiles#5=/home/fdila/Projects/otto/otto_controller/Core/Src/stm32f7xx_hal_msp.c +HeaderFiles#3=/home/fdila/Projects/otto/otto_controller/Core/Inc/stm32f7xx_it.h +HeaderFiles#4=/home/fdila/Projects/otto/otto_controller/Core/Inc/stm32f7xx_hal_conf.h +HeaderFiles#5=/home/fdila/Projects/otto/otto_controller/Core/Inc/main.h +SourceFiles#3=/home/fdila/Projects/otto/otto_controller/Core/Src/stm32f7xx_it.c +SourceFiles#4=/home/fdila/Projects/otto/otto_controller/Core/Src/stm32f7xx_hal_msp.c +SourceFiles#5=/home/fdila/Projects/otto/otto_controller/Core/Src/main.c HeaderFiles#6=/home/fdila/Projects/otto/otto_controller/Core/Inc/main.h SourceFiles#6=/home/fdila/Projects/otto/otto_controller/Core/Src/main.c -HeaderFiles=; -SourceFiles=; [PreviousLibFiles] LibFiles=Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_cortex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_def.h;Drivers/STM32F7xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_exti.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart_ex.h;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_cortex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_gpio.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_exti.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_uart.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_uart_ex.c;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_cortex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_def.h;Drivers/STM32F7xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_exti.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart_ex.h;Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f767xx.h;Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f7xx.h;Drivers/CMSIS/Device/ST/STM32F7xx/Include/system_stm32f7xx.h;Drivers/CMSIS/Device/ST/STM32F7xx/Source/Templates/system_stm32f7xx.c;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/tz_context.h;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/cmsis_iccarm.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/core_armv8mbl.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/mpu_armv7.h;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_cm4.h; [PreviousUsedCubeIDEFiles] -SourceFiles=Core/Src/main.c;Core/Src/gpio.c;Core/Src/dma.c;Core/Src/tim.c;Core/Src/usart.c;Core/Src/stm32f7xx_it.c;Core/Src/stm32f7xx_hal_msp.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_cortex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_gpio.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_exti.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_uart.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_uart_ex.c;Core/Src/system_stm32f7xx.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_cortex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_gpio.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_exti.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_uart.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_uart_ex.c;Core/Src/system_stm32f7xx.c;Drivers/CMSIS/Device/ST/STM32F7xx/Source/Templates/system_stm32f7xx.c;; +SourceFiles=Core/Src/main.c;Core/Src/gpio.c;Core/Src/tim.c;Core/Src/usart.c;Core/Src/stm32f7xx_it.c;Core/Src/stm32f7xx_hal_msp.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_cortex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_gpio.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_exti.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_uart.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_uart_ex.c;Core/Src/system_stm32f7xx.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_cortex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_gpio.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_exti.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_uart.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_uart_ex.c;Core/Src/system_stm32f7xx.c;Drivers/CMSIS/Device/ST/STM32F7xx/Source/Templates/system_stm32f7xx.c;; HeaderPath=Drivers/STM32F7xx_HAL_Driver/Inc;Drivers/STM32F7xx_HAL_Driver/Inc/Legacy;Drivers/CMSIS/Device/ST/STM32F7xx/Include;Drivers/CMSIS/Include;Core/Inc; CDefines=USE_HAL_DRIVER;STM32F767xx;USE_HAL_DRIVER;USE_HAL_DRIVER; diff --git a/otto_controller/Core/Inc/dma.h b/otto_controller/Core/Inc/dma.h deleted file mode 100644 index 16bb88c..0000000 --- a/otto_controller/Core/Inc/dma.h +++ /dev/null @@ -1,56 +0,0 @@ -/** - ****************************************************************************** - * File Name : dma.h - * Description : This file contains all the function prototypes for - * the dma.c file - ****************************************************************************** - * @attention - * - *

© Copyright (c) 2020 STMicroelectronics. - * All rights reserved.

- * - * This software component is licensed by ST under BSD 3-Clause license, - * the "License"; You may not use this file except in compliance with the - * License. You may obtain a copy of the License at: - * opensource.org/licenses/BSD-3-Clause - * - ****************************************************************************** - */ -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __dma_H -#define __dma_H - -#ifdef __cplusplus - extern "C" { -#endif - -/* Includes ------------------------------------------------------------------*/ -#include "main.h" - -/* DMA memory to memory transfer handles -------------------------------------*/ - -/* USER CODE BEGIN Includes */ - -/* USER CODE END Includes */ - -/* USER CODE BEGIN Private defines */ - -/* USER CODE END Private defines */ - -void MX_DMA_Init(void); - -/* USER CODE BEGIN Prototypes */ - -/* USER CODE END Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif /* __dma_H */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/otto_controller/Core/Inc/main.h b/otto_controller/Core/Inc/main.h index 80943f3..fb0a3d8 100644 --- a/otto_controller/Core/Inc/main.h +++ b/otto_controller/Core/Inc/main.h @@ -58,9 +58,6 @@ void Error_Handler(void); /* USER CODE END EFP */ /* Private defines -----------------------------------------------------------*/ -#define user_button_Pin GPIO_PIN_13 -#define user_button_GPIO_Port GPIOC -#define user_button_EXTI_IRQn EXTI15_10_IRQn #define current2_Pin GPIO_PIN_0 #define current2_GPIO_Port GPIOC #define encoder_dx1_Pin GPIO_PIN_0 diff --git a/otto_controller/Core/Inc/stm32f7xx_it.h b/otto_controller/Core/Inc/stm32f7xx_it.h index d1e7824..f138f64 100644 --- a/otto_controller/Core/Inc/stm32f7xx_it.h +++ b/otto_controller/Core/Inc/stm32f7xx_it.h @@ -59,8 +59,6 @@ void SysTick_Handler(void); void TIM3_IRQHandler(void); void EXTI15_10_IRQHandler(void); void TIM6_DAC_IRQHandler(void); -void DMA2_Stream1_IRQHandler(void); -void DMA2_Stream6_IRQHandler(void); void USART6_IRQHandler(void); /* USER CODE BEGIN EFP */ diff --git a/otto_controller/Core/Src/dma.c b/otto_controller/Core/Src/dma.c deleted file mode 100644 index 35f0a1b..0000000 --- a/otto_controller/Core/Src/dma.c +++ /dev/null @@ -1,66 +0,0 @@ -/** - ****************************************************************************** - * File Name : dma.c - * Description : This file provides code for the configuration - * of all the requested memory to memory DMA transfers. - ****************************************************************************** - * @attention - * - *

© Copyright (c) 2020 STMicroelectronics. - * All rights reserved.

- * - * This software component is licensed by ST under BSD 3-Clause license, - * the "License"; You may not use this file except in compliance with the - * License. You may obtain a copy of the License at: - * opensource.org/licenses/BSD-3-Clause - * - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "dma.h" - -/* USER CODE BEGIN 0 */ - -/* USER CODE END 0 */ - -/*----------------------------------------------------------------------------*/ -/* Configure DMA */ -/*----------------------------------------------------------------------------*/ - -/* USER CODE BEGIN 1 */ - -/* USER CODE END 1 */ - -/** - * Enable DMA controller clock - */ -void MX_DMA_Init(void) -{ - - /* DMA controller clock enable */ - __HAL_RCC_DMA2_CLK_ENABLE(); - - /* DMA interrupt init */ - /* DMA2_Stream1_IRQn interrupt configuration */ - HAL_NVIC_SetPriority(DMA2_Stream1_IRQn, 0, 0); - HAL_NVIC_EnableIRQ(DMA2_Stream1_IRQn); - /* DMA2_Stream6_IRQn interrupt configuration */ - HAL_NVIC_SetPriority(DMA2_Stream6_IRQn, 0, 0); - HAL_NVIC_EnableIRQ(DMA2_Stream6_IRQn); - -} - -/* USER CODE BEGIN 2 */ - -/* USER CODE END 2 */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/otto_controller/Core/Src/gpio.c b/otto_controller/Core/Src/gpio.c index 7c99329..b3dac9b 100644 --- a/otto_controller/Core/Src/gpio.c +++ b/otto_controller/Core/Src/gpio.c @@ -56,11 +56,11 @@ void MX_GPIO_Init(void) /*Configure GPIO pin Output Level */ HAL_GPIO_WritePin(GPIOF, sleep2_Pin|sleep1_Pin, GPIO_PIN_SET); - /*Configure GPIO pin : PtPin */ - GPIO_InitStruct.Pin = user_button_Pin; + /*Configure GPIO pin : PC13 */ + GPIO_InitStruct.Pin = GPIO_PIN_13; GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING; GPIO_InitStruct.Pull = GPIO_NOPULL; - HAL_GPIO_Init(user_button_GPIO_Port, &GPIO_InitStruct); + HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); /*Configure GPIO pin : PtPin */ GPIO_InitStruct.Pin = current2_Pin; diff --git a/otto_controller/Core/Src/main.cpp b/otto_controller/Core/Src/main.cpp index 5a65853..813b6f9 100644 --- a/otto_controller/Core/Src/main.cpp +++ b/otto_controller/Core/Src/main.cpp @@ -20,7 +20,6 @@ /* Includes ------------------------------------------------------------------*/ #include "main.h" -#include "dma.h" #include "tim.h" #include "usart.h" #include "gpio.h" @@ -142,7 +141,7 @@ int main(void) /* USER CODE END SysInit */ /* Initialize all configured peripherals */ - MX_DMA_Init(); + MX_GPIO_Init(); MX_TIM2_Init(); MX_TIM3_Init(); MX_TIM4_Init(); @@ -175,9 +174,11 @@ int main(void) rx_buffer = (uint8_t*) &vel_msg; //Enables UART RX interrupt - HAL_UART_Receive_DMA(&huart6, rx_buffer, 8); + HAL_UART_Receive_IT(&huart6, rx_buffer, 8); /* USER CODE END 2 */ + + /* Infinite loop */ /* USER CODE BEGIN WHILE */ @@ -304,7 +305,6 @@ void HAL_UART_RxCpltCallback(UART_HandleTypeDef *UartHandle) { void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { //Blue user button on the NUCLEO board if (GPIO_Pin == GPIO_PIN_13) { - mode++; if (mode == 0) { mode = 1; //Enables TIM3 interrupt (used for PID control) diff --git a/otto_controller/Core/Src/stm32f7xx_it.c b/otto_controller/Core/Src/stm32f7xx_it.c index d3abde0..88e7f7d 100644 --- a/otto_controller/Core/Src/stm32f7xx_it.c +++ b/otto_controller/Core/Src/stm32f7xx_it.c @@ -58,8 +58,6 @@ /* External variables --------------------------------------------------------*/ extern TIM_HandleTypeDef htim3; extern TIM_HandleTypeDef htim6; -extern DMA_HandleTypeDef hdma_usart6_tx; -extern DMA_HandleTypeDef hdma_usart6_rx; extern UART_HandleTypeDef huart6; /* USER CODE BEGIN EV */ @@ -243,34 +241,6 @@ void TIM6_DAC_IRQHandler(void) /* USER CODE END TIM6_DAC_IRQn 1 */ } -/** - * @brief This function handles DMA2 stream1 global interrupt. - */ -void DMA2_Stream1_IRQHandler(void) -{ - /* USER CODE BEGIN DMA2_Stream1_IRQn 0 */ - - /* USER CODE END DMA2_Stream1_IRQn 0 */ - HAL_DMA_IRQHandler(&hdma_usart6_rx); - /* USER CODE BEGIN DMA2_Stream1_IRQn 1 */ - - /* USER CODE END DMA2_Stream1_IRQn 1 */ -} - -/** - * @brief This function handles DMA2 stream6 global interrupt. - */ -void DMA2_Stream6_IRQHandler(void) -{ - /* USER CODE BEGIN DMA2_Stream6_IRQn 0 */ - - /* USER CODE END DMA2_Stream6_IRQn 0 */ - HAL_DMA_IRQHandler(&hdma_usart6_tx); - /* USER CODE BEGIN DMA2_Stream6_IRQn 1 */ - - /* USER CODE END DMA2_Stream6_IRQn 1 */ -} - /** * @brief This function handles USART6 global interrupt. */ diff --git a/otto_controller/Core/Src/usart.c b/otto_controller/Core/Src/usart.c index 6f25222..7b56c72 100644 --- a/otto_controller/Core/Src/usart.c +++ b/otto_controller/Core/Src/usart.c @@ -25,8 +25,6 @@ /* USER CODE END 0 */ UART_HandleTypeDef huart6; -DMA_HandleTypeDef hdma_usart6_tx; -DMA_HandleTypeDef hdma_usart6_rx; /* USART6 init function */ @@ -74,43 +72,6 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle) GPIO_InitStruct.Alternate = GPIO_AF8_USART6; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); - /* USART6 DMA Init */ - /* USART6_TX Init */ - hdma_usart6_tx.Instance = DMA2_Stream6; - hdma_usart6_tx.Init.Channel = DMA_CHANNEL_5; - hdma_usart6_tx.Init.Direction = DMA_MEMORY_TO_PERIPH; - hdma_usart6_tx.Init.PeriphInc = DMA_PINC_DISABLE; - hdma_usart6_tx.Init.MemInc = DMA_MINC_ENABLE; - hdma_usart6_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE; - hdma_usart6_tx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE; - hdma_usart6_tx.Init.Mode = DMA_NORMAL; - hdma_usart6_tx.Init.Priority = DMA_PRIORITY_LOW; - hdma_usart6_tx.Init.FIFOMode = DMA_FIFOMODE_DISABLE; - if (HAL_DMA_Init(&hdma_usart6_tx) != HAL_OK) - { - Error_Handler(); - } - - __HAL_LINKDMA(uartHandle,hdmatx,hdma_usart6_tx); - - /* USART6_RX Init */ - hdma_usart6_rx.Instance = DMA2_Stream1; - hdma_usart6_rx.Init.Channel = DMA_CHANNEL_5; - hdma_usart6_rx.Init.Direction = DMA_PERIPH_TO_MEMORY; - hdma_usart6_rx.Init.PeriphInc = DMA_PINC_DISABLE; - hdma_usart6_rx.Init.MemInc = DMA_MINC_ENABLE; - hdma_usart6_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE; - hdma_usart6_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE; - hdma_usart6_rx.Init.Mode = DMA_NORMAL; - hdma_usart6_rx.Init.Priority = DMA_PRIORITY_LOW; - hdma_usart6_rx.Init.FIFOMode = DMA_FIFOMODE_DISABLE; - if (HAL_DMA_Init(&hdma_usart6_rx) != HAL_OK) - { - Error_Handler(); - } - - __HAL_LINKDMA(uartHandle,hdmarx,hdma_usart6_rx); - /* USER CODE BEGIN USART6_MspInit 1 */ /* USER CODE END USART6_MspInit 1 */ @@ -134,10 +95,6 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle) */ HAL_GPIO_DeInit(GPIOC, GPIO_PIN_6|GPIO_PIN_7); - /* USART6 DMA DeInit */ - HAL_DMA_DeInit(uartHandle->hdmatx); - HAL_DMA_DeInit(uartHandle->hdmarx); - /* USART6 interrupt Deinit */ HAL_NVIC_DisableIRQ(USART6_IRQn); /* USER CODE BEGIN USART6_MspDeInit 1 */ diff --git a/otto_controller/otto_controller.ioc b/otto_controller/otto_controller.ioc index 6ae6302..9b04d16 100644 --- a/otto_controller/otto_controller.ioc +++ b/otto_controller/otto_controller.ioc @@ -1,42 +1,18 @@ #MicroXplorer Configuration settings - do not modify -Dma.Request0=USART6_TX -Dma.Request1=USART6_RX -Dma.RequestsNb=2 -Dma.USART6_RX.1.Direction=DMA_PERIPH_TO_MEMORY -Dma.USART6_RX.1.FIFOMode=DMA_FIFOMODE_DISABLE -Dma.USART6_RX.1.Instance=DMA2_Stream1 -Dma.USART6_RX.1.MemDataAlignment=DMA_MDATAALIGN_BYTE -Dma.USART6_RX.1.MemInc=DMA_MINC_ENABLE -Dma.USART6_RX.1.Mode=DMA_NORMAL -Dma.USART6_RX.1.PeriphDataAlignment=DMA_PDATAALIGN_BYTE -Dma.USART6_RX.1.PeriphInc=DMA_PINC_DISABLE -Dma.USART6_RX.1.Priority=DMA_PRIORITY_LOW -Dma.USART6_RX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode -Dma.USART6_TX.0.Direction=DMA_MEMORY_TO_PERIPH -Dma.USART6_TX.0.FIFOMode=DMA_FIFOMODE_DISABLE -Dma.USART6_TX.0.Instance=DMA2_Stream6 -Dma.USART6_TX.0.MemDataAlignment=DMA_MDATAALIGN_BYTE -Dma.USART6_TX.0.MemInc=DMA_MINC_ENABLE -Dma.USART6_TX.0.Mode=DMA_NORMAL -Dma.USART6_TX.0.PeriphDataAlignment=DMA_PDATAALIGN_BYTE -Dma.USART6_TX.0.PeriphInc=DMA_PINC_DISABLE -Dma.USART6_TX.0.Priority=DMA_PRIORITY_LOW -Dma.USART6_TX.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode File.Version=6 KeepUserPlacement=false Mcu.Family=STM32F7 Mcu.IP0=CORTEX_M7 -Mcu.IP1=DMA -Mcu.IP10=USART6 -Mcu.IP2=NVIC -Mcu.IP3=RCC -Mcu.IP4=SYS -Mcu.IP5=TIM2 -Mcu.IP6=TIM3 -Mcu.IP7=TIM4 -Mcu.IP8=TIM5 -Mcu.IP9=TIM6 -Mcu.IPNb=11 +Mcu.IP1=NVIC +Mcu.IP2=RCC +Mcu.IP3=SYS +Mcu.IP4=TIM2 +Mcu.IP5=TIM3 +Mcu.IP6=TIM4 +Mcu.IP7=TIM5 +Mcu.IP8=TIM6 +Mcu.IP9=USART6 +Mcu.IPNb=10 Mcu.Name=STM32F767ZITx Mcu.Package=LQFP144 Mcu.Pin0=PC13 @@ -66,11 +42,9 @@ Mcu.PinsNb=23 Mcu.ThirdPartyNb=0 Mcu.UserConstants= Mcu.UserName=STM32F767ZITx -MxCube.Version=5.4.0 -MxDb.Version=DB.5.0.40 +MxCube.Version=5.5.0 +MxDb.Version=DB.5.0.50 NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false -NVIC.DMA2_Stream1_IRQn=true\:0\:0\:false\:false\:true\:false\:true -NVIC.DMA2_Stream6_IRQn=true\:0\:0\:false\:false\:true\:false\:true NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false NVIC.EXTI15_10_IRQn=true\:0\:0\:false\:false\:true\:true\:true NVIC.ForceEnableDMAVector=true @@ -117,8 +91,6 @@ PC0.GPIOParameters=GPIO_Label PC0.GPIO_Label=current2 PC0.Locked=true PC0.Signal=GPIO_Analog -PC13.GPIOParameters=GPIO_Label -PC13.GPIO_Label=user_button PC13.Locked=true PC13.Signal=GPXTI13 PC6.Mode=Asynchronous @@ -193,7 +165,7 @@ ProjectManager.StackSize=0x400 ProjectManager.TargetToolchain=STM32CubeIDE ProjectManager.ToolChainLocation= ProjectManager.UnderRoot=true -ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,1-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_TIM2_Init-TIM2-false-HAL-true,4-MX_TIM3_Init-TIM3-false-HAL-true,5-MX_TIM4_Init-TIM4-false-HAL-true,6-MX_TIM5_Init-TIM5-false-HAL-true,7-MX_USART6_UART_Init-USART6-false-HAL-true,8-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true,9-MX_TIM6_Init-TIM6-false-HAL-true +ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,2-MX_DMA_Init-DMA-false-HAL-true,4-MX_TIM2_Init-TIM2-false-HAL-true,5-MX_TIM3_Init-TIM3-false-HAL-true,6-MX_TIM4_Init-TIM4-false-HAL-true,7-MX_TIM5_Init-TIM5-false-HAL-true,8-MX_USART6_UART_Init-USART6-false-HAL-true,9-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true,10-MX_TIM6_Init-TIM6-false-HAL-true RCC.CECFreq_Value=32786.88524590164 RCC.DFSDMFreq_Value=16000000 RCC.FamilyName=M diff --git a/test_dma/.mxproject b/test_dma/.mxproject index 50c3c83..6aebfd2 100644 --- a/test_dma/.mxproject +++ b/test_dma/.mxproject @@ -12,8 +12,6 @@ SourceFiles#1=/home/fdila/Projects/otto/test_dma/Core/Src/stm32f7xx_hal_msp.c SourceFiles#2=/home/fdila/Projects/otto/test_dma/Core/Src/main.c SourceFolderListSize=1 SourcePath#0=/home/fdila/Projects/otto/test_dma/Core/Src -HeaderFiles=; -SourceFiles=; [PreviousLibFiles] LibFiles=Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_cortex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_def.h;Drivers/STM32F7xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_exti.h;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_cortex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_uart.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_uart_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_gpio.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_exti.c;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_cortex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_def.h;Drivers/STM32F7xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_exti.h;Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f767xx.h;Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f7xx.h;Drivers/CMSIS/Device/ST/STM32F7xx/Include/system_stm32f7xx.h;Drivers/CMSIS/Device/ST/STM32F7xx/Source/Templates/system_stm32f7xx.c;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/tz_context.h;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/cmsis_iccarm.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/core_armv8mbl.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/mpu_armv7.h;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_cm4.h; diff --git a/test_dma/Core/Src/main.c b/test_dma/Core/Src/main.c index 932f5d5..7b20a1b 100644 --- a/test_dma/Core/Src/main.c +++ b/test_dma/Core/Src/main.c @@ -105,6 +105,8 @@ int main(void) HAL_UART_Receive_DMA(&huart6, rx_buffer, 8); /* USER CODE END 2 */ + + /* Infinite loop */ /* USER CODE BEGIN WHILE */ @@ -250,6 +252,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { } void HAL_UART_RxCpltCallback(UART_HandleTypeDef *UartHandle) { HAL_UART_Receive_DMA(&huart6, rx_buffer, 8); + mode++; } /* USER CODE END 4 */ diff --git a/test_dma/test_dma.ioc b/test_dma/test_dma.ioc index 309018a..721fdbe 100644 --- a/test_dma/test_dma.ioc +++ b/test_dma/test_dma.ioc @@ -43,7 +43,7 @@ Mcu.ThirdPartyNb=0 Mcu.UserConstants= Mcu.UserName=STM32F767ZITx MxCube.Version=5.5.0 -MxDb.Version=DB.5.0.40 +MxDb.Version=DB.5.0.50 NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false NVIC.DMA2_Stream1_IRQn=true\:0\:0\:false\:false\:true\:false\:true NVIC.DMA2_Stream6_IRQn=true\:0\:0\:false\:false\:true\:false\:true