From ce637927080ccaee759d33cdca5e0f9239dc22c3 Mon Sep 17 00:00:00 2001 From: Penguin Date: Fri, 1 Apr 2022 18:15:39 -0500 Subject: [PATCH] trying some wacky ways to determine speeds and direction. eventually ill look up some algorithms to do this properly. for now im goofin --- Core/Inc/main.h | 1 + Core/Src/main.c | 32 +- Makefile | 4 +- compile_commands.json | 876 ++++++++++++++++ gdb.txt | 1553 +++++++++++++++++++++++++++++ motor_controller.ioc | 2 +- shared/devices/motor_controller.c | 25 +- shared/devices/motor_controller.h | 4 +- 8 files changed, 2475 insertions(+), 22 deletions(-) diff --git a/Core/Inc/main.h b/Core/Inc/main.h index cfb6c83..186937b 100644 --- a/Core/Inc/main.h +++ b/Core/Inc/main.h @@ -54,6 +54,7 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim); void Error_Handler(void); /* USER CODE BEGIN EFP */ +void setPWM(TIM_HandleTypeDef *timer, uint32_t channel, uint8_t dc_percent); /* USER CODE END EFP */ diff --git a/Core/Src/main.c b/Core/Src/main.c index 011fffa..79ca12e 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -21,11 +21,11 @@ /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ -#include "putil.h" #include "motor_controller.h" +#include "putil.h" #include "stm32l4xx_hal_uart.h" -#include #include +#include /* USER CODE END Includes */ @@ -44,7 +44,7 @@ /* USER CODE END PM */ /* Private variables ---------------------------------------------------------*/ - TIM_HandleTypeDef htim2; +TIM_HandleTypeDef htim2; TIM_HandleTypeDef htim6; UART_HandleTypeDef huart2; @@ -54,6 +54,8 @@ volatile uint8_t huart2_rxc; static volatile uint32_t sys_time = 0; static volatile bool b_timer_struck = false; + + /* USER CODE END PV */ /* Private function prototypes -----------------------------------------------*/ @@ -63,7 +65,6 @@ 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); /* USER CODE END PFP */ @@ -114,20 +115,22 @@ 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); - mc_init(); + mc_init(&htim2); HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); HAL_TIM_Base_Start_IT(&htim6); + uint16_t motor_degrees = 0; /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { - mc_service(); - if(b_timer_struck) + if (b_timer_struck) { + // PDEBUG("%d\n", sys_time); b_timer_struck = false; - PDEBUG("%d\n", sys_time); + motor_degrees = (motor_degrees + 1) % 360; + mc_service(motor_degrees, 50); } /* USER CODE END WHILE */ @@ -270,7 +273,7 @@ static void MX_TIM6_Init(void) htim6.Instance = TIM6; htim6.Init.Prescaler = 127; htim6.Init.CounterMode = TIM_COUNTERMODE_UP; - htim6.Init.Period = 999; + htim6.Init.Period = 249; htim6.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE; if (HAL_TIM_Base_Init(&htim6) != HAL_OK) { @@ -360,16 +363,19 @@ static void MX_GPIO_Init(void) } /* USER CODE BEGIN 4 */ -void HAL_UART_RxCpltCallback(UART_HandleTypeDef* huart) +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) +void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) { - sys_time += 4; - b_timer_struck = true; + sys_time += 1; + if(++sys_time % 250 == 0) + { + b_timer_struck = true; + } } void setPWM(TIM_HandleTypeDef *timer, uint32_t channel, uint8_t dc_percent) diff --git a/Makefile b/Makefile index 29e0ecc..0c8283c 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ ########################################################################################################################## -# File automatically-generated by tool: [projectgenerator] version: [3.16.0] date: [Fri Apr 01 16:10:25 CDT 2022] +# File automatically-generated by tool: [projectgenerator] version: [3.16.0] date: [Fri Apr 01 16:19:23 CDT 2022] ########################################################################################################################## # ------------------------------------------------ @@ -151,7 +151,7 @@ LDSCRIPT = STM32L432KCUx_FLASH.ld # libraries LIBS = -lc -lm -lnosys LIBDIR = -LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections +LDFLAGS = $(MCU) -specs=nosys.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections -u _print_float # default action: build all all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin diff --git a/compile_commands.json b/compile_commands.json index 2105a25..d1c47fe 100644 --- a/compile_commands.json +++ b/compile_commands.json @@ -1,4 +1,810 @@ [ + { + "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/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" + }, + { + "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/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", + "-g3", + "-gdwarf-2", + "-D_DEBUG", + "-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", + "-g3", + "-gdwarf-2", + "-D_DEBUG", + "-MFbuild/motor_controller.d", + "-Wa,-a,-ad,-alms=build/motor_controller.lst", + "-o", + "build/motor_controller.o", + "shared/devices/motor_controller.c" + ], + "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", + "file": "shared/devices/motor_controller.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/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", + "-g3", + "-gdwarf-2", + "-D_DEBUG", + "-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", + "-g3", + "-gdwarf-2", + "-D_DEBUG", + "-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", + "-g3", + "-gdwarf-2", + "-D_DEBUG", + "-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", + "-g3", + "-gdwarf-2", + "-D_DEBUG", + "-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", + "-x", + "assembler-with-cpp", + "-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/startup_stm32l432xx.d", + "-o", + "build/startup_stm32l432xx.o", + "startup_stm32l432xx.s" + ], + "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", + "file": "startup_stm32l432xx.s" + }, + { + "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/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", + "-g3", + "-gdwarf-2", + "-D_DEBUG", + "-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", + "-g3", + "-gdwarf-2", + "-D_DEBUG", + "-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", + "-g3", + "-gdwarf-2", + "-D_DEBUG", + "-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", + "-g3", + "-gdwarf-2", + "-D_DEBUG", + "-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", + "-g3", + "-gdwarf-2", + "-D_DEBUG", + "-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", + "-g3", + "-gdwarf-2", + "-D_DEBUG", + "-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/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", + "-g3", + "-gdwarf-2", + "-D_DEBUG", + "-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", + "-g3", + "-gdwarf-2", + "-D_DEBUG", + "-MFbuild/putil.d", + "-Wa,-a,-ad,-alms=build/putil.lst", + "-o", + "build/putil.o", + "shared/util/putil.c" + ], + "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", + "file": "shared/util/putil.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/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", + "-g3", + "-gdwarf-2", + "-D_DEBUG", + "-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", + "-g3", + "-gdwarf-2", + "-D_DEBUG", + "-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", @@ -33,5 +839,75 @@ ], "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", + "-g3", + "-gdwarf-2", + "-D_DEBUG", + "-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", + "-g3", + "-gdwarf-2", + "-D_DEBUG", + "-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" } ] \ No newline at end of file diff --git a/gdb.txt b/gdb.txt index 4cd6bd1..c76ca76 100644 --- a/gdb.txt +++ b/gdb.txt @@ -4440,3 +4440,1556 @@ A debugging session is active. Quit anyway? (y or n) [answered Y; input not from terminal] [Inferior 1 (Remote target) detached] +main () at Core/Src/main.c:128 +128 mc_service(); +### Assembly ######################################################################################################## + 0x08000924 main+92 mov r0, r4 + 0x08000926 main+94 bl 0x8003240 + 0x0800092a main+98 ldr r0, [pc, #48] ; (0x800095c ) + 0x0800092c main+100 bl 0x8000d38 + 0x08000930 main+104 bl 0x8003332 + 0x08000934 main+108 ldr r3, [pc, #40] ; (0x8000960 ) + 0x08000936 main+110 ldrb r3, [r3, #0] + 0x08000938 main+112 cmp r3, #0 + 0x0800093a main+114 beq.n 0x8000930 + 0x0800093c main+116 ldr r3, [pc, #32] ; (0x8000960 ) +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000090 r10 0x00000000 pc 0x08000934 primask 0x00 + r1 0x00000040 r6 0x00000000 r11 0x00000000 xPSR 0x61000000 basepri 0x00 + r2 0x006010d0 r7 0x00000000 r12 0x0000000a fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff8 msp 0x2000fff8 control 0x04 + r4 0x20000128 r9 0x00000000 lr 0x08000935 psp 0x00000000 +### Source ########################################################################################################## + 118 + 119 mc_init(); + 120 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 121 HAL_TIM_Base_Start_IT(&htim6); + 122 /* USER CODE END 2 */ + 123 + 124 /* Infinite loop */ + 125 /* USER CODE BEGIN WHILE */ + 126 while (1) + 127 { + 128 mc_service(); + 129 if (b_timer_struck) + 130 { + 131 b_timer_struck = false; + 132 } + 133 /* USER CODE END WHILE */ + 134 + 135 /* USER CODE BEGIN 3 */ + 136 } + 137 /* USER CODE END 3 */ +### Stack ########################################################################################################### +[0] from 0x08000934 in main+108 at Core/Src/main.c:128 +### Threads ######################################################################################################### +[1] id 0 from 0x08000934 in main+108 at Core/Src/main.c:128 +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x3d00 lma 0x8000190 +Loading section .rodata, size 0xc8 lma 0x8003e90 +Loading section .ARM, size 0x8 lma 0x8003f58 +Loading section .init_array, size 0x8 lma 0x8003f60 +Loading section .fini_array, size 0x8 lma 0x8003f68 +Loading section .data, size 0x70 lma 0x8003f70 +Start address 0x08003320, load size 16352 +Transfer rate: 19 KB/sec, 2336 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +0x0800093a in main () at Core/Src/main.c:129 +warning: Source file is more recent than executable. +129 if (b_timer_struck) +### Assembly ######################################################################################################## + 0x0800092e main+102 ldr r3, [pc, #36] ; (0x8000954 ) + 0x08000930 main+104 movs r2, #0 + 0x08000932 main+106 strb r2, [r3, #0] + 0x08000934 main+108 bl 0x800331e + 0x08000938 main+112 ldr r3, [pc, #24] ; (0x8000954 ) + 0x0800093a main+114 ldrb r3, [r3, #0] + 0x0800093c main+116 cmp r3, #0 + 0x0800093e main+118 beq.n 0x8000934 + 0x08000940 main+120 b.n 0x800092e + 0x08000942 main+122 nop +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000090 r10 0x00000000 pc 0x0800093a primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x61000000 basepri 0x00 + r2 0x00000000 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x2000008c r8 0x00000000 sp 0x2000fff8 msp 0x2000fff8 control 0x04 + r4 0x20000128 r9 0x00000000 lr 0x08000939 psp 0x00000000 +### Source ########################################################################################################## + 119 mc_init(); + 120 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 121 HAL_TIM_Base_Start_IT(&htim6); + 122 /* USER CODE END 2 */ + 123 + 124 /* Infinite loop */ + 125 /* USER CODE BEGIN WHILE */ + 126 while (1) + 127 { + 128 mc_service(); + 129 if (b_timer_struck) + 130 { + 131 PDEBUG("%d\n", sys_time); + 132 b_timer_struck = false; + 133 } + 134 /* USER CODE END WHILE */ + 135 + 136 /* USER CODE BEGIN 3 */ + 137 } + 138 /* USER CODE END 3 */ +### Stack ########################################################################################################### +[0] from 0x0800093a in main+114 at Core/Src/main.c:129 +### Threads ######################################################################################################### +[1] id 0 from 0x0800093a in main+114 at Core/Src/main.c:129 +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x3d00 lma 0x8000190 +Loading section .rodata, size 0xc8 lma 0x8003e90 +Loading section .ARM, size 0x8 lma 0x8003f58 +Loading section .init_array, size 0x8 lma 0x8003f60 +Loading section .fini_array, size 0x8 lma 0x8003f68 +Loading section .data, size 0x70 lma 0x8003f70 +Start address 0x08003320, load size 16352 +Transfer rate: 19 KB/sec, 2336 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +0x0800093a in main () at Core/Src/main.c:131 +131 PDEBUG("%d\n", sys_time); +### Assembly ######################################################################################################## + 0x0800092e main+102 ldr r3, [pc, #36] ; (0x8000954 ) + 0x08000930 main+104 movs r2, #0 + 0x08000932 main+106 strb r2, [r3, #0] + 0x08000934 main+108 bl 0x800331e + 0x08000938 main+112 ldr r3, [pc, #24] ; (0x8000954 ) + 0x0800093a main+114 ldrb r3, [r3, #0] + 0x0800093c main+116 cmp r3, #0 + 0x0800093e main+118 beq.n 0x8000934 + 0x08000940 main+120 b.n 0x800092e + 0x08000942 main+122 nop +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000090 r10 0x00000000 pc 0x0800093a primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x61000000 basepri 0x00 + r2 0x00000000 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x2000008c r8 0x00000000 sp 0x2000fff8 msp 0x2000fff8 control 0x04 + r4 0x20000128 r9 0x00000000 lr 0x08000939 psp 0x00000000 +### Source ########################################################################################################## + 121 HAL_TIM_Base_Start_IT(&htim6); + 122 /* USER CODE END 2 */ + 123 + 124 /* Infinite loop */ + 125 /* USER CODE BEGIN WHILE */ + 126 while (1) + 127 { + 128 mc_service(); + 129 if (b_timer_struck) + 130 { + 131 PDEBUG("%d\n", sys_time); + 132 b_timer_struck = false; + 133 } + 134 /* USER CODE END WHILE */ + 135 + 136 /* USER CODE BEGIN 3 */ + 137 } + 138 /* USER CODE END 3 */ + 139 } + 140 +### Stack ########################################################################################################### +[0] from 0x0800093a in main+114 at Core/Src/main.c:131 +### Threads ######################################################################################################### +[1] id 0 from 0x0800093a in main+114 at Core/Src/main.c:131 +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x3d10 lma 0x8000190 +Loading section .rodata, size 0xc8 lma 0x8003ea0 +Loading section .ARM, size 0x8 lma 0x8003f68 +Loading section .init_array, size 0x8 lma 0x8003f70 +Loading section .fini_array, size 0x8 lma 0x8003f78 +Loading section .data, size 0x70 lma 0x8003f80 +Start address 0x08003330, load size 16368 +Transfer rate: 19 KB/sec, 2338 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +0x08002efe in __LDREXW (addr=0x600018) at Drivers/CMSIS/Include/cmsis_gcc.h:1155 +1155 __ASM volatile ("ldrex %0, %1" : "=r" (result) : "Q" (*addr) ); +### Assembly ######################################################################################################## +~ +~ +~ +~ + 0x08002efc __LDREXW+0 ldr r4, [r3, #28] + 0x08002efe __LDREXW+2 bics.w r4, r7, r4 + 0x08002f02 __LDREXW+6 ite eq +~ +~ +~ +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000128 r10 0x00000000 pc 0x08002efe primask 0x00 + r1 0x00000080 r6 0x00000000 r11 0x00000000 xPSR 0x41000000 basepri 0x00 + r2 0x00600010 r7 0x00000080 r12 0x0000000a fpscr 0x00000010 faultmask 0x00 + r3 0x40004400 r8 0x00000064 sp 0x2000fe88 msp 0x2000fe88 control 0x04 + r4 0x00600010 r9 0x001a3656 lr 0x08002f17 psp 0x00000000 +### Source ########################################################################################################## + 1145 /** + 1146 \brief LDR Exclusive (32 bit) + 1147 \details Executes a exclusive LDR instruction for 32 bit values. + 1148 \param [in] ptr Pointer to data + 1149 \return value of type uint32_t at (*ptr) + 1150 */ + 1151 __STATIC_FORCEINLINE uint32_t __LDREXW(volatile uint32_t *addr) + 1152 { + 1153 uint32_t result; + 1154 + 1155 __ASM volatile ("ldrex %0, %1" : "=r" (result) : "Q" (*addr) ); + 1156 return(result); + 1157 } + 1158 + 1159 + 1160 /** + 1161 \brief STR Exclusive (8 bit) + 1162 \details Executes a exclusive STR instruction for 8 bit values. + 1163 \param [in] value Value to store + 1164 \param [in] ptr Pointer to location +### Stack ########################################################################################################### +[0] from 0x08002efe in __LDREXW+2 at Drivers/CMSIS/Include/cmsis_gcc.h:1155 +[1] from 0x08002efe in UART_EndRxTransfer+22 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:3788 +### Threads ######################################################################################################### +[1] id 0 from 0x08002efe in __LDREXW+2 at Drivers/CMSIS/Include/cmsis_gcc.h:1155 +### Variables ####################################################################################################### +arg addr = 0x600018: 0 +loc result = , val = +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x58b0 lma 0x8000190 +Loading section .rodata, size 0x2b0 lma 0x8005a40 +Loading section .ARM, size 0x8 lma 0x8005cf0 +Loading section .init_array, size 0x8 lma 0x8005cf8 +Loading section .fini_array, size 0x8 lma 0x8005d00 +Loading section .data, size 0x70 lma 0x8005d08 +Start address 0x08003b54, load size 23928 +Transfer rate: 23 KB/sec, 2991 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +__udivmoddi4 (n=, d=, rp=0x0) at /var/tmp/portage/cross-arm-none-eabi/gcc-11.2.1_p20220115/work/gcc-11-20220115/libgcc/libgcc2.c:1181 +1181 /var/tmp/portage/cross-arm-none-eabi/gcc-11.2.1_p20220115/work/gcc-11-20220115/libgcc/libgcc2.c: No such file or directory. +### Assembly ######################################################################################################## + 0x08001108 __udivmoddi4+476 mov r0, r4 + 0x0800110a __udivmoddi4+478 bl 0x8003a34 + 0x0800110e __udivmoddi4+482 ldr r0, [pc, #68] ; (0x8001154 <__udivmoddi4+552>) + 0x08001110 __udivmoddi4+484 bl 0x800152c + 0x08001114 __udivmoddi4+488 movs r4, #0 + 0x08001116 __udivmoddi4+490 ldr r3, [pc, #64] ; (0x8001158 <__udivmoddi4+556>) + 0x08001118 __udivmoddi4+492 ldrb r3, [r3, #0] + 0x0800111a __udivmoddi4+494 cmp r3, #0 + 0x0800111c __udivmoddi4+496 beq.n 0x8001116 <__udivmoddi4+490> + 0x0800111e __udivmoddi4+498 ldr r3, [pc, #56] ; (0x8001158 <__udivmoddi4+556>) +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000090 r10 0x00000000 pc 0x08001116 primask 0x00 + r1 0x00000040 r6 0x00000000 r11 0x00000000 xPSR 0x61000000 basepri 0x00 + r2 0x006000d0 r7 0x00000000 r12 0x0000000a fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x000000cf r9 0x00000000 lr 0x08003b4d psp 0x00000000 +### Source ########################################################################################################## +Cannot display "libgcc2.c" +### Stack ########################################################################################################### +[0] from 0x08001116 in __udivmoddi4+490 at /var/tmp/portage/cross-arm-none-eabi/gcc-11.2.1_p20220115/work/gcc-11-20220115/libgcc/libgcc2.c:1181 +[1] from 0x00000000 +### Threads ######################################################################################################### +[1] id 0 from 0x08001116 in __udivmoddi4+490 at /var/tmp/portage/cross-arm-none-eabi/gcc-11.2.1_p20220115/work/gcc-11-20220115/libgcc/libgcc2.c:1181 +### Variables ####################################################################################################### +arg n = , d = , rp = 0x0: 576525989098618880 +loc __t0 = , m1 = , m0 = , d0 = 6291664, d1 = 10, n0 = 0, n1 = 207, n2 = , q0 = 0, q1 = , b = 0, bm = 64 +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0xa6d0 lma 0x80001c0 +Loading section .rodata, size 0x660 lma 0x800a890 +Loading section .ARM, size 0x8 lma 0x800aef0 +Loading section .init_array, size 0x8 lma 0x800aef8 +Loading section .fini_array, size 0x8 lma 0x800af00 +Loading section .data, size 0x9a8 lma 0x800af08 +Start address 0x08003fb4, load size 47232 +Transfer rate: 30 KB/sec, 5248 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +0x08001578 in HAL_MspInit () at Core/Src/stm32l4xx_hal_msp.c:72 +72 __HAL_RCC_PWR_CLK_ENABLE(); +### Assembly ######################################################################################################## + 0x0800156a HAL_MspInit+18 bl 0x8003e94 + 0x0800156e HAL_MspInit+22 ldr r0, [pc, #68] ; (0x80015b4 ) + 0x08001570 HAL_MspInit+24 bl 0x800198c + 0x08001574 HAL_MspInit+28 movs r4, #0 + 0x08001576 HAL_MspInit+30 ldr r3, [pc, #64] ; (0x80015b8 ) + 0x08001578 HAL_MspInit+32 ldrb r3, [r3, #0] + 0x0800157a HAL_MspInit+34 cmp r3, #0 + 0x0800157c HAL_MspInit+36 beq.n 0x8001576 + 0x0800157e HAL_MspInit+38 ldr r3, [pc, #56] ; (0x80015b8 ) + 0x08001580 HAL_MspInit+40 movs r2, #0 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x08001578 primask 0x00 + r1 0x00000040 r6 0x00000000 r11 0x00000000 xPSR 0x61000000 basepri 0x00 + r2 0x006000d0 r7 0x00000000 r12 0xffffffff fpscr 0x00000010 faultmask 0x00 + r3 0x200009c4 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x000000c0 r9 0x00000000 lr 0x08003fad psp 0x00000000 +### Source ########################################################################################################## + 62 /** + 63 * Initializes the Global MSP. + 64 */ + 65 void HAL_MspInit(void) + 66 { + 67 /* USER CODE BEGIN MspInit 0 */ + 68 + 69 /* USER CODE END MspInit 0 */ + 70 + 71 __HAL_RCC_SYSCFG_CLK_ENABLE(); + 72 __HAL_RCC_PWR_CLK_ENABLE(); + 73 + 74 /* System interrupt init*/ + 75 + 76 /* USER CODE BEGIN MspInit 1 */ + 77 + 78 /* USER CODE END MspInit 1 */ + 79 } + 80 + 81 /** +### Stack ########################################################################################################### +[0] from 0x08001578 in HAL_MspInit+32 at Core/Src/stm32l4xx_hal_msp.c:72 +[1] from 0x08003fac in memset +### Threads ######################################################################################################### +[1] id 0 from 0x08001578 in HAL_MspInit+32 at Core/Src/stm32l4xx_hal_msp.c:72 +### Variables ####################################################################################################### +loc tmpreg = 536873776 +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0x92a8 lma 0x80001c0 +Loading section .rodata, size 0x4a8 lma 0x8009468 +Loading section .ARM, size 0x8 lma 0x8009910 +Loading section .init_array, size 0x8 lma 0x8009918 +Loading section .fini_array, size 0x8 lma 0x8009920 +Loading section .data, size 0x9a8 lma 0x8009928 +Start address 0x08003f00, load size 41632 +Transfer rate: 29 KB/sec, 4625 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +SystemClock_Config () at Core/Src/main.c:186 +186 RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK +### Assembly ######################################################################################################## + 0x080014ce SystemClock_Config+90 ldr r0, [pc, #68] ; (0x8001514 ) + 0x080014d0 SystemClock_Config+92 bl 0x80018ec + 0x080014d4 SystemClock_Config+96 movs r4, #0 + 0x080014d6 SystemClock_Config+98 ldr r3, [pc, #64] ; (0x8001518 ) + 0x080014d8 SystemClock_Config+100 ldrb r3, [r3, #0] + 0x080014da SystemClock_Config+102 cmp r3, #0 + 0x080014dc SystemClock_Config+104 beq.n 0x80014d6 + 0x080014de SystemClock_Config+106 ldr r3, [pc, #56] ; (0x8001518 ) + 0x080014e0 SystemClock_Config+108 movs r2, #0 + 0x080014e2 SystemClock_Config+110 strb r2, [r3, #0] +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x080014da primask 0x00 + r1 0x00000040 r6 0x00000000 r11 0x00000000 xPSR 0x61000000 basepri 0x00 + r2 0x006000d0 r7 0x00000000 r12 0xffffffff fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x00000062 r9 0x00000000 lr 0x08003ef7 psp 0x00000000 +### Source ########################################################################################################## + 176 RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV7; + 177 RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2; + 178 RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2; + 179 if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) + 180 { + 181 Error_Handler(); + 182 } + 183 + 184 /** Initializes the CPU, AHB and APB buses clocks + 185 */ + 186 RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK + 187 |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; + 188 RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + 189 RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; + 190 RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; + 191 RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; + 192 + 193 if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) + 194 { + 195 Error_Handler(); +### Stack ########################################################################################################### +[0] from 0x080014da in SystemClock_Config+102 at Core/Src/main.c:186 +[1] from 0x00000000 +### Threads ######################################################################################################### +[1] id 0 from 0x080014da in SystemClock_Config+102 at Core/Src/main.c:186 +### Variables ####################################################################################################### +loc RCC_OscInitStruct = {OscillatorType = 0,HSEState = 0,LSEState = 0,HSIState = 0,HSICalibrationValue = 0,LSIState = 0,MSIS…, RCC_ClkInitStruct = {ClockType = 0,SYSCLKSource = 536873776,AHBCLKDivider = 0,APB1CLKDivider = 134233911,APB2CLKDivider … +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0xa7a8 lma 0x80001c0 +Loading section .rodata, size 0x680 lma 0x800a968 +Loading section .ARM, size 0x8 lma 0x800afe8 +Loading section .init_array, size 0x8 lma 0x800aff0 +Loading section .fini_array, size 0x8 lma 0x800aff8 +Loading section .data, size 0x9a8 lma 0x800b000 +Start address 0x08003ff8, load size 47480 +Transfer rate: 30 KB/sec, 5275 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +main () at Core/Src/main.c:129 +129 if (b_timer_struck) +### Assembly ######################################################################################################## + 0x08001568 main+88 mov r0, r4 + 0x0800156a main+90 bl 0x8003e94 + 0x0800156e main+94 ldr r0, [pc, #68] ; (0x80015b4 ) + 0x08001570 main+96 bl 0x800198c + 0x08001574 main+100 movs r4, #0 + 0x08001576 main+102 ldr r3, [pc, #64] ; (0x80015b8 ) + 0x08001578 main+104 ldrb r3, [r3, #0] + 0x0800157a main+106 cmp r3, #0 + 0x0800157c main+108 beq.n 0x8001576 + 0x0800157e main+110 ldr r3, [pc, #56] ; (0x80015b8 ) +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x08001576 primask 0x00 + r1 0x00000040 r6 0x00000000 r11 0x00000000 xPSR 0x61000000 basepri 0x00 + r2 0x006000d0 r7 0x00000000 r12 0xffffffff fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x00000079 r9 0x00000000 lr 0x08003fe9 psp 0x00000000 +### Source ########################################################################################################## + 119 mc_init(); + 120 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 121 HAL_TIM_Base_Start_IT(&htim6); + 122 uint16_t motor_degrees = 0; + 123 /* USER CODE END 2 */ + 124 + 125 /* Infinite loop */ + 126 /* USER CODE BEGIN WHILE */ + 127 while (1) + 128 { + 129 if (b_timer_struck) + 130 { + 131 // PDEBUG("%d\n", sys_time); + 132 b_timer_struck = false; + 133 motor_degrees = (motor_degrees + 1) % 360; + 134 mc_service(motor_degrees, 50); + 135 } + 136 /* USER CODE END WHILE */ + 137 + 138 /* USER CODE BEGIN 3 */ +### Stack ########################################################################################################### +[0] from 0x08001576 in main+102 at Core/Src/main.c:129 +### Threads ######################################################################################################### +[1] id 0 from 0x08001576 in main+102 at Core/Src/main.c:129 +### Variables ####################################################################################################### +loc motor_degrees = 121 +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0xa7a8 lma 0x80001c0 +Loading section .rodata, size 0x680 lma 0x800a968 +Loading section .ARM, size 0x8 lma 0x800afe8 +Loading section .init_array, size 0x8 lma 0x800aff0 +Loading section .fini_array, size 0x8 lma 0x800aff8 +Loading section .data, size 0x9a8 lma 0x800b000 +Start address 0x08003ff8, load size 47480 +Transfer rate: 30 KB/sec, 5275 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +main () at Core/Src/main.c:129 +129 if (b_timer_struck) +### Assembly ######################################################################################################## + 0x08001568 main+88 mov r0, r4 + 0x0800156a main+90 bl 0x8003e94 + 0x0800156e main+94 ldr r0, [pc, #68] ; (0x80015b4 ) + 0x08001570 main+96 bl 0x800198c + 0x08001574 main+100 movs r4, #0 + 0x08001576 main+102 ldr r3, [pc, #64] ; (0x80015b8 ) + 0x08001578 main+104 ldrb r3, [r3, #0] + 0x0800157a main+106 cmp r3, #0 + 0x0800157c main+108 beq.n 0x8001576 + 0x0800157e main+110 ldr r3, [pc, #56] ; (0x80015b8 ) +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x08001576 primask 0x00 + r1 0x00000040 r6 0x00000000 r11 0x00000000 xPSR 0x61000000 basepri 0x00 + r2 0x006000d0 r7 0x00000000 r12 0xffffffff fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x0000002d r9 0x00000000 lr 0x08003fe9 psp 0x00000000 +### Source ########################################################################################################## + 119 mc_init(); + 120 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 121 HAL_TIM_Base_Start_IT(&htim6); + 122 uint16_t motor_degrees = 0; + 123 /* USER CODE END 2 */ + 124 + 125 /* Infinite loop */ + 126 /* USER CODE BEGIN WHILE */ + 127 while (1) + 128 { + 129 if (b_timer_struck) + 130 { + 131 // PDEBUG("%d\n", sys_time); + 132 b_timer_struck = false; + 133 motor_degrees = (motor_degrees + 1) % 360; + 134 mc_service(motor_degrees, 50); + 135 } + 136 /* USER CODE END WHILE */ + 137 + 138 /* USER CODE BEGIN 3 */ +### Stack ########################################################################################################### +[0] from 0x08001576 in main+102 at Core/Src/main.c:129 +### Threads ######################################################################################################### +[1] id 0 from 0x08001576 in main+102 at Core/Src/main.c:129 +### Variables ####################################################################################################### +loc motor_degrees = 45 +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0xa7a8 lma 0x80001c0 +Loading section .rodata, size 0x680 lma 0x800a968 +Loading section .ARM, size 0x8 lma 0x800afe8 +Loading section .init_array, size 0x8 lma 0x800aff0 +Loading section .fini_array, size 0x8 lma 0x800aff8 +Loading section .data, size 0x9a8 lma 0x800b000 +Start address 0x08003ff8, load size 47480 +Transfer rate: 30 KB/sec, 5275 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +0x08003b80 in UART_WaitOnFlagUntilTimeout (huart=huart@entry=0x20000a60 , Flag=Flag@entry=128, Status=Status@entry=RESET, Tickstart=Tickstart@entry=18128, Timeout=Timeout@entry=100) at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:3556 +3556 if (READ_BIT(huart->Instance->CR1, USART_CR1_RE) != 0U) +### Assembly ######################################################################################################## + 0x08003b74 UART_WaitOnFlagUntilTimeout+50 bhi.n 0x8003bd2 + 0x08003b76 UART_WaitOnFlagUntilTimeout+52 cmp.w r8, #0 + 0x08003b7a UART_WaitOnFlagUntilTimeout+56 beq.n 0x8003bd2 + 0x08003b7c UART_WaitOnFlagUntilTimeout+58 ldr r3, [r5, #0] + 0x08003b7e UART_WaitOnFlagUntilTimeout+60 ldr r2, [r3, #0] + 0x08003b80 UART_WaitOnFlagUntilTimeout+62 tst.w r2, #4 + 0x08003b84 UART_WaitOnFlagUntilTimeout+66 beq.n 0x8003b52 + 0x08003b86 UART_WaitOnFlagUntilTimeout+68 ldr r2, [r3, #28] + 0x08003b88 UART_WaitOnFlagUntilTimeout+70 tst.w r2, #2048 ; 0x800 + 0x08003b8c UART_WaitOnFlagUntilTimeout+74 beq.n 0x8003b52 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000002 r5 0x20000a60 r10 0x00000000 pc 0x08003b80 primask 0x00 + r1 0x00000080 r6 0x00000000 r11 0x00000000 xPSR 0x21010000 basepri 0x00 + r2 0x0000002d r7 0x00000080 r12 0xffffffff fpscr 0x00000010 faultmask 0x00 + r3 0x40004400 r8 0x00000064 sp 0x2000fe58 msp 0x2000fe58 control 0x04 + r4 0x00000000 r9 0x000046d0 lr 0x08003b6f psp 0x00000000 +### Source ########################################################################################################## + 3546 ATOMIC_CLEAR_BIT(huart->Instance->CR3, USART_CR3_EIE); + 3547 + 3548 huart->gState = HAL_UART_STATE_READY; + 3549 huart->RxState = HAL_UART_STATE_READY; + 3550 + 3551 __HAL_UNLOCK(huart); + 3552 + 3553 return HAL_TIMEOUT; + 3554 } + 3555 + 3556 if (READ_BIT(huart->Instance->CR1, USART_CR1_RE) != 0U) + 3557 { + 3558 if (__HAL_UART_GET_FLAG(huart, UART_FLAG_RTOF) == SET) + 3559 { + 3560 /* Clear Receiver Timeout flag*/ + 3561 __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_RTOF); + 3562 + 3563 /* Disable TXE, RXNE, PE and ERR (Frame error, noise error, overrun error) + 3564 interrupts for the interrupt process */ + 3565 #if defined(USART_CR1_FIFOEN) +### Stack ########################################################################################################### +[0] from 0x08003b80 in UART_WaitOnFlagUntilTimeout+62 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:3556 +[1] from 0x08003ca8 in HAL_UART_Transmit+150 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:1190 +[2] from 0x08003f4e in p_printf+70 at shared/util/putil.c:23 +[3] from 0x08003fe8 in mc_service+96 at shared/devices/motor_controller.c:16 +[4] from 0x080015a6 in main+150 at Core/Src/main.c:134 +### Threads ######################################################################################################### +[1] id 0 from 0x08003b80 in UART_WaitOnFlagUntilTimeout+62 at Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c:3556 +### Variables ####################################################################################################### +arg huart = 0x20000a60 : {Instance = 0x40004400,Init = {BaudRate = 115200,WordLength = 0,StopBi…, Flag = 128, Status = RESET, Tickstart = 18128, Timeout = 100 +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0xa7a8 lma 0x80001c0 +Loading section .rodata, size 0x680 lma 0x800a968 +Loading section .ARM, size 0x8 lma 0x800afe8 +Loading section .init_array, size 0x8 lma 0x800aff0 +Loading section .fini_array, size 0x8 lma 0x800aff8 +Loading section .data, size 0x9a8 lma 0x800b000 +Start address 0x08003ff8, load size 47480 +Transfer rate: 30 KB/sec, 5275 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +0x08001578 in main () at Core/Src/main.c:129 +129 if (b_timer_struck) +### Assembly ######################################################################################################## + 0x0800156a main+90 bl 0x8003e94 + 0x0800156e main+94 ldr r0, [pc, #68] ; (0x80015b4 ) + 0x08001570 main+96 bl 0x800198c + 0x08001574 main+100 movs r4, #0 + 0x08001576 main+102 ldr r3, [pc, #64] ; (0x80015b8 ) + 0x08001578 main+104 ldrb r3, [r3, #0] + 0x0800157a main+106 cmp r3, #0 + 0x0800157c main+108 beq.n 0x8001576 + 0x0800157e main+110 ldr r3, [pc, #56] ; (0x80015b8 ) + 0x08001580 main+112 movs r2, #0 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x08001578 primask 0x00 + r1 0x00000040 r6 0x00000000 r11 0x00000000 xPSR 0x61010000 basepri 0x00 + r2 0x006000d0 r7 0x00000000 r12 0xffffffff fpscr 0x00000010 faultmask 0x00 + r3 0x200009c4 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x000000b8 r9 0x00000000 lr 0x08003fe9 psp 0x00000000 +### Source ########################################################################################################## + 119 mc_init(); + 120 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 121 HAL_TIM_Base_Start_IT(&htim6); + 122 uint16_t motor_degrees = 0; + 123 /* USER CODE END 2 */ + 124 + 125 /* Infinite loop */ + 126 /* USER CODE BEGIN WHILE */ + 127 while (1) + 128 { + 129 if (b_timer_struck) + 130 { + 131 // PDEBUG("%d\n", sys_time); + 132 b_timer_struck = false; + 133 motor_degrees = (motor_degrees + 1) % 360; + 134 mc_service(motor_degrees, 50); + 135 } + 136 /* USER CODE END WHILE */ + 137 + 138 /* USER CODE BEGIN 3 */ +### Stack ########################################################################################################### +[0] from 0x08001578 in main+104 at Core/Src/main.c:129 +### Threads ######################################################################################################### +[1] id 0 from 0x08001578 in main+104 at Core/Src/main.c:129 +### Variables ####################################################################################################### +loc motor_degrees = 184 +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0xa7a8 lma 0x80001c0 +Loading section .rodata, size 0x688 lma 0x800a968 +Loading section .ARM, size 0x8 lma 0x800aff0 +Loading section .init_array, size 0x8 lma 0x800aff8 +Loading section .fini_array, size 0x8 lma 0x800b000 +Loading section .data, size 0x9a8 lma 0x800b008 +Start address 0x08003ff8, load size 47488 +Transfer rate: 30 KB/sec, 5276 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +0x0800157a in main () at Core/Src/main.c:129 +129 if (b_timer_struck) +### Assembly ######################################################################################################## + 0x0800156e main+94 ldr r0, [pc, #68] ; (0x80015b4 ) + 0x08001570 main+96 bl 0x800198c + 0x08001574 main+100 movs r4, #0 + 0x08001576 main+102 ldr r3, [pc, #64] ; (0x80015b8 ) + 0x08001578 main+104 ldrb r3, [r3, #0] + 0x0800157a main+106 cmp r3, #0 + 0x0800157c main+108 beq.n 0x8001576 + 0x0800157e main+110 ldr r3, [pc, #56] ; (0x80015b8 ) + 0x08001580 main+112 movs r2, #0 + 0x08001582 main+114 strb r2, [r3, #0] +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x0800157a primask 0x00 + r1 0x00000040 r6 0x00000000 r11 0x00000000 xPSR 0x61070000 basepri 0x00 + r2 0x006000d0 r7 0x00000000 r12 0xffffffff fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x0000006f r9 0x00000000 lr 0x08003fe9 psp 0x00000000 +### Source ########################################################################################################## + 119 mc_init(); + 120 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 121 HAL_TIM_Base_Start_IT(&htim6); + 122 uint16_t motor_degrees = 0; + 123 /* USER CODE END 2 */ + 124 + 125 /* Infinite loop */ + 126 /* USER CODE BEGIN WHILE */ + 127 while (1) + 128 { + 129 if (b_timer_struck) + 130 { + 131 // PDEBUG("%d\n", sys_time); + 132 b_timer_struck = false; + 133 motor_degrees = (motor_degrees + 1) % 360; + 134 mc_service(motor_degrees, 50); + 135 } + 136 /* USER CODE END WHILE */ + 137 + 138 /* USER CODE BEGIN 3 */ +### Stack ########################################################################################################### +[0] from 0x0800157a in main+106 at Core/Src/main.c:129 +### Threads ######################################################################################################### +[1] id 0 from 0x0800157a in main+106 at Core/Src/main.c:129 +### Variables ####################################################################################################### +loc motor_degrees = 111 +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0xa7a8 lma 0x80001c0 +Loading section .rodata, size 0x688 lma 0x800a968 +Loading section .ARM, size 0x8 lma 0x800aff0 +Loading section .init_array, size 0x8 lma 0x800aff8 +Loading section .fini_array, size 0x8 lma 0x800b000 +Loading section .data, size 0x9a8 lma 0x800b008 +Start address 0x08003ff8, load size 47488 +Transfer rate: 30 KB/sec, 5276 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +0x0800157c in main () at Core/Src/main.c:129 +129 if (b_timer_struck) +### Assembly ######################################################################################################## + 0x08001570 main+96 bl 0x800198c + 0x08001574 main+100 movs r4, #0 + 0x08001576 main+102 ldr r3, [pc, #64] ; (0x80015b8 ) + 0x08001578 main+104 ldrb r3, [r3, #0] + 0x0800157a main+106 cmp r3, #0 + 0x0800157c main+108 beq.n 0x8001576 + 0x0800157e main+110 ldr r3, [pc, #56] ; (0x80015b8 ) + 0x08001580 main+112 movs r2, #0 + 0x08001582 main+114 strb r2, [r3, #0] + 0x08001584 main+116 adds r3, r4, #1 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x0800157c primask 0x00 + r1 0x00000040 r6 0x00000000 r11 0x00000000 xPSR 0x61030000 basepri 0x00 + r2 0x006000d0 r7 0x00000000 r12 0xffffffff fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x0000001c r9 0x00000000 lr 0x08003fe9 psp 0x00000000 +### Source ########################################################################################################## + 119 mc_init(); + 120 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 121 HAL_TIM_Base_Start_IT(&htim6); + 122 uint16_t motor_degrees = 0; + 123 /* USER CODE END 2 */ + 124 + 125 /* Infinite loop */ + 126 /* USER CODE BEGIN WHILE */ + 127 while (1) + 128 { + 129 if (b_timer_struck) + 130 { + 131 // PDEBUG("%d\n", sys_time); + 132 b_timer_struck = false; + 133 motor_degrees = (motor_degrees + 1) % 360; + 134 mc_service(motor_degrees, 50); + 135 } + 136 /* USER CODE END WHILE */ + 137 + 138 /* USER CODE BEGIN 3 */ +### Stack ########################################################################################################### +[0] from 0x0800157c in main+108 at Core/Src/main.c:129 +### Threads ######################################################################################################### +[1] id 0 from 0x0800157c in main+108 at Core/Src/main.c:129 +### Variables ####################################################################################################### +loc motor_degrees = 28 +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0xa7c0 lma 0x80001c0 +Loading section .rodata, size 0x688 lma 0x800a980 +Loading section .ARM, size 0x8 lma 0x800b008 +Loading section .init_array, size 0x8 lma 0x800b010 +Loading section .fini_array, size 0x8 lma 0x800b018 +Loading section .data, size 0x9a8 lma 0x800b020 +Start address 0x08004010, load size 47512 +Transfer rate: 30 KB/sec, 5279 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +main () at Core/Src/main.c:121 +121 uint16_t motor_degrees = 0; +### Assembly ######################################################################################################## + 0x08001568 main+88 mov r0, r4 + 0x0800156a main+90 bl 0x8003e94 + 0x0800156e main+94 ldr r0, [pc, #68] ; (0x80015b4 ) + 0x08001570 main+96 bl 0x800198c + 0x08001574 main+100 movs r4, #0 + 0x08001576 main+102 ldr r3, [pc, #64] ; (0x80015b8 ) + 0x08001578 main+104 ldrb r3, [r3, #0] + 0x0800157a main+106 cmp r3, #0 + 0x0800157c main+108 beq.n 0x8001576 + 0x0800157e main+110 ldr r3, [pc, #56] ; (0x80015b8 ) +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x200009c8 r10 0x00000000 pc 0x08001576 primask 0x00 + r1 0x00000040 r6 0x00000000 r11 0x00000000 xPSR 0x61010000 basepri 0x00 + r2 0x00600090 r7 0x00000000 r12 0xffffffff fpscr 0x00000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x0000005a r9 0x00000000 lr 0x08003ff3 psp 0x00000000 +### Source ########################################################################################################## + 111 // HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_4); + 112 setPWM(&htim2, TIM_CHANNEL_2, 50); + 113 setPWM(&htim2, TIM_CHANNEL_4, 25); + 114 + 115 HAL_GPIO_WritePin(m1_dir_GPIO_Port, m1_dir_Pin, 1); + 116 HAL_GPIO_WritePin(m2_dir_GPIO_Port, m2_dir_Pin, 1); + 117 + 118 mc_init(&htim2); + 119 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 120 HAL_TIM_Base_Start_IT(&htim6); + 121 uint16_t motor_degrees = 0; + 122 /* USER CODE END 2 */ + 123 + 124 /* Infinite loop */ + 125 /* USER CODE BEGIN WHILE */ + 126 while (1) + 127 { + 128 if (b_timer_struck) + 129 { + 130 // PDEBUG("%d\n", sys_time); +### Stack ########################################################################################################### +[0] from 0x08001576 in main+102 at Core/Src/main.c:121 +### Threads ######################################################################################################### +[1] id 0 from 0x08001576 in main+102 at Core/Src/main.c:121 +### Variables ####################################################################################################### +loc motor_degrees = 0 +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0xa858 lma 0x80001c0 +Loading section .rodata, size 0x688 lma 0x800aa18 +Loading section .ARM, size 0x8 lma 0x800b0a0 +Loading section .init_array, size 0x8 lma 0x800b0a8 +Loading section .fini_array, size 0x8 lma 0x800b0b0 +Loading section .data, size 0x9a8 lma 0x800b0b8 +Start address 0x080040a8, load size 47664 +Transfer rate: 30 KB/sec, 5296 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +main () at Core/Src/main.c:128 +128 if (b_timer_struck) +### Assembly ######################################################################################################## + 0x0800156a main+90 mov r0, r5 + 0x0800156c main+92 bl 0x8003e98 + 0x08001570 main+96 ldr r0, [pc, #68] ; (0x80015b8 ) + 0x08001572 main+98 bl 0x8001990 + 0x08001576 main+102 movs r4, #0 + 0x08001578 main+104 ldr r3, [pc, #64] ; (0x80015bc ) + 0x0800157a main+106 ldrb r3, [r3, #0] + 0x0800157c main+108 cmp r3, #0 + 0x0800157e main+110 beq.n 0x8001578 + 0x08001580 main+112 ldr r3, [pc, #56] ; (0x80015bc ) +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a60 r10 0x00000000 pc 0x08001578 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x61010000 basepri 0x00 + r2 0x00000001 r7 0x00000000 r12 0x00001000 fpscr 0x20000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x00000004 r9 0x00000000 lr 0x08001f3d psp 0x00000000 +### Source ########################################################################################################## + 118 mc_init(&htim2); + 119 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 120 HAL_TIM_Base_Start_IT(&htim6); + 121 uint16_t motor_degrees = 0; + 122 /* USER CODE END 2 */ + 123 + 124 /* Infinite loop */ + 125 /* USER CODE BEGIN WHILE */ + 126 while (1) + 127 { + 128 if (b_timer_struck) + 129 { + 130 // PDEBUG("%d\n", sys_time); + 131 b_timer_struck = false; + 132 motor_degrees = (motor_degrees + 1) % 360; + 133 mc_service(motor_degrees, 50); + 134 } + 135 /* USER CODE END WHILE */ + 136 + 137 /* USER CODE BEGIN 3 */ +### Stack ########################################################################################################### +[0] from 0x08001578 in main+104 at Core/Src/main.c:128 +### Threads ######################################################################################################### +[1] id 0 from 0x08001578 in main+104 at Core/Src/main.c:128 +### Variables ####################################################################################################### +loc motor_degrees = 4 +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0xa858 lma 0x80001c0 +Loading section .rodata, size 0x688 lma 0x800aa18 +Loading section .ARM, size 0x8 lma 0x800b0a0 +Loading section .init_array, size 0x8 lma 0x800b0a8 +Loading section .fini_array, size 0x8 lma 0x800b0b0 +Loading section .data, size 0x9a8 lma 0x800b0b8 +Start address 0x080040a8, load size 47664 +Transfer rate: 30 KB/sec, 5296 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +0x0800157c in main () at Core/Src/main.c:128 +128 if (b_timer_struck) +### Assembly ######################################################################################################## + 0x08001570 main+96 ldr r0, [pc, #68] ; (0x80015b8 ) + 0x08001572 main+98 bl 0x8001990 + 0x08001576 main+102 movs r4, #0 + 0x08001578 main+104 ldr r3, [pc, #64] ; (0x80015bc ) + 0x0800157a main+106 ldrb r3, [r3, #0] + 0x0800157c main+108 cmp r3, #0 + 0x0800157e main+110 beq.n 0x8001578 + 0x08001580 main+112 ldr r3, [pc, #56] ; (0x80015bc ) + 0x08001582 main+114 movs r2, #0 + 0x08001584 main+116 strb r2, [r3, #0] +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a60 r10 0x00000000 pc 0x0800157c primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x61030000 basepri 0x00 + r2 0x00000001 r7 0x00000000 r12 0x00001000 fpscr 0x20000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x00000097 r9 0x00000000 lr 0x08001f3d psp 0x00000000 +### Source ########################################################################################################## + 118 mc_init(&htim2); + 119 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 120 HAL_TIM_Base_Start_IT(&htim6); + 121 uint16_t motor_degrees = 0; + 122 /* USER CODE END 2 */ + 123 + 124 /* Infinite loop */ + 125 /* USER CODE BEGIN WHILE */ + 126 while (1) + 127 { + 128 if (b_timer_struck) + 129 { + 130 // PDEBUG("%d\n", sys_time); + 131 b_timer_struck = false; + 132 motor_degrees = (motor_degrees + 1) % 360; + 133 mc_service(motor_degrees, 50); + 134 } + 135 /* USER CODE END WHILE */ + 136 + 137 /* USER CODE BEGIN 3 */ +### Stack ########################################################################################################### +[0] from 0x0800157c in main+108 at Core/Src/main.c:128 +### Threads ######################################################################################################### +[1] id 0 from 0x0800157c in main+108 at Core/Src/main.c:128 +### Variables ####################################################################################################### +loc motor_degrees = 151 +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0xa780 lma 0x80001c0 +Loading section .rodata, size 0x688 lma 0x800a940 +Loading section .ARM, size 0x8 lma 0x800afc8 +Loading section .init_array, size 0x8 lma 0x800afd0 +Loading section .fini_array, size 0x8 lma 0x800afd8 +Loading section .data, size 0x9a8 lma 0x800afe0 +Start address 0x08004060, load size 47448 +Transfer rate: 30 KB/sec, 5272 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +0x0800157a in main () at Core/Src/main.c:128 +128 if (b_timer_struck) +### Assembly ######################################################################################################## + 0x0800156c main+92 bl 0x8003e98 + 0x08001570 main+96 ldr r0, [pc, #68] ; (0x80015b8 ) + 0x08001572 main+98 bl 0x8001990 + 0x08001576 main+102 movs r4, #0 + 0x08001578 main+104 ldr r3, [pc, #64] ; (0x80015bc ) + 0x0800157a main+106 ldrb r3, [r3, #0] + 0x0800157c main+108 cmp r3, #0 + 0x0800157e main+110 beq.n 0x8001578 + 0x08001580 main+112 ldr r3, [pc, #56] ; (0x80015bc ) + 0x08001582 main+114 movs r2, #0 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a60 r10 0x00000000 pc 0x0800157a primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x61070000 basepri 0x00 + r2 0x00000001 r7 0x00000000 r12 0x00001000 fpscr 0x80000010 faultmask 0x00 + r3 0x200009c4 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x000000f3 r9 0x00000000 lr 0x08001f3d psp 0x00000000 +### Source ########################################################################################################## + 118 mc_init(&htim2); + 119 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 120 HAL_TIM_Base_Start_IT(&htim6); + 121 uint16_t motor_degrees = 0; + 122 /* USER CODE END 2 */ + 123 + 124 /* Infinite loop */ + 125 /* USER CODE BEGIN WHILE */ + 126 while (1) + 127 { + 128 if (b_timer_struck) + 129 { + 130 // PDEBUG("%d\n", sys_time); + 131 b_timer_struck = false; + 132 motor_degrees = (motor_degrees + 1) % 360; + 133 mc_service(motor_degrees, 50); + 134 } + 135 /* USER CODE END WHILE */ + 136 + 137 /* USER CODE BEGIN 3 */ +### Stack ########################################################################################################### +[0] from 0x0800157a in main+106 at Core/Src/main.c:128 +### Threads ######################################################################################################### +[1] id 0 from 0x0800157a in main+106 at Core/Src/main.c:128 +### Variables ####################################################################################################### +loc motor_degrees = 243 +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0xa780 lma 0x80001c0 +Loading section .rodata, size 0x688 lma 0x800a940 +Loading section .ARM, size 0x8 lma 0x800afc8 +Loading section .init_array, size 0x8 lma 0x800afd0 +Loading section .fini_array, size 0x8 lma 0x800afd8 +Loading section .data, size 0x9a8 lma 0x800afe0 +Start address 0x08004060, load size 47448 +Transfer rate: 30 KB/sec, 5272 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +main () at Core/Src/main.c:128 +128 if (b_timer_struck) +### Assembly ######################################################################################################## + 0x0800156a main+90 mov r0, r5 + 0x0800156c main+92 bl 0x8003e98 + 0x08001570 main+96 ldr r0, [pc, #68] ; (0x80015b8 ) + 0x08001572 main+98 bl 0x8001990 + 0x08001576 main+102 movs r4, #0 + 0x08001578 main+104 ldr r3, [pc, #64] ; (0x80015bc ) + 0x0800157a main+106 ldrb r3, [r3, #0] + 0x0800157c main+108 cmp r3, #0 + 0x0800157e main+110 beq.n 0x8001578 + 0x08001580 main+112 ldr r3, [pc, #56] ; (0x80015bc ) +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a60 r10 0x00000000 pc 0x08001578 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x61070000 basepri 0x00 + r2 0x00000001 r7 0x00000000 r12 0x00001000 fpscr 0x80000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x00000073 r9 0x00000000 lr 0x08001f3d psp 0x00000000 +### Source ########################################################################################################## + 118 mc_init(&htim2); + 119 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 120 HAL_TIM_Base_Start_IT(&htim6); + 121 uint16_t motor_degrees = 0; + 122 /* USER CODE END 2 */ + 123 + 124 /* Infinite loop */ + 125 /* USER CODE BEGIN WHILE */ + 126 while (1) + 127 { + 128 if (b_timer_struck) + 129 { + 130 // PDEBUG("%d\n", sys_time); + 131 b_timer_struck = false; + 132 motor_degrees = (motor_degrees + 1) % 360; + 133 mc_service(motor_degrees, 50); + 134 } + 135 /* USER CODE END WHILE */ + 136 + 137 /* USER CODE BEGIN 3 */ +### Stack ########################################################################################################### +[0] from 0x08001578 in main+104 at Core/Src/main.c:128 +### Threads ######################################################################################################### +[1] id 0 from 0x08001578 in main+104 at Core/Src/main.c:128 +### Variables ####################################################################################################### +loc motor_degrees = 115 +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0xa780 lma 0x80001c0 +Loading section .rodata, size 0x688 lma 0x800a940 +Loading section .ARM, size 0x8 lma 0x800afc8 +Loading section .init_array, size 0x8 lma 0x800afd0 +Loading section .fini_array, size 0x8 lma 0x800afd8 +Loading section .data, size 0x9a8 lma 0x800afe0 +Start address 0x08004060, load size 47448 +Transfer rate: 30 KB/sec, 5272 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +0x0800157c in main () at Core/Src/main.c:128 +128 if (b_timer_struck) +### Assembly ######################################################################################################## + 0x08001570 main+96 ldr r0, [pc, #68] ; (0x80015b8 ) + 0x08001572 main+98 bl 0x8001990 + 0x08001576 main+102 movs r4, #0 + 0x08001578 main+104 ldr r3, [pc, #64] ; (0x80015bc ) + 0x0800157a main+106 ldrb r3, [r3, #0] + 0x0800157c main+108 cmp r3, #0 + 0x0800157e main+110 beq.n 0x8001578 + 0x08001580 main+112 ldr r3, [pc, #56] ; (0x80015bc ) + 0x08001582 main+114 movs r2, #0 + 0x08001584 main+116 strb r2, [r3, #0] +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a60 r10 0x00000000 pc 0x0800157c primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x61010000 basepri 0x00 + r2 0x00000001 r7 0x00000000 r12 0x00001000 fpscr 0x20000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x00000023 r9 0x00000000 lr 0x08001f3d psp 0x00000000 +### Source ########################################################################################################## + 118 mc_init(&htim2); + 119 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 120 HAL_TIM_Base_Start_IT(&htim6); + 121 uint16_t motor_degrees = 0; + 122 /* USER CODE END 2 */ + 123 + 124 /* Infinite loop */ + 125 /* USER CODE BEGIN WHILE */ + 126 while (1) + 127 { + 128 if (b_timer_struck) + 129 { + 130 // PDEBUG("%d\n", sys_time); + 131 b_timer_struck = false; + 132 motor_degrees = (motor_degrees + 1) % 360; + 133 mc_service(motor_degrees, 50); + 134 } + 135 /* USER CODE END WHILE */ + 136 + 137 /* USER CODE BEGIN 3 */ +### Stack ########################################################################################################### +[0] from 0x0800157c in main+108 at Core/Src/main.c:128 +### Threads ######################################################################################################### +[1] id 0 from 0x0800157c in main+108 at Core/Src/main.c:128 +### Variables ####################################################################################################### +loc motor_degrees = 35 +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0xa780 lma 0x80001c0 +Loading section .rodata, size 0x688 lma 0x800a940 +Loading section .ARM, size 0x8 lma 0x800afc8 +Loading section .init_array, size 0x8 lma 0x800afd0 +Loading section .fini_array, size 0x8 lma 0x800afd8 +Loading section .data, size 0x9a8 lma 0x800afe0 +Start address 0x08004060, load size 47448 +Transfer rate: 30 KB/sec, 5272 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +0x0800157c in main () at Core/Src/main.c:128 +128 if (b_timer_struck) +### Assembly ######################################################################################################## + 0x08001570 main+96 ldr r0, [pc, #68] ; (0x80015b8 ) + 0x08001572 main+98 bl 0x8001990 + 0x08001576 main+102 movs r4, #0 + 0x08001578 main+104 ldr r3, [pc, #64] ; (0x80015bc ) + 0x0800157a main+106 ldrb r3, [r3, #0] + 0x0800157c main+108 cmp r3, #0 + 0x0800157e main+110 beq.n 0x8001578 + 0x08001580 main+112 ldr r3, [pc, #56] ; (0x80015bc ) + 0x08001582 main+114 movs r2, #0 + 0x08001584 main+116 strb r2, [r3, #0] +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a60 r10 0x00000000 pc 0x0800157c primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x61070000 basepri 0x00 + r2 0x00000001 r7 0x00000000 r12 0x00001000 fpscr 0x80000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x00000089 r9 0x00000000 lr 0x08001f3d psp 0x00000000 +### Source ########################################################################################################## + 118 mc_init(&htim2); + 119 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 120 HAL_TIM_Base_Start_IT(&htim6); + 121 uint16_t motor_degrees = 0; + 122 /* USER CODE END 2 */ + 123 + 124 /* Infinite loop */ + 125 /* USER CODE BEGIN WHILE */ + 126 while (1) + 127 { + 128 if (b_timer_struck) + 129 { + 130 // PDEBUG("%d\n", sys_time); + 131 b_timer_struck = false; + 132 motor_degrees = (motor_degrees + 1) % 360; + 133 mc_service(motor_degrees, 50); + 134 } + 135 /* USER CODE END WHILE */ + 136 + 137 /* USER CODE BEGIN 3 */ +### Stack ########################################################################################################### +[0] from 0x0800157c in main+108 at Core/Src/main.c:128 +### Threads ######################################################################################################### +[1] id 0 from 0x0800157c in main+108 at Core/Src/main.c:128 +### Variables ####################################################################################################### +loc motor_degrees = 137 +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0xa780 lma 0x80001c0 +Loading section .rodata, size 0x688 lma 0x800a940 +Loading section .ARM, size 0x8 lma 0x800afc8 +Loading section .init_array, size 0x8 lma 0x800afd0 +Loading section .fini_array, size 0x8 lma 0x800afd8 +Loading section .data, size 0x9a8 lma 0x800afe0 +Start address 0x08004060, load size 47448 +Transfer rate: 30 KB/sec, 5272 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +0x0800157c in main () at Core/Src/main.c:128 +128 if (b_timer_struck) +### Assembly ######################################################################################################## + 0x08001570 main+96 ldr r0, [pc, #68] ; (0x80015b8 ) + 0x08001572 main+98 bl 0x8001990 + 0x08001576 main+102 movs r4, #0 + 0x08001578 main+104 ldr r3, [pc, #64] ; (0x80015bc ) + 0x0800157a main+106 ldrb r3, [r3, #0] + 0x0800157c main+108 cmp r3, #0 + 0x0800157e main+110 beq.n 0x8001578 + 0x08001580 main+112 ldr r3, [pc, #56] ; (0x80015bc ) + 0x08001582 main+114 movs r2, #0 + 0x08001584 main+116 strb r2, [r3, #0] +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a60 r10 0x00000000 pc 0x0800157c primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x61010000 basepri 0x00 + r2 0x00000001 r7 0x00000000 r12 0x00001000 fpscr 0x20000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x00000043 r9 0x00000000 lr 0x08001f3d psp 0x00000000 +### Source ########################################################################################################## + 118 mc_init(&htim2); + 119 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 120 HAL_TIM_Base_Start_IT(&htim6); + 121 uint16_t motor_degrees = 0; + 122 /* USER CODE END 2 */ + 123 + 124 /* Infinite loop */ + 125 /* USER CODE BEGIN WHILE */ + 126 while (1) + 127 { + 128 if (b_timer_struck) + 129 { + 130 // PDEBUG("%d\n", sys_time); + 131 b_timer_struck = false; + 132 motor_degrees = (motor_degrees + 1) % 360; + 133 mc_service(motor_degrees, 50); + 134 } + 135 /* USER CODE END WHILE */ + 136 + 137 /* USER CODE BEGIN 3 */ +### Stack ########################################################################################################### +[0] from 0x0800157c in main+108 at Core/Src/main.c:128 +### Threads ######################################################################################################### +[1] id 0 from 0x0800157c in main+108 at Core/Src/main.c:128 +### Variables ####################################################################################################### +loc motor_degrees = 67 +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0xa780 lma 0x80001c0 +Loading section .rodata, size 0x688 lma 0x800a940 +Loading section .ARM, size 0x8 lma 0x800afc8 +Loading section .init_array, size 0x8 lma 0x800afd0 +Loading section .fini_array, size 0x8 lma 0x800afd8 +Loading section .data, size 0x9a8 lma 0x800afe0 +Start address 0x08004060, load size 47448 +Transfer rate: 30 KB/sec, 5272 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +0x0800157c in main () at Core/Src/main.c:128 +128 if (b_timer_struck) +### Assembly ######################################################################################################## + 0x08001570 main+96 ldr r0, [pc, #68] ; (0x80015b8 ) + 0x08001572 main+98 bl 0x8001990 + 0x08001576 main+102 movs r4, #0 + 0x08001578 main+104 ldr r3, [pc, #64] ; (0x80015bc ) + 0x0800157a main+106 ldrb r3, [r3, #0] + 0x0800157c main+108 cmp r3, #0 + 0x0800157e main+110 beq.n 0x8001578 + 0x08001580 main+112 ldr r3, [pc, #56] ; (0x80015bc ) + 0x08001582 main+114 movs r2, #0 + 0x08001584 main+116 strb r2, [r3, #0] +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a60 r10 0x00000000 pc 0x0800157c primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x61070000 basepri 0x00 + r2 0x00000001 r7 0x00000000 r12 0x00001000 fpscr 0x80000010 faultmask 0x00 + r3 0x00000000 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x0000008b r9 0x00000000 lr 0x08001f3d psp 0x00000000 +### Source ########################################################################################################## + 118 mc_init(&htim2); + 119 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 120 HAL_TIM_Base_Start_IT(&htim6); + 121 uint16_t motor_degrees = 0; + 122 /* USER CODE END 2 */ + 123 + 124 /* Infinite loop */ + 125 /* USER CODE BEGIN WHILE */ + 126 while (1) + 127 { + 128 if (b_timer_struck) + 129 { + 130 // PDEBUG("%d\n", sys_time); + 131 b_timer_struck = false; + 132 motor_degrees = (motor_degrees + 1) % 360; + 133 mc_service(motor_degrees, 50); + 134 } + 135 /* USER CODE END WHILE */ + 136 + 137 /* USER CODE BEGIN 3 */ +### Stack ########################################################################################################### +[0] from 0x0800157c in main+108 at Core/Src/main.c:128 +### Threads ######################################################################################################### +[1] id 0 from 0x0800157c in main+108 at Core/Src/main.c:128 +### Variables ####################################################################################################### +loc motor_degrees = 139 +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0xa780 lma 0x80001c0 +Loading section .rodata, size 0x688 lma 0x800a940 +Loading section .ARM, size 0x8 lma 0x800afc8 +Loading section .init_array, size 0x8 lma 0x800afd0 +Loading section .fini_array, size 0x8 lma 0x800afd8 +Loading section .data, size 0x9a8 lma 0x800afe0 +Start address 0x08004060, load size 47448 +Transfer rate: 30 KB/sec, 5272 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +0x0800157a in main () at Core/Src/main.c:128 +128 if (b_timer_struck) +### Assembly ######################################################################################################## + 0x0800156c main+92 bl 0x8003e98 + 0x08001570 main+96 ldr r0, [pc, #68] ; (0x80015b8 ) + 0x08001572 main+98 bl 0x8001990 + 0x08001576 main+102 movs r4, #0 + 0x08001578 main+104 ldr r3, [pc, #64] ; (0x80015bc ) + 0x0800157a main+106 ldrb r3, [r3, #0] + 0x0800157c main+108 cmp r3, #0 + 0x0800157e main+110 beq.n 0x8001578 + 0x08001580 main+112 ldr r3, [pc, #56] ; (0x80015bc ) + 0x08001582 main+114 movs r2, #0 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x20000a60 r10 0x00000000 pc 0x0800157a primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x61010000 basepri 0x00 + r2 0x00000001 r7 0x00000000 r12 0x00001000 fpscr 0x20000010 faultmask 0x00 + r3 0x200009c4 r8 0x00000000 sp 0x2000fff0 msp 0x2000fff0 control 0x04 + r4 0x00000021 r9 0x00000000 lr 0x08001f3d psp 0x00000000 +### Source ########################################################################################################## + 118 mc_init(&htim2); + 119 HAL_UART_Receive_IT(&huart2, &huart2_rxc, 1); + 120 HAL_TIM_Base_Start_IT(&htim6); + 121 uint16_t motor_degrees = 0; + 122 /* USER CODE END 2 */ + 123 + 124 /* Infinite loop */ + 125 /* USER CODE BEGIN WHILE */ + 126 while (1) + 127 { + 128 if (b_timer_struck) + 129 { + 130 // PDEBUG("%d\n", sys_time); + 131 b_timer_struck = false; + 132 motor_degrees = (motor_degrees + 1) % 360; + 133 mc_service(motor_degrees, 50); + 134 } + 135 /* USER CODE END WHILE */ + 136 + 137 /* USER CODE BEGIN 3 */ +### Stack ########################################################################################################### +[0] from 0x0800157a in main+106 at Core/Src/main.c:128 +### Threads ######################################################################################################### +[1] id 0 from 0x0800157a in main+106 at Core/Src/main.c:128 +### Variables ####################################################################################################### +loc motor_degrees = 33 +##################################################################################################################### +Loading section .isr_vector, size 0x190 lma 0x8000000 +Loading section .text, size 0xa780 lma 0x80001c0 +Loading section .rodata, size 0x688 lma 0x800a940 +Loading section .ARM, size 0x8 lma 0x800afc8 +Loading section .init_array, size 0x8 lma 0x800afd0 +Loading section .fini_array, size 0x8 lma 0x800afd8 +Loading section .data, size 0x9a8 lma 0x800afe0 +Start address 0x08004060, load size 47448 +Transfer rate: 30 KB/sec, 5272 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] diff --git a/motor_controller.ioc b/motor_controller.ioc index 082d26f..e510e88 100644 --- a/motor_controller.ioc +++ b/motor_controller.ioc @@ -193,7 +193,7 @@ 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.Period=249 TIM6.Prescaler=127 USART2.IPParameters=VirtualMode-Asynchronous USART2.VirtualMode-Asynchronous=VM_ASYNC diff --git a/shared/devices/motor_controller.c b/shared/devices/motor_controller.c index 5cffd4c..124333b 100644 --- a/shared/devices/motor_controller.c +++ b/shared/devices/motor_controller.c @@ -1,11 +1,28 @@ #include "motor_controller.h" +#include +#include "putil.h" +#include "stm32l4xx_hal_tim.h" -void mc_init() +static TIM_HandleTypeDef* _motor_timer = NULL; +void mc_init(TIM_HandleTypeDef* tim) { - // + _motor_timer = tim; } -void mc_service() +// degrees is anything from 0-359 +// speed is anything from 0-99 +void mc_service(uint16_t degrees, uint8_t speed) { - + float right_pwm = cos(((float)degrees*(3.1415 / 180.0f))); + float left_pwm = right_pwm; + PDEBUG("| DEGREES | COS | SIN | \n"); + PDEBUG("| %7d | %-5.3f | %-5.3f | \n", + (int)degrees, + right_pwm, + right_pwm); + + HAL_GPIO_WritePin(m1_dir_GPIO_Port, m1_dir_Pin, right_pwm >= 0 ? 0 : 1); + HAL_GPIO_WritePin(m2_dir_GPIO_Port, m2_dir_Pin, left_pwm >= 0 ? 0 : 1); + setPWM(_motor_timer, TIM_CHANNEL_2, abs((int)(right_pwm * 100.0))); + setPWM(_motor_timer, TIM_CHANNEL_4, abs((int)(left_pwm * 100.0))); } diff --git a/shared/devices/motor_controller.h b/shared/devices/motor_controller.h index c0700e7..3061696 100644 --- a/shared/devices/motor_controller.h +++ b/shared/devices/motor_controller.h @@ -3,8 +3,8 @@ #include "main.h" -void mc_init(void); +void mc_init(TIM_HandleTypeDef* tim); -void mc_service(void); +void mc_service(uint16_t degrees, uint8_t speed); #endif