diff --git a/AutonomousDistroBoard/.gitignore b/AutonomousDistroBoard/.gitignore index 9612dd8..c8384e3 100644 --- a/AutonomousDistroBoard/.gitignore +++ b/AutonomousDistroBoard/.gitignore @@ -1,5 +1,6 @@ Debug/ Release/ .settings/ +.cache/ .metadata/ .DS_Store \ No newline at end of file diff --git a/AutonomousDistroBoard/.mxproject b/AutonomousDistroBoard/.mxproject index 5d4f1f4..1f3f62c 100644 --- a/AutonomousDistroBoard/.mxproject +++ b/AutonomousDistroBoard/.mxproject @@ -1,5 +1,5 @@ [PreviousLibFiles] -LibFiles=Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_can.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_bus.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_rcc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_system.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_utils.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_gpio.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_dma.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_dmamux.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_pwr.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_cortex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h;Drivers/STM32F4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_exti.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_exti.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_tim.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_usart.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pcd.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pcd_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_usb.h;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_can.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_bus.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_rcc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_system.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_utils.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_gpio.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_dma.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_dmamux.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_pwr.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_cortex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h;Drivers/STM32F4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_exti.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_exti.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_tim.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_usart.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pcd.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pcd_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_usb.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f407xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/tz_context.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/mpu_armv7.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/cmsis_iccarm.h;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_armv8mbl.h; +LibFiles=Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_can.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_bus.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_rcc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_system.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_utils.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_gpio.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_dma.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_dmamux.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_pwr.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_cortex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h;Drivers/STM32F4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_exti.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_exti.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_tim.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_usart.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pcd.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pcd_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_usb.h;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_can.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_bus.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_rcc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_system.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_utils.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_gpio.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_dma.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_dmamux.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_pwr.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_cortex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h;Drivers/STM32F4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_exti.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_exti.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_tim.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_usart.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pcd.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pcd_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_usb.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f407xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/tz_context.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/mpu_armv7.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/cmsis_iccarm.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/core_armv8mbl.h;Drivers/CMSIS/Include/core_sc000.h; [PreviousUsedCubeIDEFiles] SourceFiles=Core/Src/main.c;Core/Src/stm32f4xx_it.c;Core/Src/stm32f4xx_hal_msp.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c;Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c;Core/Src/system_stm32f4xx.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c;Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c;Core/Src/system_stm32f4xx.c;;; diff --git a/AutonomousDistroBoard/AutonomousDistroBoard.ioc b/AutonomousDistroBoard/AutonomousDistroBoard.ioc index 7961d03..3e19a10 100644 --- a/AutonomousDistroBoard/AutonomousDistroBoard.ioc +++ b/AutonomousDistroBoard/AutonomousDistroBoard.ioc @@ -2,26 +2,41 @@ CAD.formats= CAD.pinconfig= CAD.provider= -CAN2.BS1=CAN_BS1_1TQ -CAN2.BS2=CAN_BS2_1TQ -CAN2.CalculateBaudRate=625000 -CAN2.CalculateTimeBit=1600 -CAN2.CalculateTimeQuantum=533.3333333333334 -CAN2.IPParameters=CalculateTimeQuantum,CalculateTimeBit,CalculateBaudRate,BS1,BS2 +CAN2.BS1=CAN_BS1_12TQ +CAN2.BS2=CAN_BS2_2TQ +CAN2.CalculateBaudRate=499999 +CAN2.CalculateTimeBit=2000 +CAN2.CalculateTimeQuantum=133.33333333333334 +CAN2.IPParameters=CalculateTimeQuantum,CalculateTimeBit,CalculateBaudRate,BS1,BS2,Prescaler +CAN2.Prescaler=4 +Dma.Request0=USART3_RX +Dma.RequestsNb=1 +Dma.USART3_RX.0.Direction=DMA_PERIPH_TO_MEMORY +Dma.USART3_RX.0.FIFOMode=DMA_FIFOMODE_DISABLE +Dma.USART3_RX.0.Instance=DMA1_Stream1 +Dma.USART3_RX.0.MemDataAlignment=DMA_MDATAALIGN_BYTE +Dma.USART3_RX.0.MemInc=DMA_MINC_ENABLE +Dma.USART3_RX.0.Mode=DMA_CIRCULAR +Dma.USART3_RX.0.PeriphDataAlignment=DMA_PDATAALIGN_BYTE +Dma.USART3_RX.0.PeriphInc=DMA_PINC_DISABLE +Dma.USART3_RX.0.Priority=DMA_PRIORITY_HIGH +Dma.USART3_RX.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode File.Version=6 +GPIO.groupedBy=Group By Peripherals KeepUserPlacement=false Mcu.CPN=STM32F407VGT6 Mcu.Family=STM32F4 Mcu.IP0=CAN2 -Mcu.IP1=NVIC -Mcu.IP2=RCC -Mcu.IP3=SYS -Mcu.IP4=TIM1 -Mcu.IP5=TIM11 -Mcu.IP6=UART5 -Mcu.IP7=USART3 -Mcu.IP8=USB_OTG_FS -Mcu.IPNb=9 +Mcu.IP1=DMA +Mcu.IP2=NVIC +Mcu.IP3=RCC +Mcu.IP4=SYS +Mcu.IP5=TIM1 +Mcu.IP6=TIM11 +Mcu.IP7=UART5 +Mcu.IP8=USART3 +Mcu.IP9=USB_OTG_FS +Mcu.IPNb=10 Mcu.Name=STM32F407V(E-G)Tx Mcu.Package=LQFP100 Mcu.Pin0=PE5 @@ -51,6 +66,8 @@ Mcu.UserName=STM32F407VGTx MxCube.Version=6.8.0 MxDb.Version=DB.6.0.80 NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false +NVIC.CAN2_RX0_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true +NVIC.DMA1_Stream1_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:true NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false NVIC.ForceEnableDMAVector=true NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false @@ -83,6 +100,8 @@ PB5.Signal=CAN2_RX PB6.Locked=true PB6.Mode=CAN_Activate PB6.Signal=CAN2_TX +PB7.GPIOParameters=GPIO_Label +PB7.GPIO_Label=CAN_S PB7.Locked=true PB7.Signal=GPIO_Output PB9.Locked=true @@ -93,10 +112,16 @@ PC12.Signal=UART5_TX PD2.Locked=true PD2.Mode=Asynchronous PD2.Signal=UART5_RX +PE5.GPIOParameters=GPIO_Label +PE5.GPIO_Label=MAIN_COIL_EN PE5.Locked=true PE5.Signal=GPIO_Output +PE6.GPIOParameters=GPIO_Label +PE6.GPIO_Label=PRECHARGE_EN PE6.Locked=true PE6.Signal=GPIO_Output +PE8.GPIOParameters=GPIO_Label +PE8.GPIO_Label=LED_OUT PE8.Locked=true PE8.Signal=GPIO_Output PE9.Locked=true @@ -110,7 +135,6 @@ PH1-OSC_OUT.Signal=RCC_OSC_OUT PinOutPanel.RotationAngle=0 ProjectManager.AskForMigrate=true ProjectManager.BackupPrevious=false -ProjectManager.CompilerLinker=GCC ProjectManager.CompilerOptimize=6 ProjectManager.ComputerToolchain=false ProjectManager.CoupleFile=false @@ -136,10 +160,8 @@ ProjectManager.RegisterCallBack= ProjectManager.StackSize=0x400 ProjectManager.TargetToolchain=STM32CubeIDE ProjectManager.ToolChainLocation= -ProjectManager.UAScriptAfterPath= -ProjectManager.UAScriptBeforePath= ProjectManager.UnderRoot=true -ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_CAN2_Init-CAN2-false-HAL-true,4-MX_UART5_Init-UART5-false-HAL-true,5-MX_TIM1_Init-TIM1-false-HAL-true,6-MX_TIM11_Init-TIM11-false-HAL-true,7-MX_USART3_UART_Init-USART3-false-HAL-true,8-MX_USB_OTG_FS_PCD_Init-USB_OTG_FS-false-HAL-true +ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_CAN2_Init-CAN2-false-HAL-true,5-MX_UART5_Init-UART5-false-HAL-true,6-MX_TIM1_Init-TIM1-false-HAL-true,7-MX_TIM11_Init-TIM11-false-HAL-true,8-MX_USART3_UART_Init-USART3-false-HAL-true,9-MX_USB_OTG_FS_PCD_Init-USB_OTG_FS-false-HAL-true RCC.48MHZClocksFreq_Value=48000000 RCC.AHBFreq_Value=120000000 RCC.APB1CLKDivider=RCC_HCLK_DIV4 @@ -153,37 +175,45 @@ RCC.EthernetFreq_Value=120000000 RCC.FCLKCortexFreq_Value=120000000 RCC.FamilyName=M RCC.HCLKFreq_Value=120000000 -RCC.HSE_VALUE=25000000 +RCC.HSE_VALUE=8000000 RCC.HSI_VALUE=16000000 -RCC.I2SClocksFreq_Value=160000000 +RCC.I2SClocksFreq_Value=96000000 RCC.IPParameters=48MHZClocksFreq_Value,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2CLKDivider,APB2Freq_Value,APB2TimFreq_Value,CortexFreq_Value,EthernetFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI_VALUE,I2SClocksFreq_Value,LSE_VALUE,LSI_VALUE,MCO2PinFreq_Value,PLLCLKFreq_Value,PLLM,PLLN,PLLQ,PLLQCLKFreq_Value,RTCFreq_Value,RTCHSEDivFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,VCOI2SOutputFreq_Value,VCOInputFreq_Value,VCOOutputFreq_Value,VcooutputI2S RCC.LSE_VALUE=32768 RCC.LSI_VALUE=32000 RCC.MCO2PinFreq_Value=120000000 RCC.PLLCLKFreq_Value=120000000 -RCC.PLLM=15 -RCC.PLLN=144 +RCC.PLLM=8 +RCC.PLLN=240 RCC.PLLQ=5 RCC.PLLQCLKFreq_Value=48000000 RCC.RTCFreq_Value=32000 -RCC.RTCHSEDivFreq_Value=12500000 +RCC.RTCHSEDivFreq_Value=4000000 RCC.SYSCLKFreq_VALUE=120000000 RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK -RCC.VCOI2SOutputFreq_Value=320000000 -RCC.VCOInputFreq_Value=1666666.6666666667 +RCC.VCOI2SOutputFreq_Value=192000000 +RCC.VCOInputFreq_Value=1000000 RCC.VCOOutputFreq_Value=240000000 -RCC.VcooutputI2S=160000000 +RCC.VcooutputI2S=96000000 SH.S_TIM11_CH1.0=TIM11_CH1,PWM Generation1 CH1 SH.S_TIM11_CH1.ConfNb=1 SH.S_TIM1_CH1.0=TIM1_CH1,PWM Generation1 CH1 SH.S_TIM1_CH1.ConfNb=1 TIM1.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1 -TIM1.IPParameters=Channel-PWM Generation1 CH1 +TIM1.IPParameters=Channel-PWM Generation1 CH1,Prescaler,Period,Pulse-PWM Generation1 CH1,OCIdleState_1 +TIM1.OCIdleState_1=TIM_OCIDLESTATE_RESET +TIM1.Period=19999 +TIM1.Prescaler=119 +TIM1.Pulse-PWM\ Generation1\ CH1=1500 TIM11.Channel=TIM_CHANNEL_1 -TIM11.IPParameters=Channel +TIM11.IPParameters=Channel,Prescaler,Period,Pulse +TIM11.Period=19999 +TIM11.Prescaler=119 +TIM11.Pulse=1000 UART5.IPParameters=VirtualMode UART5.VirtualMode=Asynchronous -USART3.IPParameters=VirtualMode +USART3.IPParameters=VirtualMode,Mode +USART3.Mode=MODE_TX_RX USART3.VirtualMode=VM_ASYNC USB_OTG_FS.IPParameters=VirtualMode USB_OTG_FS.VirtualMode=Device_Only diff --git a/AutonomousDistroBoard/Core/Inc/can.h b/AutonomousDistroBoard/Core/Inc/can.h new file mode 100644 index 0000000..4fc308c --- /dev/null +++ b/AutonomousDistroBoard/Core/Inc/can.h @@ -0,0 +1,51 @@ +#ifndef CAN_H +#define CAN_H + +#include +#include + +#include "stm32f4xx_hal.h" + + +#define CAN_BUS (CAN2) + + +// - ID = `0x100` - **Control commands** (RX) +// - Byte 0-1: throttle (uint16_t, little endian), 0-1000, where 1000 = full throttle +// - Byte 2-3: steering (uint16_t, little endian), 0-1000, where 1000 = full right, 500 = center, 0 = full left +// - Byte 4-7: reserved / future use +#define CAN_ID_CONTROL (0x100) +#define CAN_CONTROL_MIN_BYTES (4) +#define CAN_THROTTLE_MAX (1000) +#define CAN_STEERING_MAX (1000) +typedef struct { + uint16_t throttle; // 0-1000 + uint16_t steering; // 0-1000 +} can_control_msg_t; + + +// - ID = `0x101` - **Status update** (TX) +// - Byte 0: state machine mode + rc mode +// - Bits0-3 = state machine mode (see logic.h::logic_mode_t) +// - Bit4 = RC mode (0 = rc mode, 1 = autonomous mode) +// - Bits5-7 = reserved +// - Byte 1-2: throttle PWM (uint16_t, little endian), the actual PWM value being sent to the ESC for throttle (1000-2000) +// - Byte 3-4: steering PWM (uint16_t, little endian), the actual PWM value being sent to the servo for steering (1000-2000) +// - Byte 5-7: reserved / future use +#define CAN_ID_STATUS (0x101) +typedef struct { + uint8_t mode; // logic_mode_t + bool rc_mode; // false = rc mode, true = autonomous mode + uint16_t throttle_pwm; // actual PWM value being sent to the ESC for throttle (1000-2000) + uint16_t steering_pwm; // actual PWM value being sent to the servo for steering (1000-2000) +} can_status_msg_t; + + +can_control_msg_t parse_can_control(const uint8_t* data); +void send_can_status(const can_status_msg_t* status, CAN_HandleTypeDef* hcan); + +uint16_t can_throttle_to_pwm(const can_control_msg_t* cmd); +uint16_t can_steering_to_pwm(const can_control_msg_t* cmd); + + +#endif // CAN_H \ No newline at end of file diff --git a/AutonomousDistroBoard/Core/Inc/ibus.h b/AutonomousDistroBoard/Core/Inc/ibus.h new file mode 100644 index 0000000..9b8d3f4 --- /dev/null +++ b/AutonomousDistroBoard/Core/Inc/ibus.h @@ -0,0 +1,45 @@ +#ifndef IBUS_H +#define IBUS_H + +#include +#include + +#include "stm32f4xx_hal.h" + + +#define IBUS_CHANNEL_COUNT (14) +#define IBUS_FRAME_SIZE (32) +#define IBUS_DMA_BUFFER_SIZE (128) + +#define IBUS_HEADER_DLC (0x20) +#define IBUS_HEADER_COMMAND (0x40) + + +// iBUS data structure +typedef struct { + uint32_t last_frame_time; // HAL_GetTick() timestamp of when the last valid frame was received + uint8_t dma_buffer[IBUS_DMA_BUFFER_SIZE]; // DMA buffer for incoming UART data + uint8_t frame[IBUS_FRAME_SIZE]; // Buffer for assembling a single iBUS frame + uint8_t frame_index; // Current index in the frame buffer + uint16_t dma_last_pos; // Last processed position in the DMA buffer + uint16_t channels[IBUS_CHANNEL_COUNT]; // PWM values +} ibus_t; + + +void ibus_init(ibus_t* ibus); + +bool ibus_is_connected(const ibus_t* ibus, uint32_t now, uint32_t timeout_ms); + + +// Should be called in the main loop / 1kHz task to process incoming iBUS data +void ibus_process(ibus_t* ibus, UART_HandleTypeDef *sbus_huart); +// Single-byte feed (sync finder style), called by ibus_process +void ibus_parse_byte(ibus_t* ibus, uint8_t byte); + + + + + + + +#endif // IBUS_H \ No newline at end of file diff --git a/AutonomousDistroBoard/Core/Inc/logic.h b/AutonomousDistroBoard/Core/Inc/logic.h new file mode 100644 index 0000000..28c80fb --- /dev/null +++ b/AutonomousDistroBoard/Core/Inc/logic.h @@ -0,0 +1,122 @@ +#ifndef LOGIC_H +#define LOGIC_H + +#include + +#include "stm32f4xx_hal.h" + +#include "ibus.h" +#include "can.h" +#include "util.h" + + +#define PRECHARGE_START_DELAY (200) // ms, wait from boot before starting precharge +#define PRECHARGE_DURATION (5000) // ms, how long to run precharge before closing contactor +#define CONTACTOR_CLOSED_DELAY (100) // ms, how long to wait after contactor is requested to be closed before considering it fully closed +#define RECOVERING_DELAY (5000) // ms, how long to wait after transistioning after a fault (E-STOP, RC disconnect, CAN disconnect) before allowing to transition back to STARTING mode/precharge sequence + +#define IBUS_CHANNEL_THROTTLE (0) // 1000 = full stop, 2000 = full throttle forward +#define IBUS_CHANNEL_STEERING (1) // 1000 = full left, 1500 = center, 2000 = full right +#define IBUS_CHANNEL_MODE (2) // ~1000 = RC mode, ~2000 = autonomous mode +#define IBUS_CHANNEL_ESTOP (3) // ~1000 = not pressed, ~2000 = estop + +#define ESTOP_PWM_THRESHOLD (1500) // if the ESTOP channel goes above this value, consider the remote estop to be triggered +#define ESTOP_RISING_DEBOUNCE (300) // ms, require the ESTOP channel to be above the threshold for at least this long before considering the remote estop to be triggered +#define ESTOP_ACCUMULATING_DEBOUNCE (30) // ms, when the rising ESTOP is debouncing/accumulating, require the ESTOP channel to be below the threshold for at least this long before resetting the debounce timer +#define ESTOP_FALLING_DEBOUNCE (300) // ms, require the ESTOP channel to be below the threshold for at least this long before considering the remote estop to be no longer triggered + +#define MODE_PWM_THRESHOLD (1500) // if the MODE channel is above this value, consider it to be in autonomous mode, otherwise RC mode +#define MODE_DEBOUNCE_MS (500) // ms, require the MODE channel to be consistently above or below the threshold for at least this long before switching modes +#define MODE_ACCUMULATING_DEBOUNCE_MS (50) // ms, when the rising MODE is debouncing/accumulating, require the MODE channel to be below the threshold for at least this long before resetting the debounce timer + +#define CAN_TX_PERIOD (10) // ms +#define CAN_RX_TIMEOUT (50) // ms + +#define RC_CONNECTION_TIMEOUT (100) // ms, if we did not get a valid iBUS frame within this time, consider the RC connection to be lost + +// Really these are half periods b/c it is the rate at which the LED toggles +#define LED_STARTING_PERIOD (100) // ms +#define LED_PRECHARGING_PERIOD (400) // ms +#define LED_CONTACTOR_CLOSING_PERIOD (50) // ms +#define LED_RUNNING_RC_PERIOD (1000) // ms +#define LED_RUNNING_AUTONOMOUS_PERIOD (250) // ms +#define LED_ESTOPPED_PERIOD (0) // solid on +#define LED_RC_DISCONNECTED_PERIOD (0) // solid on +#define LED_CAN_DISCONNECTED_PERIOD (0) // solid on +#define LED_RECOVERING_PERIOD (2000) // ms + +#define THROTTLE_PWM_LOW (1000) +#define THROTTLE_PWM_HIGH (2000) +#define STEERING_PWM_LOW (1000) +#define STEERING_PWM_HIGH (2000) +#define STEERING_PWM_CENTER ((STEERING_PWM_LOW + STEERING_PWM_HIGH) / 2) + +#define THROTTLE_PWM_GPIO_Port (GPIOB) +#define THROTTLE_PWM_Pin (GPIO_PIN_9) +#define THROTTLE_PWM_AF (GPIO_AF2_TIM4) + +#define STEERING_PWM_GPIO_Port (GPIOE) +#define STEERING_PWM_Pin (GPIO_PIN_9) +#define STEERING_PWM_AF (GPIO_AF3_TIM11) + +#define RC_MODE_THROTTLE_DIVISOR (3) // divide the iBUS throttle PWM by this much + +typedef enum { + LOGIC_MODE_STARTING = 0, + LOGIC_MODE_PRECHARGING, + LOGIC_MODE_CONTACTOR_CLOSING, + LOGIC_MODE_RUNNING, + LOGIC_MODE_ESTOPPED, + LOGIC_MODE_RC_DISCONNECTED, + LOGIC_MODE_CAN_DISCONNECTED, + LOGIC_MODE_RECOVERING, +} logic_mode_t; + + +typedef struct { + logic_mode_t mode; + + ibus_t ibus; + uint32_t last_can_tx_time; + + uint32_t start_time; // HAL_GetTick() timestamp of when the precharge sequence started + + debounce_controller_t estop_debounce; // debounce controller for the remote estop channel + debounce_controller_t mode_debounce; // low = RC mode, high = autonomous mode + + volatile uint16_t can_current_throttle_pwm; // 1000-2000, updated by CAN RX callback + volatile uint16_t can_current_steering_pwm; // 1000-2000, updated by CAN RX callback + volatile uint32_t last_control_timestamp; // HAL_GetTick() timestamp of last received control message + + uint32_t led_blink_timestamp; // HAL_GetTick() timestamp of last LED toggle + + uint16_t output_throttle_pwm; // 1000-2000, the throttle PWM value that we will output (either from iBUS or CAN depending on mode) + uint16_t output_steering_pwm; // 1000-2000, the steering PWM value that we will output (either from iBUS or CAN depending on mode) + bool throttle_enabled; // whether the PWM channel for the throttle is enabled vs in input/high-impedance mode +} logic_state_t; + +void logic_init(logic_state_t* state); + + +// Called once in the main loop +void logic_run( + logic_state_t* state, + UART_HandleTypeDef *sbus_huart, + CAN_HandleTypeDef *hcan, + TIM_HandleTypeDef *throttle_htim, + TIM_HandleTypeDef *steering_htim +); + +// Called from CAN RX callback when a control message is received +// Uses the global static pointer to the logic state, since the CAN callback +// doesn't have a way to pass user data +void logic_handle_control(const can_control_msg_t* cmd); + +void pwm_disable(TIM_HandleTypeDef* htim, GPIO_TypeDef* gpio_port, uint32_t gpio_pin); +void pwm_enable(TIM_HandleTypeDef* htim, GPIO_TypeDef* gpio_port, uint32_t gpio_pin, uint32_t alternate_function); + + + + + +#endif // LOGIC_H \ No newline at end of file diff --git a/AutonomousDistroBoard/Core/Inc/main.h b/AutonomousDistroBoard/Core/Inc/main.h index 6b80116..bdb3c58 100644 --- a/AutonomousDistroBoard/Core/Inc/main.h +++ b/AutonomousDistroBoard/Core/Inc/main.h @@ -59,6 +59,14 @@ void Error_Handler(void); /* USER CODE END EFP */ /* Private defines -----------------------------------------------------------*/ +#define MAIN_COIL_EN_Pin GPIO_PIN_5 +#define MAIN_COIL_EN_GPIO_Port GPIOE +#define PRECHARGE_EN_Pin GPIO_PIN_6 +#define PRECHARGE_EN_GPIO_Port GPIOE +#define LED_OUT_Pin GPIO_PIN_8 +#define LED_OUT_GPIO_Port GPIOE +#define CAN_S_Pin GPIO_PIN_7 +#define CAN_S_GPIO_Port GPIOB /* USER CODE BEGIN Private defines */ diff --git a/AutonomousDistroBoard/Core/Inc/stm32f4xx_hal_conf.h b/AutonomousDistroBoard/Core/Inc/stm32f4xx_hal_conf.h index f5e58c1..d5a3ce5 100644 --- a/AutonomousDistroBoard/Core/Inc/stm32f4xx_hal_conf.h +++ b/AutonomousDistroBoard/Core/Inc/stm32f4xx_hal_conf.h @@ -96,7 +96,7 @@ * (when HSE is used as system clock source, directly or through the PLL). */ #if !defined (HSE_VALUE) - #define HSE_VALUE 25000000U /*!< Value of the External oscillator in Hz */ + #define HSE_VALUE 8000000U /*!< Value of the External oscillator in Hz */ #endif /* HSE_VALUE */ #if !defined (HSE_STARTUP_TIMEOUT) diff --git a/AutonomousDistroBoard/Core/Inc/stm32f4xx_it.h b/AutonomousDistroBoard/Core/Inc/stm32f4xx_it.h index c513579..d2e1e25 100644 --- a/AutonomousDistroBoard/Core/Inc/stm32f4xx_it.h +++ b/AutonomousDistroBoard/Core/Inc/stm32f4xx_it.h @@ -55,6 +55,8 @@ void SVC_Handler(void); void DebugMon_Handler(void); void PendSV_Handler(void); void SysTick_Handler(void); +void DMA1_Stream1_IRQHandler(void); +void CAN2_RX0_IRQHandler(void); /* USER CODE BEGIN EFP */ /* USER CODE END EFP */ diff --git a/AutonomousDistroBoard/Core/Inc/util.h b/AutonomousDistroBoard/Core/Inc/util.h new file mode 100644 index 0000000..8fbe48f --- /dev/null +++ b/AutonomousDistroBoard/Core/Inc/util.h @@ -0,0 +1,64 @@ +#ifndef UTIL_H +#define UTIL_H + +#include +#include + + +bool util_has_elapsed(uint32_t now, uint32_t start, uint32_t duration_ms); +uint16_t clamp_u16(uint16_t value, uint16_t min, uint16_t max); +uint16_t map_u16(uint16_t value, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max); + + +// Option type -----------------------------------------------------// +typedef struct { + bool is_some; // true if the option contains a value, false if it is None + uint32_t value; +} option_u32_t; + +option_u32_t option_u32_some(uint32_t value); +option_u32_t option_u32_none(void); +bool option_u32_is_some(option_u32_t opt); +bool option_u32_is_none(option_u32_t opt); +uint32_t option_u32_unwrap(option_u32_t opt); // only call if opt is known to be Some!! +//----------------------------------------------------------------------------// + + +// Debounce controller -------------------------------------------------------// +// Noise-tolerant debounce controller for boolean signals, with separate debounce +// times for rising and falling edges and an optional accumulating debounce feature +// to help filter out noise that causes multiple rapid transitions +typedef struct { + bool stable_state; // current accepted state + option_u32_t transition_start_time; // when a possible transition began + option_u32_t interruption_start_time; // when signal temporarily flipped back + uint32_t rising_debounce_ms; // configuration parameter: how long the signal needs to be continuously high before accepting a low->high transition + uint32_t falling_debounce_ms; // configuration parameter: how long the signal needs to be continuously low before accepting a high->low transition + uint32_t accumulating_debounce_ms; // configuration parameter: when a rising transition is in the debounce period, if the signal goes low again, + // require it to be continuously low for this long before resetting the debounce timer (helps filter out noise that causes multiple rapid transitions) +} debounce_controller_t; + +void debounce_controller_init( + debounce_controller_t* controller, + bool initial_state, + uint32_t rising_debounce_ms, + uint32_t falling_debounce_ms, + uint32_t accumulating_debounce_ms +); + +void debounce_controller_reset( + debounce_controller_t* controller, + bool state +); + +bool debounce_controller_update( + debounce_controller_t* controller, + bool raw_state, + uint32_t now +); + +bool debounce_controller_get_state(const debounce_controller_t* controller); +//----------------------------------------------------------------------------// + + +#endif // UTIL_H \ No newline at end of file diff --git a/AutonomousDistroBoard/Core/Src/can.c b/AutonomousDistroBoard/Core/Src/can.c new file mode 100644 index 0000000..21053cc --- /dev/null +++ b/AutonomousDistroBoard/Core/Src/can.c @@ -0,0 +1,67 @@ +#include "can.h" +#include + +#include "stm32f4xx_hal.h" + +#include "logic.h" +#include "util.h" + + +void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan) { + if (hcan->Instance == CAN_BUS) { + CAN_RxHeaderTypeDef rx_header; + uint8_t rx_data[8]; + + if (HAL_CAN_GetRxMessage(hcan, CAN_RX_FIFO0, &rx_header, rx_data) != HAL_OK) { + return; + } + if ((rx_header.IDE == CAN_ID_STD) && + (rx_header.RTR == CAN_RTR_DATA) && + (rx_header.StdId == CAN_ID_CONTROL) && + (rx_header.DLC >= CAN_CONTROL_MIN_BYTES)) + { + + can_control_msg_t cmd = parse_can_control(rx_data); + logic_handle_control(&cmd); + } + } +} + + +can_control_msg_t parse_can_control(const uint8_t* data) { + can_control_msg_t msg; + msg.throttle = data[0] | (data[1] << 8); + msg.steering = data[2] | (data[3] << 8); + return msg; +} + +void send_can_status(const can_status_msg_t* status, CAN_HandleTypeDef* hcan) { + CAN_TxHeaderTypeDef tx_header; + uint8_t tx_data[8] = {0}; + + tx_header.StdId = CAN_ID_STATUS; + tx_header.ExtId = 0; + tx_header.RTR = CAN_RTR_DATA; + tx_header.IDE = CAN_ID_STD; + tx_header.DLC = 8; + + tx_data[0] = (status->mode & 0x0F) | ((uint8_t)status->rc_mode << 4); + tx_data[1] = status->throttle_pwm & 0xFF; + tx_data[2] = (status->throttle_pwm >> 8) & 0xFF; + tx_data[3] = status->steering_pwm & 0xFF; + tx_data[4] = (status->steering_pwm >> 8) & 0xFF; + tx_data[5] = 0; + tx_data[6] = 0; + tx_data[7] = 0; + + uint32_t tx_mailbox; + HAL_CAN_AddTxMessage(hcan, &tx_header, tx_data, &tx_mailbox); +} + + +uint16_t can_throttle_to_pwm(const can_control_msg_t* cmd) { + return map_u16(cmd->throttle, 0, CAN_THROTTLE_MAX, THROTTLE_PWM_LOW, THROTTLE_PWM_HIGH); +} +uint16_t can_steering_to_pwm(const can_control_msg_t* cmd) { + return map_u16(cmd->steering, 0, CAN_STEERING_MAX, STEERING_PWM_LOW, STEERING_PWM_HIGH); +} \ No newline at end of file diff --git a/AutonomousDistroBoard/Core/Src/ibus.c b/AutonomousDistroBoard/Core/Src/ibus.c new file mode 100644 index 0000000..26e59e4 --- /dev/null +++ b/AutonomousDistroBoard/Core/Src/ibus.c @@ -0,0 +1,63 @@ +#include "ibus.h" + +#include +#include + +#include "util.h" + + +void ibus_init(ibus_t* ibus) { + memset(ibus, 0, sizeof(ibus_t)); +} + +bool ibus_is_connected(const ibus_t* ibus, uint32_t now, uint32_t timeout_ms) { + return !util_has_elapsed(now, ibus->last_frame_time, timeout_ms); +} + + +void ibus_process(ibus_t* ibus, UART_HandleTypeDef* ibus_huart) { + uint16_t dma_remaining = __HAL_DMA_GET_COUNTER(ibus_huart->hdmarx); + uint16_t dma_pos = (IBUS_DMA_BUFFER_SIZE - dma_remaining) % IBUS_DMA_BUFFER_SIZE; + + while (ibus->dma_last_pos != dma_pos) { + uint8_t byte = ibus->dma_buffer[ibus->dma_last_pos++]; + + if (ibus->dma_last_pos >= IBUS_DMA_BUFFER_SIZE) { + ibus->dma_last_pos = 0; + } + + ibus_parse_byte(ibus, byte); + } +} + + + +void ibus_parse_byte(ibus_t* ibus, uint8_t byte) { + // Byte 0: Length = 0x20 (32) + // Byte 1: Command = 0x40 + // Byte 2-29: 14 channels, little-endian uint16 + // Byte 30-31: checksum (little-endian) + + if (ibus->frame_index == 0 && byte != IBUS_HEADER_DLC) { + return; // wait for frame start + } + + ibus->frame[ibus->frame_index++] = byte; + if (ibus->frame_index == IBUS_FRAME_SIZE) { + ibus->frame_index = 0; + if (ibus->frame[1] == IBUS_HEADER_COMMAND) { + uint16_t checksum = 0xFFFF; + for (int i = 0; i < 30; i++) { + checksum -= ibus->frame[i]; + } + + uint16_t received = ibus->frame[30] | (ibus->frame[31] << 8); + if (checksum == received) { + for (int i = 0; i < IBUS_CHANNEL_COUNT; i++) { + ibus->channels[i] = ibus->frame[2 + i*2] | (ibus->frame[3 + i*2] << 8); + } + ibus->last_frame_time = HAL_GetTick(); + } + } + } +} \ No newline at end of file diff --git a/AutonomousDistroBoard/Core/Src/logic.c b/AutonomousDistroBoard/Core/Src/logic.c new file mode 100644 index 0000000..aa4ce29 --- /dev/null +++ b/AutonomousDistroBoard/Core/Src/logic.c @@ -0,0 +1,324 @@ +#include "logic.h" + +#include + +#include "ibus.h" +#include "main.h" +#include "can.h" +#include "util.h" + + +static logic_state_t* g_logic_state_ptr = NULL; + + +void logic_init(logic_state_t* state) { + state->mode = LOGIC_MODE_STARTING; + state->start_time = HAL_GetTick(); + + debounce_controller_init( + &state->estop_debounce, + false, + ESTOP_RISING_DEBOUNCE, + ESTOP_FALLING_DEBOUNCE, + ESTOP_ACCUMULATING_DEBOUNCE + ); + debounce_controller_init( + &state->mode_debounce, + false, + MODE_DEBOUNCE_MS, + MODE_DEBOUNCE_MS, + MODE_ACCUMULATING_DEBOUNCE_MS + ); + + ibus_init(&state->ibus); + state->last_can_tx_time = 0; + + state->can_current_throttle_pwm = THROTTLE_PWM_LOW; + state->can_current_steering_pwm = (STEERING_PWM_LOW + STEERING_PWM_HIGH) / 2; + state->last_control_timestamp = 0; + + state->output_throttle_pwm = THROTTLE_PWM_LOW; + state->output_steering_pwm = (STEERING_PWM_LOW + STEERING_PWM_HIGH) / 2; + state->throttle_enabled = true; // HAL init sets up the PWM + + g_logic_state_ptr = state; +} + +void logic_handle_control(const can_control_msg_t* cmd) { + if (g_logic_state_ptr == NULL) { + return; + } + + g_logic_state_ptr->can_current_throttle_pwm = can_throttle_to_pwm(cmd); + g_logic_state_ptr->can_current_steering_pwm = can_steering_to_pwm(cmd); + g_logic_state_ptr->last_control_timestamp = HAL_GetTick(); +} + +void logic_run( + logic_state_t* state, + UART_HandleTypeDef *sbus_huart, + CAN_HandleTypeDef *hcan, + TIM_HandleTypeDef *throttle_htim, + TIM_HandleTypeDef *steering_htim +) { + // Process iBUS data + ibus_process(&state->ibus, sbus_huart); + + uint32_t now = HAL_GetTick(); + + // All states: Check for RC connection timeout + if (!ibus_is_connected(&state->ibus, now, RC_CONNECTION_TIMEOUT)) { + state->mode = LOGIC_MODE_RC_DISCONNECTED; + } else { + // All states: update RC debounce controllers + uint16_t estop_channel_value = state->ibus.channels[IBUS_CHANNEL_ESTOP]; + bool estop_raw_high = estop_channel_value >= ESTOP_PWM_THRESHOLD; + debounce_controller_update(&state->estop_debounce, estop_raw_high, now); + + uint16_t mode_channel_value = state->ibus.channels[IBUS_CHANNEL_MODE]; + bool mode_raw_high = mode_channel_value >= MODE_PWM_THRESHOLD; + debounce_controller_update(&state->mode_debounce, mode_raw_high, now); + + // All states: check remote estop + bool estop_debounced_high = debounce_controller_get_state(&state->estop_debounce); + if (estop_debounced_high) { + state->mode = LOGIC_MODE_ESTOPPED; + // Note: if it was high and remains high, we want to continue to force + // state->mode = LOGIC_MODE_ESTOPPED just as a safety measure + } + } + + // Precharge/contactor state machine logic + switch (state->mode) { + case LOGIC_MODE_STARTING: { + // Precharge and contactor low + HAL_GPIO_WritePin(PRECHARGE_EN_GPIO_Port, PRECHARGE_EN_Pin, GPIO_PIN_RESET); + HAL_GPIO_WritePin(MAIN_COIL_EN_GPIO_Port, MAIN_COIL_EN_Pin, GPIO_PIN_RESET); + + if (util_has_elapsed(now, state->start_time, PRECHARGE_START_DELAY)) { + state->mode = LOGIC_MODE_PRECHARGING; + } + break; + } + case LOGIC_MODE_PRECHARGING: { + // Precharge on, contactor off + HAL_GPIO_WritePin(PRECHARGE_EN_GPIO_Port, PRECHARGE_EN_Pin, GPIO_PIN_SET); + HAL_GPIO_WritePin(MAIN_COIL_EN_GPIO_Port, MAIN_COIL_EN_Pin, GPIO_PIN_RESET); + + uint32_t total_delay = PRECHARGE_START_DELAY + PRECHARGE_DURATION; + if (util_has_elapsed(now, state->start_time, total_delay)) { + state->mode = LOGIC_MODE_CONTACTOR_CLOSING; + } + break; + } + case LOGIC_MODE_CONTACTOR_CLOSING: { + // Precharge on, contactor on + HAL_GPIO_WritePin(PRECHARGE_EN_GPIO_Port, PRECHARGE_EN_Pin, GPIO_PIN_SET); + HAL_GPIO_WritePin(MAIN_COIL_EN_GPIO_Port, MAIN_COIL_EN_Pin, GPIO_PIN_SET); + + uint32_t total_delay = PRECHARGE_START_DELAY + PRECHARGE_DURATION + CONTACTOR_CLOSED_DELAY; + if (util_has_elapsed(now, state->start_time, total_delay)) { + state->mode = LOGIC_MODE_RUNNING; + } + break; + } + case LOGIC_MODE_RUNNING: { //-------------------------------------------------// + // Precharge off, contactor on + HAL_GPIO_WritePin(PRECHARGE_EN_GPIO_Port, PRECHARGE_EN_Pin, GPIO_PIN_RESET); + HAL_GPIO_WritePin(MAIN_COIL_EN_GPIO_Port, MAIN_COIL_EN_Pin, GPIO_PIN_SET); + + // Normal operation! + + bool autonomous_mode = debounce_controller_get_state(&state->mode_debounce); + + // In autonomous mode, ignore iBUS throttle and steering and only use CAN commands + if (autonomous_mode) { + if (!util_has_elapsed(now, state->last_control_timestamp, CAN_RX_TIMEOUT)) { + // If we have received a control message recently, consider the CAN connection to be + // healthy and use CAN commands for throttle and steering + state->output_throttle_pwm = state->can_current_throttle_pwm; + state->output_steering_pwm = state->can_current_steering_pwm; + } else { + // If we have not received a control message recently, consider the CAN connection to + // be lost and switch to CAN_DISCONNECTED mode + state->mode = LOGIC_MODE_CAN_DISCONNECTED; + state->output_throttle_pwm = THROTTLE_PWM_LOW; + state->output_steering_pwm = STEERING_PWM_CENTER; + } + } + // In RC mode, ignore CAN commands and only use iBUS throttle and steering + else { + uint16_t ibus_throttle_pwm = state->ibus.channels[IBUS_CHANNEL_THROTTLE]; + uint16_t ibus_steering_pwm = state->ibus.channels[IBUS_CHANNEL_STEERING]; + + int32_t throttle_delta = (int32_t)ibus_throttle_pwm - (int32_t)THROTTLE_PWM_LOW; + if (throttle_delta < 0) { + throttle_delta = 0; + } + state->output_throttle_pwm = THROTTLE_PWM_LOW + (uint16_t)(throttle_delta / RC_MODE_THROTTLE_DIVISOR); + state->output_steering_pwm = ibus_steering_pwm; + } + + + break; + } //--------------------------------------------------------------------------// + case LOGIC_MODE_ESTOPPED: { + // STOP: precharge off, contactor off, throttle low, steering straight + HAL_GPIO_WritePin(PRECHARGE_EN_GPIO_Port, PRECHARGE_EN_Pin, GPIO_PIN_RESET); + HAL_GPIO_WritePin(MAIN_COIL_EN_GPIO_Port, MAIN_COIL_EN_Pin, GPIO_PIN_RESET); + state->output_throttle_pwm = THROTTLE_PWM_LOW; + state->output_steering_pwm = STEERING_PWM_CENTER; + + bool estop_debounced_high = debounce_controller_get_state(&state->estop_debounce); + if (!estop_debounced_high) { + state->mode = LOGIC_MODE_RECOVERING; + state->start_time = now; + } + break; + } + case LOGIC_MODE_RC_DISCONNECTED: { + // STOP: precharge off, contactor off, throttle low, steering straight + HAL_GPIO_WritePin(PRECHARGE_EN_GPIO_Port, PRECHARGE_EN_Pin, GPIO_PIN_RESET); + HAL_GPIO_WritePin(MAIN_COIL_EN_GPIO_Port, MAIN_COIL_EN_Pin, GPIO_PIN_RESET); + state->output_throttle_pwm = THROTTLE_PWM_LOW; + state->output_steering_pwm = STEERING_PWM_CENTER; + + if (ibus_is_connected(&state->ibus, now, RC_CONNECTION_TIMEOUT)) { + state->mode = LOGIC_MODE_RECOVERING; + state->start_time = now; + } + break; + } + case LOGIC_MODE_CAN_DISCONNECTED: { + // CAN disconnect in autonomous mode = stop the kart + // STOP: precharge off, contactor off, throttle low, steering straight + HAL_GPIO_WritePin(PRECHARGE_EN_GPIO_Port, PRECHARGE_EN_Pin, GPIO_PIN_RESET); + HAL_GPIO_WritePin(MAIN_COIL_EN_GPIO_Port, MAIN_COIL_EN_Pin, GPIO_PIN_RESET); + state->output_throttle_pwm = THROTTLE_PWM_LOW; + state->output_steering_pwm = STEERING_PWM_CENTER; + + uint16_t mode_channel_value = state->ibus.channels[IBUS_CHANNEL_MODE]; + bool mode_raw_high = mode_channel_value >= MODE_PWM_THRESHOLD; + debounce_controller_update(&state->mode_debounce, mode_raw_high, now); + + bool autonomous_mode = debounce_controller_get_state(&state->mode_debounce); + bool can_connection_ok = !util_has_elapsed(now, state->last_control_timestamp, CAN_RX_TIMEOUT); + bool ibus_connection_ok = ibus_is_connected(&state->ibus, now, RC_CONNECTION_TIMEOUT); + + if ((autonomous_mode && can_connection_ok) + || (!autonomous_mode && ibus_connection_ok)) { + state->mode = LOGIC_MODE_RECOVERING; + state->start_time = now; + } + break; + } + case LOGIC_MODE_RECOVERING: { + // Still stopped: precharge off, contactor off, throttle low, steering straight + HAL_GPIO_WritePin(PRECHARGE_EN_GPIO_Port, PRECHARGE_EN_Pin, GPIO_PIN_RESET); + HAL_GPIO_WritePin(MAIN_COIL_EN_GPIO_Port, MAIN_COIL_EN_Pin, GPIO_PIN_RESET); + state->output_throttle_pwm = THROTTLE_PWM_LOW; + state->output_steering_pwm = STEERING_PWM_CENTER; + + if (util_has_elapsed(now, state->start_time, RECOVERING_DELAY)) { + state->mode = LOGIC_MODE_STARTING; + state->start_time = now; + } + + break; + } + } + + // Clamp the output PWM values to their valid ranges just in case + state->output_throttle_pwm = clamp_u16(state->output_throttle_pwm, THROTTLE_PWM_LOW, THROTTLE_PWM_HIGH); + state->output_steering_pwm = clamp_u16(state->output_steering_pwm, STEERING_PWM_LOW, STEERING_PWM_HIGH); + + // Output the PWM values + bool should_throttle = state->mode == LOGIC_MODE_RUNNING; + if (should_throttle) { + if (!state->throttle_enabled) { + pwm_enable(throttle_htim, THROTTLE_PWM_GPIO_Port, THROTTLE_PWM_Pin, THROTTLE_PWM_AF); + state->throttle_enabled = true; + } + __HAL_TIM_SET_COMPARE(throttle_htim, TIM_CHANNEL_1, state->output_throttle_pwm); + } else { + if (state->throttle_enabled) { + __HAL_TIM_SET_COMPARE(throttle_htim, TIM_CHANNEL_1, state->output_throttle_pwm); + pwm_disable(throttle_htim, THROTTLE_PWM_GPIO_Port, THROTTLE_PWM_Pin); + state->throttle_enabled = false; + } + } + // All modes set the intended steering position + // And steering is powered from Distro/Control Board, not through contactor + __HAL_TIM_SET_COMPARE(steering_htim, TIM_CHANNEL_1, state->output_steering_pwm); + + // Periodically send CAN status messages + if (util_has_elapsed(now, state->last_can_tx_time, CAN_TX_PERIOD)) { + can_status_msg_t status = { + .mode = (uint8_t)state->mode, + .rc_mode = debounce_controller_get_state(&state->mode_debounce), // if mode_debounce is low, we are in RC mode + .throttle_pwm = state->output_throttle_pwm, + .steering_pwm = state->output_steering_pwm + }; + send_can_status(&status, hcan); + state->last_can_tx_time = now; + } + + // Blink LED + uint16_t led_period = 0; + switch (state->mode) { + case LOGIC_MODE_STARTING: led_period = LED_STARTING_PERIOD; break; + case LOGIC_MODE_PRECHARGING: led_period = LED_PRECHARGING_PERIOD; break; + case LOGIC_MODE_CONTACTOR_CLOSING: led_period = LED_CONTACTOR_CLOSING_PERIOD; break; + case LOGIC_MODE_RUNNING: { + bool autonomous_mode = debounce_controller_get_state(&state->mode_debounce); + if (autonomous_mode) { + led_period = LED_RUNNING_AUTONOMOUS_PERIOD; + } else { + led_period = LED_RUNNING_RC_PERIOD; + } + break; + } + case LOGIC_MODE_ESTOPPED: led_period = LED_ESTOPPED_PERIOD; break; + case LOGIC_MODE_RC_DISCONNECTED: led_period = LED_RC_DISCONNECTED_PERIOD; break; + case LOGIC_MODE_CAN_DISCONNECTED: led_period = LED_CAN_DISCONNECTED_PERIOD; break; + case LOGIC_MODE_RECOVERING: led_period = LED_RECOVERING_PERIOD; break; + } + if (led_period == 0) { + // Solid on + HAL_GPIO_WritePin(LED_OUT_GPIO_Port, LED_OUT_Pin, GPIO_PIN_SET); + } else { + if (util_has_elapsed(now, state->led_blink_timestamp, led_period)) { + HAL_GPIO_TogglePin(LED_OUT_GPIO_Port, LED_OUT_Pin); + state->led_blink_timestamp = now; + } + } +} + + +void pwm_disable(TIM_HandleTypeDef* htim, GPIO_TypeDef* gpio_port, uint32_t gpio_pin) { + // Stop PWM generation + HAL_TIM_PWM_Stop(htim, TIM_CHANNEL_1); + + // Put pin into Hi-Z (input mode) + GPIO_InitTypeDef GPIO_InitStruct = {0}; + GPIO_InitStruct.Pin = gpio_pin; + GPIO_InitStruct.Mode = GPIO_MODE_INPUT; + GPIO_InitStruct.Pull = GPIO_NOPULL; + + HAL_GPIO_Init(gpio_port, &GPIO_InitStruct); +} + +void pwm_enable(TIM_HandleTypeDef* htim, GPIO_TypeDef* gpio_port, uint32_t gpio_pin, uint32_t alternate_function) { + // Put pin into alternate function mode for PWM output + GPIO_InitTypeDef GPIO_InitStruct = {0}; + GPIO_InitStruct.Pin = gpio_pin; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; + GPIO_InitStruct.Alternate = alternate_function; + + HAL_GPIO_Init(gpio_port, &GPIO_InitStruct); + + // Start PWM generation + HAL_TIM_PWM_Start(htim, TIM_CHANNEL_1); +} \ No newline at end of file diff --git a/AutonomousDistroBoard/Core/Src/main.c b/AutonomousDistroBoard/Core/Src/main.c index fa69d31..3ca4a32 100644 --- a/AutonomousDistroBoard/Core/Src/main.c +++ b/AutonomousDistroBoard/Core/Src/main.c @@ -21,7 +21,7 @@ /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ - +#include "logic.h" /* USER CODE END Includes */ /* Private typedef -----------------------------------------------------------*/ @@ -47,16 +47,18 @@ TIM_HandleTypeDef htim11; UART_HandleTypeDef huart5; UART_HandleTypeDef huart3; +DMA_HandleTypeDef hdma_usart3_rx; PCD_HandleTypeDef hpcd_USB_OTG_FS; /* USER CODE BEGIN PV */ - +logic_state_t g_logic_state = {0}; /* USER CODE END PV */ /* Private function prototypes -----------------------------------------------*/ void SystemClock_Config(void); static void MX_GPIO_Init(void); +static void MX_DMA_Init(void); static void MX_CAN2_Init(void); static void MX_UART5_Init(void); static void MX_TIM1_Init(void); @@ -100,6 +102,7 @@ int main(void) /* Initialize all configured peripherals */ MX_GPIO_Init(); + MX_DMA_Init(); MX_CAN2_Init(); MX_UART5_Init(); MX_TIM1_Init(); @@ -107,6 +110,44 @@ int main(void) MX_USART3_UART_Init(); MX_USB_OTG_FS_PCD_Init(); /* USER CODE BEGIN 2 */ + // Initialize logic state + logic_init(&g_logic_state); + + // CAN + // CAN_S must be low for CAN to operate + HAL_GPIO_WritePin(CAN_S_GPIO_Port, CAN_S_Pin, GPIO_PIN_RESET); + + // Filter + CAN_FilterTypeDef filter = {0}; + filter.FilterBank = 14; // CAN2 uses banks 14–27 on F4 + filter.FilterMode = CAN_FILTERMODE_IDMASK; + filter.FilterScale = CAN_FILTERSCALE_32BIT; + // Accept all IDs (for debugging) + filter.FilterIdHigh = 0x0000; + filter.FilterIdLow = 0x0000; + filter.FilterMaskIdHigh = 0x0000; + filter.FilterMaskIdLow = 0x0000; + filter.FilterFIFOAssignment = CAN_RX_FIFO0; + filter.FilterActivation = ENABLE; + filter.SlaveStartFilterBank = 14; + + if (HAL_CAN_ConfigFilter(&hcan2, &filter) != HAL_OK) { + Error_Handler(); + } + // Start CAN peripheral + if (HAL_CAN_Start(&hcan2) != HAL_OK) { + Error_Handler(); + } + if (HAL_CAN_ActivateNotification(&hcan2, CAN_IT_RX_FIFO0_MSG_PENDING) != HAL_OK) { + Error_Handler(); + } + + // Start PWM outputs + HAL_TIM_PWM_Start(&htim11, TIM_CHANNEL_1); + HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1); + + // Start iBUS circular DMA reception + HAL_UART_Receive_DMA(&huart3, g_logic_state.ibus.dma_buffer, IBUS_DMA_BUFFER_SIZE); /* USER CODE END 2 */ @@ -117,6 +158,7 @@ int main(void) /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ + logic_run(&g_logic_state, &huart3, &hcan2, &htim11, &htim1); } /* USER CODE END 3 */ } @@ -142,8 +184,8 @@ void SystemClock_Config(void) RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; - RCC_OscInitStruct.PLL.PLLM = 15; - RCC_OscInitStruct.PLL.PLLN = 144; + RCC_OscInitStruct.PLL.PLLM = 8; + RCC_OscInitStruct.PLL.PLLN = 240; RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; RCC_OscInitStruct.PLL.PLLQ = 5; if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) @@ -182,11 +224,11 @@ static void MX_CAN2_Init(void) /* USER CODE END CAN2_Init 1 */ hcan2.Instance = CAN2; - hcan2.Init.Prescaler = 16; + hcan2.Init.Prescaler = 4; hcan2.Init.Mode = CAN_MODE_NORMAL; hcan2.Init.SyncJumpWidth = CAN_SJW_1TQ; - hcan2.Init.TimeSeg1 = CAN_BS1_1TQ; - hcan2.Init.TimeSeg2 = CAN_BS2_1TQ; + hcan2.Init.TimeSeg1 = CAN_BS1_12TQ; + hcan2.Init.TimeSeg2 = CAN_BS2_2TQ; hcan2.Init.TimeTriggeredMode = DISABLE; hcan2.Init.AutoBusOff = DISABLE; hcan2.Init.AutoWakeUp = DISABLE; @@ -223,9 +265,9 @@ static void MX_TIM1_Init(void) /* USER CODE END TIM1_Init 1 */ htim1.Instance = TIM1; - htim1.Init.Prescaler = 0; + htim1.Init.Prescaler = 119; htim1.Init.CounterMode = TIM_COUNTERMODE_UP; - htim1.Init.Period = 65535; + htim1.Init.Period = 19999; htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; htim1.Init.RepetitionCounter = 0; htim1.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; @@ -240,7 +282,7 @@ static void MX_TIM1_Init(void) Error_Handler(); } sConfigOC.OCMode = TIM_OCMODE_PWM1; - sConfigOC.Pulse = 0; + sConfigOC.Pulse = 1500; sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH; sConfigOC.OCNPolarity = TIM_OCNPOLARITY_HIGH; sConfigOC.OCFastMode = TIM_OCFAST_DISABLE; @@ -286,9 +328,9 @@ static void MX_TIM11_Init(void) /* USER CODE END TIM11_Init 1 */ htim11.Instance = TIM11; - htim11.Init.Prescaler = 0; + htim11.Init.Prescaler = 119; htim11.Init.CounterMode = TIM_COUNTERMODE_UP; - htim11.Init.Period = 65535; + htim11.Init.Period = 19999; htim11.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; htim11.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; if (HAL_TIM_Base_Init(&htim11) != HAL_OK) @@ -300,7 +342,7 @@ static void MX_TIM11_Init(void) Error_Handler(); } sConfigOC.OCMode = TIM_OCMODE_PWM1; - sConfigOC.Pulse = 0; + sConfigOC.Pulse = 1000; sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH; sConfigOC.OCFastMode = TIM_OCFAST_DISABLE; if (HAL_TIM_PWM_ConfigChannel(&htim11, &sConfigOC, TIM_CHANNEL_1) != HAL_OK) @@ -415,6 +457,22 @@ static void MX_USB_OTG_FS_PCD_Init(void) } +/** + * Enable DMA controller clock + */ +static void MX_DMA_Init(void) +{ + + /* DMA controller clock enable */ + __HAL_RCC_DMA1_CLK_ENABLE(); + + /* DMA interrupt init */ + /* DMA1_Stream1_IRQn interrupt configuration */ + HAL_NVIC_SetPriority(DMA1_Stream1_IRQn, 0, 0); + HAL_NVIC_EnableIRQ(DMA1_Stream1_IRQn); + +} + /** * @brief GPIO Initialization Function * @param None @@ -435,24 +493,24 @@ static void MX_GPIO_Init(void) __HAL_RCC_GPIOD_CLK_ENABLE(); /*Configure GPIO pin Output Level */ - HAL_GPIO_WritePin(GPIOE, GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_8, GPIO_PIN_RESET); + HAL_GPIO_WritePin(GPIOE, MAIN_COIL_EN_Pin|PRECHARGE_EN_Pin|LED_OUT_Pin, GPIO_PIN_RESET); /*Configure GPIO pin Output Level */ - HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_RESET); + HAL_GPIO_WritePin(CAN_S_GPIO_Port, CAN_S_Pin, GPIO_PIN_RESET); - /*Configure GPIO pins : PE5 PE6 PE8 */ - GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_8; + /*Configure GPIO pins : MAIN_COIL_EN_Pin PRECHARGE_EN_Pin LED_OUT_Pin */ + GPIO_InitStruct.Pin = MAIN_COIL_EN_Pin|PRECHARGE_EN_Pin|LED_OUT_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GPIOE, &GPIO_InitStruct); - /*Configure GPIO pin : PB7 */ - GPIO_InitStruct.Pin = GPIO_PIN_7; + /*Configure GPIO pin : CAN_S_Pin */ + GPIO_InitStruct.Pin = CAN_S_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; - HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); + HAL_GPIO_Init(CAN_S_GPIO_Port, &GPIO_InitStruct); /* USER CODE BEGIN MX_GPIO_Init_2 */ /* USER CODE END MX_GPIO_Init_2 */ diff --git a/AutonomousDistroBoard/Core/Src/stm32f4xx_hal_msp.c b/AutonomousDistroBoard/Core/Src/stm32f4xx_hal_msp.c index 2d18373..1c32176 100644 --- a/AutonomousDistroBoard/Core/Src/stm32f4xx_hal_msp.c +++ b/AutonomousDistroBoard/Core/Src/stm32f4xx_hal_msp.c @@ -23,6 +23,7 @@ /* USER CODE BEGIN Includes */ /* USER CODE END Includes */ +extern DMA_HandleTypeDef hdma_usart3_rx; /* Private typedef -----------------------------------------------------------*/ /* USER CODE BEGIN TD */ @@ -108,6 +109,9 @@ void HAL_CAN_MspInit(CAN_HandleTypeDef* hcan) GPIO_InitStruct.Alternate = GPIO_AF9_CAN2; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); + /* CAN2 interrupt Init */ + HAL_NVIC_SetPriority(CAN2_RX0_IRQn, 0, 0); + HAL_NVIC_EnableIRQ(CAN2_RX0_IRQn); /* USER CODE BEGIN CAN2_MspInit 1 */ /* USER CODE END CAN2_MspInit 1 */ @@ -138,6 +142,8 @@ void HAL_CAN_MspDeInit(CAN_HandleTypeDef* hcan) */ HAL_GPIO_DeInit(GPIOB, GPIO_PIN_5|GPIO_PIN_6); + /* CAN2 interrupt DeInit */ + HAL_NVIC_DisableIRQ(CAN2_RX0_IRQn); /* USER CODE BEGIN CAN2_MspDeInit 1 */ /* USER CODE END CAN2_MspDeInit 1 */ @@ -340,6 +346,25 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart) GPIO_InitStruct.Alternate = GPIO_AF7_USART3; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); + /* USART3 DMA Init */ + /* USART3_RX Init */ + hdma_usart3_rx.Instance = DMA1_Stream1; + hdma_usart3_rx.Init.Channel = DMA_CHANNEL_4; + hdma_usart3_rx.Init.Direction = DMA_PERIPH_TO_MEMORY; + hdma_usart3_rx.Init.PeriphInc = DMA_PINC_DISABLE; + hdma_usart3_rx.Init.MemInc = DMA_MINC_ENABLE; + hdma_usart3_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE; + hdma_usart3_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE; + hdma_usart3_rx.Init.Mode = DMA_CIRCULAR; + hdma_usart3_rx.Init.Priority = DMA_PRIORITY_HIGH; + hdma_usart3_rx.Init.FIFOMode = DMA_FIFOMODE_DISABLE; + if (HAL_DMA_Init(&hdma_usart3_rx) != HAL_OK) + { + Error_Handler(); + } + + __HAL_LINKDMA(huart,hdmarx,hdma_usart3_rx); + /* USER CODE BEGIN USART3_MspInit 1 */ /* USER CODE END USART3_MspInit 1 */ @@ -389,6 +414,8 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart) */ HAL_GPIO_DeInit(GPIOB, GPIO_PIN_10|GPIO_PIN_11); + /* USART3 DMA DeInit */ + HAL_DMA_DeInit(huart->hdmarx); /* USER CODE BEGIN USART3_MspDeInit 1 */ /* USER CODE END USART3_MspDeInit 1 */ diff --git a/AutonomousDistroBoard/Core/Src/stm32f4xx_it.c b/AutonomousDistroBoard/Core/Src/stm32f4xx_it.c index fb58e2a..dbd785b 100644 --- a/AutonomousDistroBoard/Core/Src/stm32f4xx_it.c +++ b/AutonomousDistroBoard/Core/Src/stm32f4xx_it.c @@ -55,7 +55,8 @@ /* USER CODE END 0 */ /* External variables --------------------------------------------------------*/ - +extern CAN_HandleTypeDef hcan2; +extern DMA_HandleTypeDef hdma_usart3_rx; /* USER CODE BEGIN EV */ /* USER CODE END EV */ @@ -198,6 +199,34 @@ void SysTick_Handler(void) /* please refer to the startup file (startup_stm32f4xx.s). */ /******************************************************************************/ +/** + * @brief This function handles DMA1 stream1 global interrupt. + */ +void DMA1_Stream1_IRQHandler(void) +{ + /* USER CODE BEGIN DMA1_Stream1_IRQn 0 */ + + /* USER CODE END DMA1_Stream1_IRQn 0 */ + HAL_DMA_IRQHandler(&hdma_usart3_rx); + /* USER CODE BEGIN DMA1_Stream1_IRQn 1 */ + + /* USER CODE END DMA1_Stream1_IRQn 1 */ +} + +/** + * @brief This function handles CAN2 RX0 interrupts. + */ +void CAN2_RX0_IRQHandler(void) +{ + /* USER CODE BEGIN CAN2_RX0_IRQn 0 */ + + /* USER CODE END CAN2_RX0_IRQn 0 */ + HAL_CAN_IRQHandler(&hcan2); + /* USER CODE BEGIN CAN2_RX0_IRQn 1 */ + + /* USER CODE END CAN2_RX0_IRQn 1 */ +} + /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ diff --git a/AutonomousDistroBoard/Core/Src/util.c b/AutonomousDistroBoard/Core/Src/util.c new file mode 100644 index 0000000..3421c51 --- /dev/null +++ b/AutonomousDistroBoard/Core/Src/util.c @@ -0,0 +1,137 @@ +#include "util.h" + +#include +#include + +//----------------------------------------------------------------------------// +bool util_has_elapsed(uint32_t now, uint32_t start, uint32_t duration_ms) { + return (uint32_t)(now - start) >= duration_ms; +} +uint16_t clamp_u16(uint16_t value, uint16_t min, uint16_t max) { + if (value < min) { + return min; + } else if (value > max) { + return max; + } else { + return value; + } +} + +uint16_t map_u16(uint16_t value, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max) { + if (in_max == in_min) { + // Avoid division by zero; return the midpoint of the output range + return (out_min + out_max) / 2; + } + + // Saturate value to input range to avoid underflow/overflow in arithmetic + if (value <= in_min) { + return out_min; + } + if (value >= in_max) { + return out_max; + } + + uint32_t range_in = (uint32_t)in_max - (uint32_t)in_min; + uint32_t range_out = (uint32_t)out_max - (uint32_t)out_min; + uint32_t num = (uint32_t)value - (uint32_t)in_min; + uint32_t scaled = num * range_out; + + return (uint16_t)(scaled / range_in + out_min); +} +//----------------------------------------------------------------------------// + + +// option_u32_t --------------------------------------------------------------// +option_u32_t option_u32_some(uint32_t value) { + option_u32_t opt = { + .is_some = true, + .value = value + }; + return opt; +} +option_u32_t option_u32_none(void) { + option_u32_t opt = { + .is_some = false, + .value = 0 // value is irrelevant when is_some is false + }; + return opt; +} +bool option_u32_is_some(option_u32_t opt) { + return opt.is_some; +} +bool option_u32_is_none(option_u32_t opt) { + return !opt.is_some; +} +uint32_t option_u32_unwrap(option_u32_t opt) { + // Only call this if opt is known to be Some, otherwise behavior is undefined + return opt.value; +} +//----------------------------------------------------------------------------// + + +// debounce_controller_t -----------------------------------------------------// +void debounce_controller_init( + debounce_controller_t* controller, + bool initial_state, + uint32_t rising_debounce_ms, + uint32_t falling_debounce_ms, + uint32_t accumulating_debounce_ms +) { + controller->stable_state = initial_state; + controller->transition_start_time = option_u32_none(); + controller->interruption_start_time = option_u32_none(); + controller->rising_debounce_ms = rising_debounce_ms; + controller->falling_debounce_ms = falling_debounce_ms; + controller->accumulating_debounce_ms = accumulating_debounce_ms; +} + +void debounce_controller_reset( + debounce_controller_t* controller, + bool state +) { + controller->stable_state = state; + controller->transition_start_time = option_u32_none(); + controller->interruption_start_time = option_u32_none(); +} + +bool debounce_controller_update( + debounce_controller_t* controller, + bool raw_state, + uint32_t now +) { + if (raw_state == controller->stable_state) { + if (option_u32_is_some(controller->transition_start_time)) { + if (option_u32_is_none(controller->interruption_start_time)) { + controller->interruption_start_time = option_u32_some(now); + } else if (util_has_elapsed(now, option_u32_unwrap(controller->interruption_start_time), controller->accumulating_debounce_ms)) { + controller->transition_start_time = option_u32_none(); + controller->interruption_start_time = option_u32_none(); + } + } + + return controller->stable_state; + } + + if (option_u32_is_none(controller->transition_start_time)) { + controller->transition_start_time = option_u32_some(now); + } + + controller->interruption_start_time = option_u32_none(); + + uint32_t debounce_ms = raw_state + ? controller->rising_debounce_ms + : controller->falling_debounce_ms; + + if (util_has_elapsed(now, option_u32_unwrap(controller->transition_start_time), debounce_ms)) { + controller->stable_state = raw_state; + controller->transition_start_time = option_u32_none(); + controller->interruption_start_time = option_u32_none(); + } + + return controller->stable_state; +} + +bool debounce_controller_get_state(const debounce_controller_t* controller) { + return controller->stable_state; +} +//----------------------------------------------------------------------------// \ No newline at end of file diff --git a/AutonomousDistroBoard/compile_commands.json b/AutonomousDistroBoard/compile_commands.json new file mode 100644 index 0000000..fce2998 --- /dev/null +++ b/AutonomousDistroBoard/compile_commands.json @@ -0,0 +1,960 @@ +[ + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + "-MMD", + "-MP", + "-MFDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.d", + "-MTDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o" + ], + "file": "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + "-MMD", + "-MP", + "-MFDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.d", + "-MTDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.o" + ], + "file": "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.d", + "-MTDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.o" + ], + "file": "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.d", + "-MTDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.o" + ], + "file": "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.d", + "-MTDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.o" + ], + "file": "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.d", + "-MTDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.o" + ], + "file": "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.d", + "-MTDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.o" + ], + "file": "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.d", + "-MTDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.o" + ], + "file": "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.d", + "-MTDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.o" + ], + "file": "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.d", + "-MTDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.o" + ], + "file": "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.d", + "-MTDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.o" + ], + "file": "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd_ex.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd_ex.d", + "-MTDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd_ex.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd_ex.o" + ], + "file": "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd_ex.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.d", + "-MTDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.o" + ], + "file": "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.d", + "-MTDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.o" + ], + "file": "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.d", + "-MTDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.o" + ], + "file": "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.d", + "-MTDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.o" + ], + "file": "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.d", + "-MTDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.o" + ], + "file": "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.d", + "-MTDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.o" + ], + "file": "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.d", + "-MTDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.o" + ], + "file": "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.d", + "-MTDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.o" + ], + "file": "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "-mcpu=cortex-m4", + "-g3", + "-DDEBUG", + "-c", + "-x", + "assembler-with-cpp", + "-MMD", + "-MP", + "-MFCore/Startup/startup_stm32f407vgtx.d", + "-MTCore/Startup/startup_stm32f407vgtx.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Core/Startup/startup_stm32f407vgtx.o", + "../Core/Startup/startup_stm32f407vgtx.s" + ], + "file": "../Core/Startup/startup_stm32f407vgtx.s" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Core/Src/main.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFCore/Src/main.d", + "-MTCore/Src/main.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Core/Src/main.o" + ], + "file": "../Core/Src/main.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Core/Src/stm32f4xx_hal_msp.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFCore/Src/stm32f4xx_hal_msp.d", + "-MTCore/Src/stm32f4xx_hal_msp.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Core/Src/stm32f4xx_hal_msp.o" + ], + "file": "../Core/Src/stm32f4xx_hal_msp.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Core/Src/stm32f4xx_it.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFCore/Src/stm32f4xx_it.d", + "-MTCore/Src/stm32f4xx_it.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Core/Src/stm32f4xx_it.o" + ], + "file": "../Core/Src/stm32f4xx_it.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Core/Src/syscalls.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFCore/Src/syscalls.d", + "-MTCore/Src/syscalls.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Core/Src/syscalls.o" + ], + "file": "../Core/Src/syscalls.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Core/Src/sysmem.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFCore/Src/sysmem.d", + "-MTCore/Src/sysmem.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Core/Src/sysmem.o" + ], + "file": "../Core/Src/sysmem.c" + }, + { + "directory": "/home/millankumar/Documents/EVC/AutonomousElectrical/AutonomousDistroBoard/Debug", + "arguments": [ + "arm-none-eabi-gcc", + "../Core/Src/system_stm32f4xx.c", + "-mcpu=cortex-m4", + "-std=gnu11", + "-g3", + "-DDEBUG", + "-DUSE_HAL_DRIVER", + "-DSTM32F407xx", + "-c", + "-I../Core/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc", + "-I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy", + "-I../Drivers/CMSIS/Device/ST/STM32F4xx/Include", + "-I../Drivers/CMSIS/Include", + "-O0", + "-ffunction-sections", + "-fdata-sections", + "-Wall", + "-fstack-usage", + + "-MMD", + "-MP", + "-MFCore/Src/system_stm32f4xx.d", + "-MTCore/Src/system_stm32f4xx.o", + "--specs=nano.specs", + "-mfpu=fpv4-sp-d16", + "-mfloat-abi=hard", + "-mthumb", + "-o", + "Core/Src/system_stm32f4xx.o" + ], + "file": "../Core/Src/system_stm32f4xx.c" + } +] diff --git a/README.md b/README.md index 46d4b2c..b0df3ed 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ Autonomous Project electrical stack code -## Autonomous DistroBoard Pin Definitions +## Autonomous Control/Distro Board + +### Pin Definitions - **CAN Bus (CAN2):** - RX: `PB5` @@ -30,6 +32,7 @@ Autonomous Project electrical stack code - TIM11 (CH1): `PB9` - **GPIOs:** + - CAN_S: `PB7` - Main Coil EN: `PE5` - Precharge EN: `PE6` - LED OUT: `PE8` @@ -39,7 +42,24 @@ Autonomous Project electrical stack code - SWCLK: `PA14` - OSC_IN/OUT: `PH0` / `PH1` (8MHz HSE) -## Autonomous Nucelo Pin Definitions +### CAN messages + +- ID = `0x100` - **Control commands** (RX) + - Byte 0-1: throttle (uint16_t, little endian), 0-1000, where 1000 = full throttle + - Byte 2-3: steering (uint16_t, little endian), 0-1000, where 500 = straight, 0 = full left, 1000 = full right + - Byte 4-7: reserved / future use +- ID = `0x101` - **Status update** (TX) + - Byte 0: state machine mode + rc mode + - Bits0-3 = state machine mode (see logic.h::logic_mode_t) + - Bit4 = RC mode (0 = rc mode, 1 = autonomous mode) + - Bits5-7 = reserved + - Byte 1-2: throttle PWM (uint16_t, little endian), the actual PWM value being sent to the ESC for throttle (1000-2000) + - Byte 3-4: steering PWM (uint16_t, little endian), the actual PWM value being sent to the servo for steering (1000-2000) + - Byte 5-7: reserved / future use + +## Autonomous Nucleo + +### Pin Definitions - Rubik Pi 3 <-> nucleo-f446re: `SPI2` - SCK: `PB10`