diff --git a/sdcl-firmware/.cproject b/sdcl-firmware/.cproject
index a8d61dd..d5b3598 100644
--- a/sdcl-firmware/.cproject
+++ b/sdcl-firmware/.cproject
@@ -23,7 +23,7 @@
-
+
@@ -96,13 +96,13 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -110,13 +110,13 @@
-
-
-
+
+
-
-
-
+
+
@@ -153,6 +153,7 @@
+
@@ -170,4 +171,5 @@
+
\ No newline at end of file
diff --git a/sdcl-firmware/.mxproject b/sdcl-firmware/.mxproject
index 8174194..c8d6424 100644
--- a/sdcl-firmware/.mxproject
+++ b/sdcl-firmware/.mxproject
@@ -1,3 +1,11 @@
+[PreviousLibFiles]
+LibFiles=Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_can.h;Drivers/STM32F3xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_def.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_rcc.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_rcc_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_gpio.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_gpio_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_dma_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_dma.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_cortex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_pwr.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_pwr_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_flash.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_flash_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_i2c.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_i2c_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_exti.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_tim.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_tim_ex.h;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_can.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_gpio.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_dma.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_cortex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_exti.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim_ex.c;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_can.h;Drivers/STM32F3xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_def.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_rcc.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_rcc_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_gpio.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_gpio_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_dma_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_dma.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_cortex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_pwr.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_pwr_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_flash.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_flash_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_i2c.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_i2c_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_exti.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_tim.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_tim_ex.h;Drivers/CMSIS/Device/ST/STM32F3xx/Include/stm32f302x8.h;Drivers/CMSIS/Device/ST/STM32F3xx/Include/stm32f3xx.h;Drivers/CMSIS/Device/ST/STM32F3xx/Include/system_stm32f3xx.h;Drivers/CMSIS/Device/ST/STM32F3xx/Source/Templates/system_stm32f3xx.c;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/core_armv8mbl.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/cmsis_iccarm.h;Drivers/CMSIS/Include/tz_context.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/mpu_armv7.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/core_sc000.h;
+
+[PreviousUsedCubeIDEFiles]
+SourceFiles=Core/Src/main.c;Core/Src/stm32f3xx_it.c;Core/Src/stm32f3xx_hal_msp.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_can.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_gpio.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_dma.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_cortex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_exti.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim_ex.c;Drivers/CMSIS/Device/ST/STM32F3xx/Source/Templates/system_stm32f3xx.c;Core/Src/system_stm32f3xx.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_can.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_gpio.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_dma.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_cortex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_exti.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim_ex.c;Drivers/CMSIS/Device/ST/STM32F3xx/Source/Templates/system_stm32f3xx.c;Core/Src/system_stm32f3xx.c;;;
+HeaderPath=Drivers/STM32F3xx_HAL_Driver/Inc;Drivers/STM32F3xx_HAL_Driver/Inc/Legacy;Drivers/CMSIS/Device/ST/STM32F3xx/Include;Drivers/CMSIS/Include;Core/Inc;
+CDefines=USE_HAL_DRIVER;STM32F302x8;USE_HAL_DRIVER;USE_HAL_DRIVER;
+
[PreviousGenFiles]
AdvancedFolderStructure=true
HeaderFileListSize=3
@@ -15,11 +23,3 @@ SourceFolderListSize=1
SourcePath#0=/home/oskar/Documents/Uni/FaSTTUBe/repos/SDCL/sdcl-firmware/Core/Src
SourceFiles=;
-[PreviousLibFiles]
-LibFiles=Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_can.h;Drivers/STM32F3xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_def.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_rcc.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_rcc_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_gpio.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_gpio_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_dma_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_dma.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_cortex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_pwr.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_pwr_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_flash.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_flash_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_i2c.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_i2c_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_exti.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_tim.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_tim_ex.h;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_can.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_gpio.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_dma.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_cortex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_exti.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim_ex.c;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_can.h;Drivers/STM32F3xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_def.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_rcc.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_rcc_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_gpio.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_gpio_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_dma_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_dma.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_cortex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_pwr.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_pwr_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_flash.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_flash_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_i2c.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_i2c_ex.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_exti.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_tim.h;Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_tim_ex.h;Drivers/CMSIS/Device/ST/STM32F3xx/Include/stm32f302x8.h;Drivers/CMSIS/Device/ST/STM32F3xx/Include/stm32f3xx.h;Drivers/CMSIS/Device/ST/STM32F3xx/Include/system_stm32f3xx.h;Drivers/CMSIS/Device/ST/STM32F3xx/Source/Templates/system_stm32f3xx.c;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/core_armv8mbl.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/cmsis_iccarm.h;Drivers/CMSIS/Include/tz_context.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/mpu_armv7.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/core_sc000.h;
-
-[PreviousUsedCubeIDEFiles]
-SourceFiles=Core/Src/main.c;Core/Src/stm32f3xx_it.c;Core/Src/stm32f3xx_hal_msp.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_can.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_gpio.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_dma.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_cortex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_exti.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim_ex.c;Drivers/CMSIS/Device/ST/STM32F3xx/Source/Templates/system_stm32f3xx.c;Core/Src/system_stm32f3xx.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_can.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_gpio.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_dma.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_cortex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c_ex.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_exti.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim.c;Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim_ex.c;Drivers/CMSIS/Device/ST/STM32F3xx/Source/Templates/system_stm32f3xx.c;Core/Src/system_stm32f3xx.c;;;
-HeaderPath=Drivers/STM32F3xx_HAL_Driver/Inc;Drivers/STM32F3xx_HAL_Driver/Inc/Legacy;Drivers/CMSIS/Device/ST/STM32F3xx/Include;Drivers/CMSIS/Include;Core/Inc;
-CDefines=USE_HAL_DRIVER;STM32F302x8;USE_HAL_DRIVER;USE_HAL_DRIVER;
-
diff --git a/sdcl-firmware/Core/Inc/main.h b/sdcl-firmware/Core/Inc/main.h
index 1be8c17..868c537 100644
--- a/sdcl-firmware/Core/Inc/main.h
+++ b/sdcl-firmware/Core/Inc/main.h
@@ -57,18 +57,18 @@ void Error_Handler(void);
/* USER CODE END EFP */
/* Private defines -----------------------------------------------------------*/
+#define SDC_is_ready_Pin GPIO_PIN_1
+#define SDC_is_ready_GPIO_Port GPIOA
#define AS_close_SDC_Pin GPIO_PIN_3
#define AS_close_SDC_GPIO_Port GPIOA
#define AS_driving_mode_Pin GPIO_PIN_4
#define AS_driving_mode_GPIO_Port GPIOA
#define Watchdog_Pin GPIO_PIN_5
#define Watchdog_GPIO_Port GPIOA
-#define TS_activate_MUXed_Pin GPIO_PIN_0
-#define TS_activate_MUXed_GPIO_Port GPIOB
-#define SDC_is_ready_Pin GPIO_PIN_1
-#define SDC_is_ready_GPIO_Port GPIOB
-#define SDC_in_3V3_Pin GPIO_PIN_2
-#define SDC_in_3V3_GPIO_Port GPIOB
+#define TS_activate_MUXed_Pin GPIO_PIN_7
+#define TS_activate_MUXed_GPIO_Port GPIOA
+#define SDC_in_3V3_Pin GPIO_PIN_8
+#define SDC_in_3V3_GPIO_Port GPIOA
/* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */
diff --git a/sdcl-firmware/Core/Inc/stm32f3xx_it.h b/sdcl-firmware/Core/Inc/stm32f3xx_it.h
index 01fd19c..b4b0d26 100644
--- a/sdcl-firmware/Core/Inc/stm32f3xx_it.h
+++ b/sdcl-firmware/Core/Inc/stm32f3xx_it.h
@@ -55,6 +55,7 @@ void SVC_Handler(void);
void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
+void USB_LP_CAN_RX0_IRQHandler(void);
/* USER CODE BEGIN EFP */
/* USER CODE END EFP */
diff --git a/sdcl-firmware/Core/Src/main.c b/sdcl-firmware/Core/Src/main.c
index ad7759b..46ebbff 100644
--- a/sdcl-firmware/Core/Src/main.c
+++ b/sdcl-firmware/Core/Src/main.c
@@ -19,6 +19,7 @@
/* USER CODE BEGIN Includes */
#include
+#include
/* USER CODE END Includes */
@@ -28,7 +29,7 @@
// BITFIELDS ARE LSB FIRST!
typedef union {
- uint8_t raw[8];
+ uint8_t raw[1];
struct {
bool as_driving_mode : 1;
bool as_close_sdc : 1;
@@ -120,15 +121,38 @@ int main(void)
MX_CAN_Init();
/* USER CODE BEGIN 2 */
+ // Init data as LOW
+ memset(&RxData, 0, sizeof(rx_data_t));
+
+ if (HAL_CAN_Start(&hcan) != HAL_OK)
+ Error_Handler();
+
+ CAN_FilterTypeDef canfilterconfig;
+
+ canfilterconfig.FilterActivation = CAN_FILTER_ENABLE;
+ canfilterconfig.FilterBank = 0;
+ canfilterconfig.FilterFIFOAssignment = CAN_FILTER_FIFO0;
+ canfilterconfig.FilterIdHigh = 0;
+ canfilterconfig.FilterIdLow = 0;
+ canfilterconfig.FilterMaskIdHigh = 0;
+ canfilterconfig.FilterMaskIdLow = 0;
+ canfilterconfig.FilterMode = CAN_FILTERMODE_IDMASK;
+ canfilterconfig.FilterScale = CAN_FILTERSCALE_32BIT;
+ canfilterconfig.SlaveStartFilterBank = 14;
+
+ if (HAL_CAN_ConfigFilter(&hcan, &canfilterconfig) != HAL_OK) {
+ Error_Handler();
+ }
+
if (HAL_CAN_ActivateNotification(&hcan, CAN_IT_RX_FIFO0_MSG_PENDING) != HAL_OK)
Error_Handler();
- HAL_CAN_Start(&hcan);
-
CAN_TxHeaderTypeDef TxHeader;
uint32_t TxMailbox;
tx_data_t TxData;
+ memset(&TxData, 0, sizeof(tx_data_t));
+
// Prep the tx frame
TxHeader.IDE = CAN_ID_STD;
TxHeader.StdId = CAN_ID_TX;
@@ -149,13 +173,16 @@ int main(void)
HAL_GPIO_WritePin(GPIOA, AS_close_SDC_Pin, RxData.signals.as_close_sdc);
HAL_GPIO_WritePin(GPIOA, Watchdog_Pin, RxData.signals.watchdog);
- // every nth rx, we tx
+ // every nth rx, we tx¨
if (++counter >= (TX_UPDATE_PERIOD / RX_UPDATE_PERIOD)) {
// Read values to send
- TxData.signals.sdc_in = HAL_GPIO_ReadPin(GPIOA, SDC_in_3V3_Pin);
- TxData.signals.sdc_ready = HAL_GPIO_ReadPin(GPIOA, SDC_is_ready_Pin);
- TxData.signals.ts_start = HAL_GPIO_ReadPin(GPIOA, TS_activate_MUXed_Pin);
+ uint8_t s = HAL_GPIO_ReadPin(GPIOA, SDC_in_3V3_Pin) == GPIO_PIN_SET;
+ uint8_t r = HAL_GPIO_ReadPin(GPIOA, SDC_is_ready_Pin) == GPIO_PIN_SET;
+ uint8_t t = HAL_GPIO_ReadPin(GPIOA, TS_activate_MUXed_Pin) == GPIO_PIN_SET;
+ TxData.signals.sdc_in = s;
+ TxData.signals.sdc_ready = r;
+ TxData.signals.ts_start = t;
// Send out CAN message
if (HAL_CAN_AddTxMessage(&hcan, &TxHeader, TxData.raw, &TxMailbox) != HAL_OK)
@@ -165,7 +192,17 @@ int main(void)
}
- // Slow the loop
+// CAN_RxHeaderTypeDef RxHeader;
+// uint8_t RxBuffer[8];
+//
+// // Read frame from HW into buffer
+// if (HAL_CAN_GetRxMessage(&hcan, CAN_RX_FIFO0, &RxHeader, RxBuffer) == HAL_OK) {
+// // Copy into the bitfield if it's for us
+// if (RxHeader.StdId == CAN_ID_RX)
+// RxData.raw[0] = RxBuffer[0];
+// }
+//
+// // Slow the loop
HAL_Delay(RX_UPDATE_PERIOD);
/* USER CODE END WHILE */
@@ -234,7 +271,7 @@ static void MX_CAN_Init(void)
hcan.Init.TimeTriggeredMode = DISABLE;
hcan.Init.AutoBusOff = DISABLE;
hcan.Init.AutoWakeUp = DISABLE;
- hcan.Init.AutoRetransmission = DISABLE;
+ hcan.Init.AutoRetransmission = ENABLE;
hcan.Init.ReceiveFifoLocked = DISABLE;
hcan.Init.TransmitFifoPriority = DISABLE;
if (HAL_CAN_Init(&hcan) != HAL_OK)
@@ -263,6 +300,12 @@ static void MX_GPIO_Init(void)
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOA, AS_close_SDC_Pin|AS_driving_mode_Pin|Watchdog_Pin, GPIO_PIN_RESET);
+ /*Configure GPIO pins : SDC_is_ready_Pin SDC_in_3V3_Pin */
+ GPIO_InitStruct.Pin = SDC_is_ready_Pin|SDC_in_3V3_Pin;
+ GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
+ HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
/*Configure GPIO pins : AS_close_SDC_Pin AS_driving_mode_Pin Watchdog_Pin */
GPIO_InitStruct.Pin = AS_close_SDC_Pin|AS_driving_mode_Pin|Watchdog_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
@@ -270,11 +313,11 @@ static void MX_GPIO_Init(void)
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
- /*Configure GPIO pins : TS_activate_MUXed_Pin SDC_is_ready_Pin SDC_in_3V3_Pin */
- GPIO_InitStruct.Pin = TS_activate_MUXed_Pin|SDC_is_ready_Pin|SDC_in_3V3_Pin;
+ /*Configure GPIO pin : TS_activate_MUXed_Pin */
+ GPIO_InitStruct.Pin = TS_activate_MUXed_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
+ GPIO_InitStruct.Pull = GPIO_PULLDOWN;
+ HAL_GPIO_Init(TS_activate_MUXed_GPIO_Port, &GPIO_InitStruct);
}
diff --git a/sdcl-firmware/Core/Src/stm32f3xx_hal_msp.c b/sdcl-firmware/Core/Src/stm32f3xx_hal_msp.c
index 8b83043..3465854 100644
--- a/sdcl-firmware/Core/Src/stm32f3xx_hal_msp.c
+++ b/sdcl-firmware/Core/Src/stm32f3xx_hal_msp.c
@@ -105,6 +105,9 @@ void HAL_CAN_MspInit(CAN_HandleTypeDef* hcan)
GPIO_InitStruct.Alternate = GPIO_AF9_TIM1;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+ /* CAN interrupt Init */
+ HAL_NVIC_SetPriority(USB_LP_CAN_RX0_IRQn, 0, 0);
+ HAL_NVIC_EnableIRQ(USB_LP_CAN_RX0_IRQn);
/* USER CODE BEGIN CAN_MspInit 1 */
/* USER CODE END CAN_MspInit 1 */
@@ -134,6 +137,8 @@ void HAL_CAN_MspDeInit(CAN_HandleTypeDef* hcan)
*/
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_11|GPIO_PIN_12);
+ /* CAN interrupt DeInit */
+ HAL_NVIC_DisableIRQ(USB_LP_CAN_RX0_IRQn);
/* USER CODE BEGIN CAN_MspDeInit 1 */
/* USER CODE END CAN_MspDeInit 1 */
diff --git a/sdcl-firmware/Core/Src/stm32f3xx_it.c b/sdcl-firmware/Core/Src/stm32f3xx_it.c
index 68a9ac3..a56d1b8 100644
--- a/sdcl-firmware/Core/Src/stm32f3xx_it.c
+++ b/sdcl-firmware/Core/Src/stm32f3xx_it.c
@@ -55,7 +55,7 @@
/* USER CODE END 0 */
/* External variables --------------------------------------------------------*/
-
+extern CAN_HandleTypeDef hcan;
/* USER CODE BEGIN EV */
/* USER CODE END EV */
@@ -198,6 +198,20 @@ void SysTick_Handler(void)
/* please refer to the startup file (startup_stm32f3xx.s). */
/******************************************************************************/
+/**
+ * @brief This function handles CAN RX0 and USB low priority interrupts.
+ */
+void USB_LP_CAN_RX0_IRQHandler(void)
+{
+ /* USER CODE BEGIN USB_LP_CAN_RX0_IRQn 0 */
+
+ /* USER CODE END USB_LP_CAN_RX0_IRQn 0 */
+ HAL_CAN_IRQHandler(&hcan);
+ /* USER CODE BEGIN USB_LP_CAN_RX0_IRQn 1 */
+
+ /* USER CODE END USB_LP_CAN_RX0_IRQn 1 */
+}
+
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
diff --git a/sdcl-firmware/STM32F302C8TX_FLASH.ld b/sdcl-firmware/STM32F302C8TX_FLASH.ld
index 0d8600c..1f16373 100644
--- a/sdcl-firmware/STM32F302C8TX_FLASH.ld
+++ b/sdcl-firmware/STM32F302C8TX_FLASH.ld
@@ -38,8 +38,8 @@ ENTRY(Reset_Handler)
/* Highest address of the user mode stack */
_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
-_Min_Heap_Size = 0x200; /* required amount of heap */
-_Min_Stack_Size = 0x400; /* required amount of stack */
+_Min_Heap_Size = 0x200 ; /* required amount of heap */
+_Min_Stack_Size = 0x400 ; /* required amount of stack */
/* Memories definition */
MEMORY
diff --git a/sdcl-firmware/sdcl-firmware Debug.launch b/sdcl-firmware/sdcl-firmware Debug.launch
new file mode 100644
index 0000000..2133448
--- /dev/null
+++ b/sdcl-firmware/sdcl-firmware Debug.launch
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdcl-firmware/sdcl-firmware.ioc b/sdcl-firmware/sdcl-firmware.ioc
index 23739fd..143f88d 100644
--- a/sdcl-firmware/sdcl-firmware.ioc
+++ b/sdcl-firmware/sdcl-firmware.ioc
@@ -4,8 +4,10 @@ CAN.BS2=CAN_BS2_2TQ
CAN.CalculateBaudRate=500000
CAN.CalculateTimeBit=2000
CAN.CalculateTimeQuantum=125.0
-CAN.IPParameters=CalculateTimeQuantum,CalculateTimeBit,CalculateBaudRate,Prescaler,BS1,BS2
+CAN.IPParameters=CalculateTimeQuantum,CalculateTimeBit,CalculateBaudRate,Prescaler,BS1,BS2,SJW,NART
+CAN.NART=ENABLE
CAN.Prescaler=1
+CAN.SJW=CAN_SJW_1TQ
File.Version=6
GPIO.groupedBy=Group By Peripherals
KeepUserPlacement=false
@@ -17,14 +19,14 @@ Mcu.IP3=SYS
Mcu.IPNb=4
Mcu.Name=STM32F302C(6-8)Tx
Mcu.Package=LQFP48
-Mcu.Pin0=PA3
-Mcu.Pin1=PA4
+Mcu.Pin0=PA1
+Mcu.Pin1=PA3
Mcu.Pin10=PB3
Mcu.Pin11=VP_SYS_VS_Systick
-Mcu.Pin2=PA5
-Mcu.Pin3=PB0
-Mcu.Pin4=PB1
-Mcu.Pin5=PB2
+Mcu.Pin2=PA4
+Mcu.Pin3=PA5
+Mcu.Pin4=PA7
+Mcu.Pin5=PA8
Mcu.Pin6=PA11
Mcu.Pin7=PA12
Mcu.Pin8=PA13
@@ -45,7 +47,12 @@ NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:false\:true
+NVIC.USB_LP_CAN_RX0_IRQn=true\:0\:0\:false\:false\:true\:true\:true
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
+PA1.GPIOParameters=GPIO_Label
+PA1.GPIO_Label=SDC_is_ready
+PA1.Locked=true
+PA1.Signal=GPIO_Input
PA11.Locked=true
PA11.Mode=CAN_Activate
PA11.Signal=CAN_RX
@@ -68,18 +75,15 @@ PA5.GPIOParameters=GPIO_Label
PA5.GPIO_Label=Watchdog
PA5.Locked=true
PA5.Signal=GPIO_Output
-PB0.GPIOParameters=GPIO_Label
-PB0.GPIO_Label=TS_activate_MUXed
-PB0.Locked=true
-PB0.Signal=GPIO_Input
-PB1.GPIOParameters=GPIO_Label
-PB1.GPIO_Label=SDC_is_ready
-PB1.Locked=true
-PB1.Signal=GPIO_Input
-PB2.GPIOParameters=GPIO_Label
-PB2.GPIO_Label=SDC_in_3V3
-PB2.Locked=true
-PB2.Signal=GPIO_Input
+PA7.GPIOParameters=GPIO_PuPd,GPIO_Label
+PA7.GPIO_Label=TS_activate_MUXed
+PA7.GPIO_PuPd=GPIO_PULLDOWN
+PA7.Locked=true
+PA7.Signal=GPIO_Input
+PA8.GPIOParameters=GPIO_Label
+PA8.GPIO_Label=SDC_in_3V3
+PA8.Locked=true
+PA8.Signal=GPIO_Input
PB3.Mode=Trace_Asynchronous_SW
PB3.Signal=SYS_JTDO-TRACESWO
PCC.Checker=false