added 250hz timer for giving motor updates

stable
Penguin 2 years ago
parent feb61e56a8
commit 807f7c29e8

@ -1,4 +1,69 @@
q
q
q
b main
file build/motor_controller.hex
q
r
q
r
q
b main
r
n
n
n
n
n
n
n
n
n
n
n
n
n
n
b 129
c
qq
q
b main
r
n
n
n
n
n
n
n
n
n
n
n
b 128
n
n
n
n
b 129
de
del
b 129
r
c
n
s
s
s
q
q
q
b 129
r
q
b Core/Src/main.c:380
r
q
q
q

@ -56,6 +56,7 @@ void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void USART2_IRQHandler(void);
void TIM6_DAC_IRQHandler(void);
/* USER CODE BEGIN EFP */
/* USER CODE END EFP */

@ -25,6 +25,7 @@
#include "motor_controller.h"
#include "stm32l4xx_hal_uart.h"
#include <stdio.h>
#include <stdbool.h>
/* USER CODE END Includes */
@ -43,11 +44,15 @@
/* USER CODE END PM */
/* Private variables ---------------------------------------------------------*/
TIM_HandleTypeDef htim2;
TIM_HandleTypeDef htim2;
TIM_HandleTypeDef htim6;
UART_HandleTypeDef huart2;
/* USER CODE BEGIN PV */
volatile uint8_t huart2_rxc;
static volatile uint32_t sys_time = 0;
static volatile bool b_timer_struck = false;
/* USER CODE END PV */
@ -56,6 +61,7 @@ void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_TIM2_Init(void);
static void MX_USART2_UART_Init(void);
static void MX_TIM6_Init(void);
/* USER CODE BEGIN PFP */
void setPWM(TIM_HandleTypeDef *timer, uint32_t channel, uint8_t dc_percent);
@ -67,42 +73,38 @@ void setPWM(TIM_HandleTypeDef *timer, uint32_t channel, uint8_t dc_percent);
/* USER CODE END 0 */
/**
* @brief The application entry point.
* @retval int
*/
* @brief The application entry point.
* @retval int
*/
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_TIM2_Init();
MX_USART2_UART_Init();
/* USER CODE BEGIN 2 */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_TIM2_Init();
MX_USART2_UART_Init();
MX_TIM6_Init();
/* USER CODE BEGIN 2 */
p_uart_init(&huart2);
uint8_t buff[256] = {'\0'};
sprintf(buff, "Hello Worldblahblahfjdslkfjlasdfj\r\n");
HAL_UART_Transmit(&huart2, "...\r\n", sizeof("...\r\n"), 100);
HAL_UART_Transmit(&huart2, buff, sizeof(buff), 100);
PDEBUG("hello darkness my old friend\r\n");
// HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_2);
// HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_4);
@ -112,203 +114,264 @@ int main(void)
HAL_GPIO_WritePin(m1_dir_GPIO_Port, m1_dir_Pin, 1);
HAL_GPIO_WritePin(m2_dir_GPIO_Port, m2_dir_Pin, 1);
PDEBUG("ablahablah\n");
motor_controller_init();
/* USER CODE END 2 */
mc_init();
HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1);
HAL_TIM_Base_Start_IT(&htim6);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
mc_service();
if(b_timer_struck)
{
b_timer_struck = false;
PDEBUG("%d\n", sys_time);
}
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
/* USER CODE END 3 */
}
/**
* @brief System Clock Configuration
* @retval None
*/
* @brief System Clock Configuration
* @retval None
*/
void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
/** Configure the main internal regulator output voltage
*/
if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK)
{
Error_Handler();
}
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
/** Configure the main internal regulator output voltage
*/
if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK)
{
Error_Handler();
}
/** Configure LSE Drive Capability
*/
HAL_PWR_EnableBkUpAccess();
__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW);
/** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure.
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE|RCC_OSCILLATORTYPE_MSI;
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
RCC_OscInitStruct.MSIState = RCC_MSI_ON;
RCC_OscInitStruct.MSICalibrationValue = 0;
RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_6;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_MSI;
RCC_OscInitStruct.PLL.PLLM = 1;
RCC_OscInitStruct.PLL.PLLN = 16;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV7;
RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2;
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
/** Initializes the CPU, AHB and APB buses clocks
*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
{
Error_Handler();
}
/** Enable MSI Auto calibration
*/
HAL_RCCEx_EnableMSIPLLMode();
}
/** Configure LSE Drive Capability
*/
HAL_PWR_EnableBkUpAccess();
__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW);
/** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure.
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE | RCC_OSCILLATORTYPE_MSI;
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
RCC_OscInitStruct.MSIState = RCC_MSI_ON;
RCC_OscInitStruct.MSICalibrationValue = 0;
RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_6;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_MSI;
RCC_OscInitStruct.PLL.PLLM = 1;
RCC_OscInitStruct.PLL.PLLN = 16;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV7;
RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2;
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
/**
* @brief TIM2 Initialization Function
* @param None
* @retval None
*/
static void MX_TIM2_Init(void)
{
/** Initializes the CPU, AHB and APB buses clocks
*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
/* USER CODE BEGIN TIM2_Init 0 */
/* USER CODE END TIM2_Init 0 */
TIM_MasterConfigTypeDef sMasterConfig = {0};
TIM_OC_InitTypeDef sConfigOC = {0};
/* USER CODE BEGIN TIM2_Init 1 */
/* USER CODE END TIM2_Init 1 */
htim2.Instance = TIM2;
htim2.Init.Prescaler = 127;
htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
htim2.Init.Period = 499;
htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
if (HAL_TIM_PWM_Init(&htim2) != HAL_OK)
{
Error_Handler();
}
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
if (HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig) != HAL_OK)
{
Error_Handler();
}
sConfigOC.OCMode = TIM_OCMODE_PWM1;
sConfigOC.Pulse = 250;
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
if (HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_2) != HAL_OK)
{
Error_Handler();
}
sConfigOC.Pulse = 125;
if (HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_4) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN TIM2_Init 2 */
/* USER CODE END TIM2_Init 2 */
HAL_TIM_MspPostInit(&htim2);
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
{
Error_Handler();
}
/** Enable MSI Auto calibration
*/
HAL_RCCEx_EnableMSIPLLMode();
}
/**
* @brief TIM2 Initialization Function
* @param None
* @retval None
*/
static void MX_TIM2_Init(void)
* @brief TIM6 Initialization Function
* @param None
* @retval None
*/
static void MX_TIM6_Init(void)
{
/* USER CODE BEGIN TIM2_Init 0 */
/* USER CODE BEGIN TIM6_Init 0 */
/* USER CODE END TIM2_Init 0 */
/* USER CODE END TIM6_Init 0 */
TIM_MasterConfigTypeDef sMasterConfig = {0};
TIM_OC_InitTypeDef sConfigOC = {0};
TIM_MasterConfigTypeDef sMasterConfig = {0};
/* USER CODE BEGIN TIM2_Init 1 */
/* USER CODE BEGIN TIM6_Init 1 */
/* USER CODE END TIM2_Init 1 */
htim2.Instance = TIM2;
htim2.Init.Prescaler = 127;
htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
htim2.Init.Period = 499;
htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
if (HAL_TIM_PWM_Init(&htim2) != HAL_OK)
{
Error_Handler();
}
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
if (HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig) != HAL_OK)
{
Error_Handler();
}
sConfigOC.OCMode = TIM_OCMODE_PWM1;
sConfigOC.Pulse = 250;
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
if (HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_2) != HAL_OK)
{
Error_Handler();
}
sConfigOC.Pulse = 125;
if (HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_4) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN TIM2_Init 2 */
/* USER CODE END TIM6_Init 1 */
htim6.Instance = TIM6;
htim6.Init.Prescaler = 127;
htim6.Init.CounterMode = TIM_COUNTERMODE_UP;
htim6.Init.Period = 999;
htim6.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE;
if (HAL_TIM_Base_Init(&htim6) != HAL_OK)
{
Error_Handler();
}
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
if (HAL_TIMEx_MasterConfigSynchronization(&htim6, &sMasterConfig) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN TIM6_Init 2 */
/* USER CODE END TIM6_Init 2 */
/* USER CODE END TIM2_Init 2 */
HAL_TIM_MspPostInit(&htim2);
}
/**
* @brief USART2 Initialization Function
* @param None
* @retval None
*/
* @brief USART2 Initialization Function
* @param None
* @retval None
*/
static void MX_USART2_UART_Init(void)
{
/* USER CODE BEGIN USART2_Init 0 */
/* USER CODE BEGIN USART2_Init 0 */
/* USER CODE END USART2_Init 0 */
/* USER CODE END USART2_Init 0 */
/* USER CODE BEGIN USART2_Init 1 */
/* USER CODE BEGIN USART2_Init 1 */
/* USER CODE END USART2_Init 1 */
huart2.Instance = USART2;
huart2.Init.BaudRate = 115200;
huart2.Init.WordLength = UART_WORDLENGTH_8B;
huart2.Init.StopBits = UART_STOPBITS_1;
huart2.Init.Parity = UART_PARITY_NONE;
huart2.Init.Mode = UART_MODE_TX_RX;
huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart2.Init.OverSampling = UART_OVERSAMPLING_16;
huart2.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart2.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if (HAL_UART_Init(&huart2) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN USART2_Init 2 */
/* USER CODE END USART2_Init 1 */
huart2.Instance = USART2;
huart2.Init.BaudRate = 115200;
huart2.Init.WordLength = UART_WORDLENGTH_8B;
huart2.Init.StopBits = UART_STOPBITS_1;
huart2.Init.Parity = UART_PARITY_NONE;
huart2.Init.Mode = UART_MODE_TX_RX;
huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart2.Init.OverSampling = UART_OVERSAMPLING_16;
huart2.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart2.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if (HAL_UART_Init(&huart2) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN USART2_Init 2 */
/* USER CODE END USART2_Init 2 */
/* USER CODE END USART2_Init 2 */
}
/**
* @brief GPIO Initialization Function
* @param None
* @retval None
*/
* @brief GPIO Initialization Function
* @param None
* @retval None
*/
static void MX_GPIO_Init(void)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOA, m1_dir_Pin | m2_dir_Pin | GPIO_PIN_8 | GPIO_PIN_9, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(LD3_GPIO_Port, LD3_Pin, GPIO_PIN_RESET);
/*Configure GPIO pins : m1_dir_Pin m2_dir_Pin PA8 PA9 */
GPIO_InitStruct.Pin = m1_dir_Pin | m2_dir_Pin | GPIO_PIN_8 | GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/*Configure GPIO pin : LD3_Pin */
GPIO_InitStruct.Pin = LD3_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(LD3_GPIO_Port, &GPIO_InitStruct);
GPIO_InitTypeDef GPIO_InitStruct = {0};
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOA, m1_dir_Pin|m2_dir_Pin|GPIO_PIN_8|GPIO_PIN_9, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(LD3_GPIO_Port, LD3_Pin, GPIO_PIN_RESET);
/*Configure GPIO pins : m1_dir_Pin m2_dir_Pin PA8 PA9 */
GPIO_InitStruct.Pin = m1_dir_Pin|m2_dir_Pin|GPIO_PIN_8|GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/*Configure GPIO pin : LD3_Pin */
GPIO_InitStruct.Pin = LD3_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(LD3_GPIO_Port, &GPIO_InitStruct);
}
/* USER CODE BEGIN 4 */
void HAL_UART_RxCpltCallback(UART_HandleTypeDef* huart)
{
HAL_UART_Transmit(&huart2, &huart2_rxc, 1, 100);
HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1);
}
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef* htim)
{
sys_time += 4;
b_timer_struck = true;
}
void setPWM(TIM_HandleTypeDef *timer, uint32_t channel, uint8_t dc_percent)
{
HAL_TIM_PWM_Stop(timer, channel);
@ -327,33 +390,33 @@ void setPWM(TIM_HandleTypeDef *timer, uint32_t channel, uint8_t dc_percent)
/* USER CODE END 4 */
/**
* @brief This function is executed in case of error occurrence.
* @retval None
*/
* @brief This function is executed in case of error occurrence.
* @retval None
*/
void Error_Handler(void)
{
/* USER CODE BEGIN Error_Handler_Debug */
/* USER CODE BEGIN Error_Handler_Debug */
/* User can add his own implementation to report the HAL error return state */
__disable_irq();
while (1)
{
}
/* USER CODE END Error_Handler_Debug */
/* USER CODE END Error_Handler_Debug */
}
#ifdef USE_FULL_ASSERT
#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t *file, uint32_t line)
{
/* USER CODE BEGIN 6 */
/* USER CODE BEGIN 6 */
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* USER CODE END 6 */
/* USER CODE END 6 */
}
#endif /* USE_FULL_ASSERT */

@ -100,6 +100,31 @@ void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef* htim_pwm)
}
/**
* @brief TIM_Base MSP Initialization
* This function configures the hardware resources used in this example
* @param htim_base: TIM_Base handle pointer
* @retval None
*/
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base)
{
if(htim_base->Instance==TIM6)
{
/* USER CODE BEGIN TIM6_MspInit 0 */
/* USER CODE END TIM6_MspInit 0 */
/* Peripheral clock enable */
__HAL_RCC_TIM6_CLK_ENABLE();
/* TIM6 interrupt Init */
HAL_NVIC_SetPriority(TIM6_DAC_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(TIM6_DAC_IRQn);
/* USER CODE BEGIN TIM6_MspInit 1 */
/* USER CODE END TIM6_MspInit 1 */
}
}
void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
@ -149,6 +174,31 @@ void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef* htim_pwm)
}
/**
* @brief TIM_Base MSP De-Initialization
* This function freeze the hardware resources used in this example
* @param htim_base: TIM_Base handle pointer
* @retval None
*/
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base)
{
if(htim_base->Instance==TIM6)
{
/* USER CODE BEGIN TIM6_MspDeInit 0 */
/* USER CODE END TIM6_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_TIM6_CLK_DISABLE();
/* TIM6 interrupt DeInit */
HAL_NVIC_DisableIRQ(TIM6_DAC_IRQn);
/* USER CODE BEGIN TIM6_MspDeInit 1 */
/* USER CODE END TIM6_MspDeInit 1 */
}
}
/**
* @brief UART MSP Initialization
* This function configures the hardware resources used in this example

@ -55,6 +55,7 @@
/* USER CODE END 0 */
/* External variables --------------------------------------------------------*/
extern TIM_HandleTypeDef htim6;
extern UART_HandleTypeDef huart2;
/* USER CODE BEGIN EV */
@ -212,6 +213,20 @@ void USART2_IRQHandler(void)
/* USER CODE END USART2_IRQn 1 */
}
/**
* @brief This function handles TIM6 global interrupt, DAC channel1 and channel2 underrun error interrupts.
*/
void TIM6_DAC_IRQHandler(void)
{
/* USER CODE BEGIN TIM6_DAC_IRQn 0 */
/* USER CODE END TIM6_DAC_IRQn 0 */
HAL_TIM_IRQHandler(&htim6);
/* USER CODE BEGIN TIM6_DAC_IRQn 1 */
/* USER CODE END TIM6_DAC_IRQn 1 */
}
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */

@ -1,5 +1,5 @@
##########################################################################################################################
# File automatically-generated by tool: [projectgenerator] version: [3.16.0] date: [Thu Mar 31 16:32:43 CDT 2022]
# File automatically-generated by tool: [projectgenerator] version: [3.16.0] date: [Fri Apr 01 16:10:25 CDT 2022]
##########################################################################################################################
# ------------------------------------------------
@ -134,7 +134,7 @@ ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffuncti
CFLAGS += $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
ifeq ($(DEBUG), 1)
CFLAGS += -g -gdwarf-2 -D_DEBUG
CFLAGS += -g3 -gdwarf-2 -D_DEBUG
endif

@ -22,38 +22,9 @@
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-MFbuild/stm32l4xx_hal_dma.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_dma.lst",
"-o",
"build/stm32l4xx_hal_dma.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c"
],
"directory": "/storage/Shared/Projects/stm32_projects/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-gdwarf-2",
"-D_DEBUG",
"-MFbuild/main.d",
"-Wa,-a,-ad,-alms=build/main.lst",
"-o",
@ -62,677 +33,5 @@
],
"directory": "/storage/Shared/Projects/stm32_projects/motor_controller",
"file": "Core/Src/main.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-MFbuild/stm32l4xx_hal_uart_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_uart_ex.lst",
"-o",
"build/stm32l4xx_hal_uart_ex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c"
],
"directory": "/storage/Shared/Projects/stm32_projects/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-MFbuild/stm32l4xx_hal_pwr.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_pwr.lst",
"-o",
"build/stm32l4xx_hal_pwr.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c"
],
"directory": "/storage/Shared/Projects/stm32_projects/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-MFbuild/stm32l4xx_hal_tim_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_tim_ex.lst",
"-o",
"build/stm32l4xx_hal_tim_ex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c"
],
"directory": "/storage/Shared/Projects/stm32_projects/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-MFbuild/stm32l4xx_hal_flash_ramfunc.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_flash_ramfunc.lst",
"-o",
"build/stm32l4xx_hal_flash_ramfunc.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c"
],
"directory": "/storage/Shared/Projects/stm32_projects/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-MFbuild/stm32l4xx_hal_tim.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_tim.lst",
"-o",
"build/stm32l4xx_hal_tim.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c"
],
"directory": "/storage/Shared/Projects/stm32_projects/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-MFbuild/system_stm32l4xx.d",
"-Wa,-a,-ad,-alms=build/system_stm32l4xx.lst",
"-o",
"build/system_stm32l4xx.o",
"Core/Src/system_stm32l4xx.c"
],
"directory": "/storage/Shared/Projects/stm32_projects/motor_controller",
"file": "Core/Src/system_stm32l4xx.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-MFbuild/stm32l4xx_hal_exti.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_exti.lst",
"-o",
"build/stm32l4xx_hal_exti.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c"
],
"directory": "/storage/Shared/Projects/stm32_projects/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-MFbuild/stm32l4xx_hal_dma_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_dma_ex.lst",
"-o",
"build/stm32l4xx_hal_dma_ex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c"
],
"directory": "/storage/Shared/Projects/stm32_projects/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-MFbuild/stm32l4xx_hal_i2c.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_i2c.lst",
"-o",
"build/stm32l4xx_hal_i2c.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c"
],
"directory": "/storage/Shared/Projects/stm32_projects/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-MFbuild/stm32l4xx_hal.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal.lst",
"-o",
"build/stm32l4xx_hal.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c"
],
"directory": "/storage/Shared/Projects/stm32_projects/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-MFbuild/stm32l4xx_hal_i2c_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_i2c_ex.lst",
"-o",
"build/stm32l4xx_hal_i2c_ex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c"
],
"directory": "/storage/Shared/Projects/stm32_projects/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-MFbuild/stm32l4xx_hal_msp.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_msp.lst",
"-o",
"build/stm32l4xx_hal_msp.o",
"Core/Src/stm32l4xx_hal_msp.c"
],
"directory": "/storage/Shared/Projects/stm32_projects/motor_controller",
"file": "Core/Src/stm32l4xx_hal_msp.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-MFbuild/stm32l4xx_hal_flash.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_flash.lst",
"-o",
"build/stm32l4xx_hal_flash.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c"
],
"directory": "/storage/Shared/Projects/stm32_projects/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-MFbuild/stm32l4xx_hal_rcc.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_rcc.lst",
"-o",
"build/stm32l4xx_hal_rcc.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c"
],
"directory": "/storage/Shared/Projects/stm32_projects/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-MFbuild/stm32l4xx_hal_flash_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_flash_ex.lst",
"-o",
"build/stm32l4xx_hal_flash_ex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c"
],
"directory": "/storage/Shared/Projects/stm32_projects/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-MFbuild/stm32l4xx_hal_pwr_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_pwr_ex.lst",
"-o",
"build/stm32l4xx_hal_pwr_ex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c"
],
"directory": "/storage/Shared/Projects/stm32_projects/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-MFbuild/stm32l4xx_hal_cortex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_cortex.lst",
"-o",
"build/stm32l4xx_hal_cortex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c"
],
"directory": "/storage/Shared/Projects/stm32_projects/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-MFbuild/stm32l4xx_hal_rcc_ex.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_rcc_ex.lst",
"-o",
"build/stm32l4xx_hal_rcc_ex.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c"
],
"directory": "/storage/Shared/Projects/stm32_projects/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-MFbuild/stm32l4xx_hal_gpio.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_gpio.lst",
"-o",
"build/stm32l4xx_hal_gpio.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c"
],
"directory": "/storage/Shared/Projects/stm32_projects/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-MFbuild/stm32l4xx_hal_uart.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_hal_uart.lst",
"-o",
"build/stm32l4xx_hal_uart.o",
"Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c"
],
"directory": "/storage/Shared/Projects/stm32_projects/motor_controller",
"file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c"
},
{
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32L432xx",
"-ICore/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc",
"-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy",
"-IDrivers/CMSIS/Device/ST/STM32L4xx/Include",
"-IDrivers/CMSIS/Include",
"-Ishared",
"-Ishared/devices",
"-Ishared/drivers",
"-Ishared/util",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-MFbuild/stm32l4xx_it.d",
"-Wa,-a,-ad,-alms=build/stm32l4xx_it.lst",
"-o",
"build/stm32l4xx_it.o",
"Core/Src/stm32l4xx_it.c"
],
"directory": "/storage/Shared/Projects/stm32_projects/motor_controller",
"file": "Core/Src/stm32l4xx_it.c"
}
]

3619
gdb.txt

File diff suppressed because it is too large Load Diff

@ -0,0 +1,7 @@
set pagination off
set logging file gdb.txt
set logging on
set mem inaccessible-by-default off
target extended-remote localhost:3333
monitor reset halt
load

@ -7,8 +7,9 @@ Mcu.IP0=NVIC
Mcu.IP1=RCC
Mcu.IP2=SYS
Mcu.IP3=TIM2
Mcu.IP4=USART2
Mcu.IPNb=5
Mcu.IP4=TIM6
Mcu.IP5=USART2
Mcu.IPNb=6
Mcu.Name=STM32L432K(B-C)Ux
Mcu.Package=UFQFPN32
Mcu.Pin0=PC14-OSC32_IN (PC14)
@ -18,6 +19,7 @@ Mcu.Pin11=PA14 (JTCK-SWCLK)
Mcu.Pin12=PA15 (JTDI)
Mcu.Pin13=PB3 (JTDO-TRACESWO)
Mcu.Pin14=VP_SYS_VS_Systick
Mcu.Pin15=VP_TIM6_VS_ClockSourceINT
Mcu.Pin2=PA0
Mcu.Pin3=PA1
Mcu.Pin4=PA2
@ -26,7 +28,7 @@ Mcu.Pin6=PA4
Mcu.Pin7=PA5
Mcu.Pin8=PA8
Mcu.Pin9=PA9
Mcu.PinsNb=15
Mcu.PinsNb=16
Mcu.ThirdPartyNb=0
Mcu.UserConstants=
Mcu.UserName=STM32L432KCUx
@ -42,6 +44,7 @@ NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true
NVIC.SysTick_IRQn=true\:0\:0\:true\:false\:true\:true\:true\:true
NVIC.TIM6_DAC_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
NVIC.USART2_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true
PA0.GPIOParameters=GPIO_Label
@ -121,7 +124,7 @@ ProjectManager.StackSize=0x400
ProjectManager.TargetToolchain=Makefile
ProjectManager.ToolChainLocation=
ProjectManager.UnderRoot=false
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_TIM2_Init-TIM2-false-HAL-true,4-MX_USART2_UART_Init-USART2-false-HAL-true
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_TIM2_Init-TIM2-false-HAL-true,4-MX_USART2_UART_Init-USART2-false-HAL-true,5-MX_TIM1_Init-TIM1-false-HAL-true
RCC.48CLKFreq_Value=24000000
RCC.AHBFreq_Value=32000000
RCC.APB1Freq_Value=32000000
@ -188,9 +191,15 @@ TIM2.Period=499
TIM2.Prescaler=127
TIM2.Pulse-PWM\ Generation2\ CH2=250
TIM2.Pulse-PWM\ Generation4\ CH4=125
TIM6.AutoReloadPreload=TIM_AUTORELOAD_PRELOAD_ENABLE
TIM6.IPParameters=Prescaler,AutoReloadPreload,Period
TIM6.Period=999
TIM6.Prescaler=127
USART2.IPParameters=VirtualMode-Asynchronous
USART2.VirtualMode-Asynchronous=VM_ASYNC
VP_SYS_VS_Systick.Mode=SysTick
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
VP_TIM6_VS_ClockSourceINT.Mode=Enable_Timer
VP_TIM6_VS_ClockSourceINT.Signal=TIM6_VS_ClockSourceINT
board=NUCLEO-L432KC
boardIOC=true

@ -1,6 +1,11 @@
#include "motor_controller.h"
void motor_controller_init()
void mc_init()
{
//
}
void mc_service()
{
}

@ -3,6 +3,8 @@
#include "main.h"
void motor_controller_init(void);
void mc_init(void);
void mc_service(void);
#endif

@ -28,4 +28,6 @@ int p_printf(const char* fmt, ...)
void p_uart_init(UART_HandleTypeDef* huart)
{
huart_inst = huart;
PDEBUG("...\n");
PDEBUG("UART2 Initialized\n");
}

Loading…
Cancel
Save