Skip to content

Commit 287fbeb

Browse files
authored
Merge pull request #1 from PUT-Motorsport/sch_remake
finished schematic and layout
2 parents d41993f + 002a63d commit 287fbeb

334 files changed

Lines changed: 681264 additions & 2 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*.bak
77
*.bck
88
*.kicad_pcb-bak
9+
*.kicad_sch-bak
910
*.sch-bak
1011
*~
1112
_autosave-*
@@ -26,8 +27,8 @@ fp-info-cache
2627
*.csv
2728

2829
# 3d files
29-
*.step
30-
*.wrl
30+
#*.step
31+
#*.wrl
3132

3233
# Compile files
3334
*.bin

.gitmodules

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[submodule "firmware/Core/Inc/PUTM_EV_CAN_LIBRARY"]
2+
url = https://github.com/PUT-Motorsport/PUTM_EV_CAN_LIBRARY

firmware/.cproject

Lines changed: 246 additions & 0 deletions
Large diffs are not rendered by default.

firmware/.mxproject

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[PreviousLibFiles]
2+
LibFiles=Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_adc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_adc_ex.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_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_hal_dma_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma.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_hal_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_hal_can.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rtc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rtc_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_sdmmc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_sd.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_spi.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_hal_uart.h;Middlewares\Third_Party\FatFs\src\diskio.h;Middlewares\Third_Party\FatFs\src\ff.h;Middlewares\Third_Party\FatFs\src\ff_gen_drv.h;Middlewares\Third_Party\FatFs\src\integer.h;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_adc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_adc_ex.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_can.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rtc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rtc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_ll_sdmmc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_sd.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_spi.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;Middlewares\Third_Party\FatFs\src\diskio.c;Middlewares\Third_Party\FatFs\src\ff.c;Middlewares\Third_Party\FatFs\src\ff_gen_drv.c;Middlewares\Third_Party\FatFs\src\option\syscall.c;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_adc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_adc_ex.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_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_hal_dma_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma.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_hal_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_hal_can.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rtc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rtc_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_sdmmc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_sd.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_spi.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_hal_uart.h;Middlewares\Third_Party\FatFs\src\diskio.h;Middlewares\Third_Party\FatFs\src\ff.h;Middlewares\Third_Party\FatFs\src\ff_gen_drv.h;Middlewares\Third_Party\FatFs\src\integer.h;Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f446xx.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\cmsis_armcc.h;Drivers\CMSIS\Include\cmsis_armclang.h;Drivers\CMSIS\Include\cmsis_compiler.h;Drivers\CMSIS\Include\cmsis_gcc.h;Drivers\CMSIS\Include\cmsis_iccarm.h;Drivers\CMSIS\Include\cmsis_version.h;Drivers\CMSIS\Include\core_armv8mbl.h;Drivers\CMSIS\Include\core_armv8mml.h;Drivers\CMSIS\Include\core_cm0.h;Drivers\CMSIS\Include\core_cm0plus.h;Drivers\CMSIS\Include\core_cm1.h;Drivers\CMSIS\Include\core_cm23.h;Drivers\CMSIS\Include\core_cm3.h;Drivers\CMSIS\Include\core_cm33.h;Drivers\CMSIS\Include\core_cm4.h;Drivers\CMSIS\Include\core_cm7.h;Drivers\CMSIS\Include\core_sc000.h;Drivers\CMSIS\Include\core_sc300.h;Drivers\CMSIS\Include\mpu_armv7.h;Drivers\CMSIS\Include\mpu_armv8.h;Drivers\CMSIS\Include\tz_context.h;
3+
4+
[PreviousUsedCubeIDEFiles]
5+
SourceFiles=Core\Src\main.c;FATFS\Target\bsp_driver_sd.c;FATFS\Target\sd_diskio.c;FATFS\App\fatfs.c;FATFS\Target\fatfs_platform.c;Core\Src\stm32f4xx_it.c;Core\Src\stm32f4xx_hal_msp.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_adc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_adc_ex.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_can.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rtc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rtc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_ll_sdmmc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_sd.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_spi.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;Middlewares\Third_Party\FatFs\src\diskio.c;Middlewares\Third_Party\FatFs\src\ff.c;Middlewares\Third_Party\FatFs\src\ff_gen_drv.c;Middlewares\Third_Party\FatFs\src\option\syscall.c;Drivers\CMSIS\Device\ST\STM32F4xx\Source\Templates\system_stm32f4xx.c;Core\Src\system_stm32f4xx.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_adc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_adc_ex.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_can.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rtc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rtc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_ll_sdmmc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_sd.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_spi.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;Middlewares\Third_Party\FatFs\src\diskio.c;Middlewares\Third_Party\FatFs\src\ff.c;Middlewares\Third_Party\FatFs\src\ff_gen_drv.c;Middlewares\Third_Party\FatFs\src\option\syscall.c;Drivers\CMSIS\Device\ST\STM32F4xx\Source\Templates\system_stm32f4xx.c;Core\Src\system_stm32f4xx.c;;;Middlewares\Third_Party\FatFs\src\diskio.c;Middlewares\Third_Party\FatFs\src\ff.c;Middlewares\Third_Party\FatFs\src\ff_gen_drv.c;Middlewares\Third_Party\FatFs\src\option\syscall.c;
6+
HeaderPath=Drivers\STM32F4xx_HAL_Driver\Inc;Drivers\STM32F4xx_HAL_Driver\Inc\Legacy;Middlewares\Third_Party\FatFs\src;Drivers\CMSIS\Device\ST\STM32F4xx\Include;Drivers\CMSIS\Include;FATFS\Target;FATFS\App;Core\Inc;
7+
CDefines=USE_HAL_DRIVER;STM32F446xx;USE_HAL_DRIVER;USE_HAL_DRIVER;
8+
9+
[PreviousGenFiles]
10+
AdvancedFolderStructure=true
11+
HeaderFileListSize=8
12+
HeaderFiles#0=D:/GitHub/PUTM_EV_BMS_HV_2021/FATFS/Target/ffconf.h
13+
HeaderFiles#1=D:/GitHub/PUTM_EV_BMS_HV_2021/FATFS/Target/bsp_driver_sd.h
14+
HeaderFiles#2=D:/GitHub/PUTM_EV_BMS_HV_2021/FATFS/Target/sd_diskio.h
15+
HeaderFiles#3=D:/GitHub/PUTM_EV_BMS_HV_2021/FATFS/App/fatfs.h
16+
HeaderFiles#4=D:/GitHub/PUTM_EV_BMS_HV_2021/FATFS/Target/fatfs_platform.h
17+
HeaderFiles#5=D:/GitHub/PUTM_EV_BMS_HV_2021/Core/Inc/stm32f4xx_it.h
18+
HeaderFiles#6=D:/GitHub/PUTM_EV_BMS_HV_2021/Core/Inc/stm32f4xx_hal_conf.h
19+
HeaderFiles#7=D:/GitHub/PUTM_EV_BMS_HV_2021/Core/Inc/main.h
20+
HeaderFolderListSize=3
21+
HeaderPath#0=D:/GitHub/PUTM_EV_BMS_HV_2021/FATFS/Target
22+
HeaderPath#1=D:/GitHub/PUTM_EV_BMS_HV_2021/FATFS/App
23+
HeaderPath#2=D:/GitHub/PUTM_EV_BMS_HV_2021/Core/Inc
24+
HeaderFiles=;
25+
SourceFileListSize=7
26+
SourceFiles#0=D:/GitHub/PUTM_EV_BMS_HV_2021/FATFS/Target/bsp_driver_sd.c
27+
SourceFiles#1=D:/GitHub/PUTM_EV_BMS_HV_2021/FATFS/Target/sd_diskio.c
28+
SourceFiles#2=D:/GitHub/PUTM_EV_BMS_HV_2021/FATFS/App/fatfs.c
29+
SourceFiles#3=D:/GitHub/PUTM_EV_BMS_HV_2021/FATFS/Target/fatfs_platform.c
30+
SourceFiles#4=D:/GitHub/PUTM_EV_BMS_HV_2021/Core/Src/stm32f4xx_it.c
31+
SourceFiles#5=D:/GitHub/PUTM_EV_BMS_HV_2021/Core/Src/stm32f4xx_hal_msp.c
32+
SourceFiles#6=D:/GitHub/PUTM_EV_BMS_HV_2021/Core/Src/main.c
33+
SourceFolderListSize=3
34+
SourcePath#0=D:/GitHub/PUTM_EV_BMS_HV_2021/FATFS/Target
35+
SourcePath#1=D:/GitHub/PUTM_EV_BMS_HV_2021/FATFS/App
36+
SourcePath#2=D:/GitHub/PUTM_EV_BMS_HV_2021/Core/Src
37+
SourceFiles=;
38+

firmware/.project

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>PUTM_EV_BMS_HV_2021</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
10+
<triggers>clean,full,incremental,</triggers>
11+
<arguments>
12+
</arguments>
13+
</buildCommand>
14+
<buildCommand>
15+
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
16+
<triggers>full,incremental,</triggers>
17+
<arguments>
18+
</arguments>
19+
</buildCommand>
20+
</buildSpec>
21+
<natures>
22+
<nature>com.st.stm32cube.ide.mcu.MCUProjectNature</nature>
23+
<nature>org.eclipse.cdt.core.cnature</nature>
24+
<nature>com.st.stm32cube.ide.mcu.MCUCubeIdeServicesRevAev2ProjectNature</nature>
25+
<nature>com.st.stm32cube.ide.mcu.MCUCubeProjectNature</nature>
26+
<nature>com.st.stm32cube.ide.mcu.MCUAdvancedStructureProjectNature</nature>
27+
<nature>com.st.stm32cube.ide.mcu.MCUEndUserDisabledTrustZoneProjectNature</nature>
28+
<nature>com.st.stm32cube.ide.mcu.MCUSingleCpuProjectNature</nature>
29+
<nature>com.st.stm32cube.ide.mcu.MCURootProjectNature</nature>
30+
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
31+
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
32+
<nature>org.eclipse.cdt.core.ccnature</nature>
33+
</natures>
34+
</projectDescription>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
doxygen/doxygen_new_line_after_brief=true
2+
doxygen/doxygen_use_brief_tag=false
3+
doxygen/doxygen_use_javadoc_tags=true
4+
doxygen/doxygen_use_pre_tag=false
5+
doxygen/doxygen_use_structural_commands=false
6+
eclipse.preferences.version=1
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
8DF89ED150041C4CBC7CB9A9CAA90856=7A9A5572D8A41100AEA88E5E5A272E59
2+
DC22A860405A8BF2F2C095E5B6529F12=632E4A9F6884CCAB418D6590F0C4206E
3+
eclipse.preferences.version=1

firmware/Core/Inc/ltc_stack.h

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#ifndef LTC_STACK_H
2+
#define LTC_STACK_H
3+
4+
#include "main.h"
5+
6+
7+
8+
9+
#define LTCS_IN_STACK 15
10+
#define CELLS_IN_LTC 9
11+
12+
#define LTC_ADC_MD 0b11
13+
#define LTC_ADC_DCP 0b0
14+
#define LTC_CFG_REFON 0b1
15+
#define LTC_CFG_ADCOPT 0b1
16+
#define LTC_CFG_GPIO 0b11111
17+
18+
#define LTC_REFRESH_PERIOD 50
19+
#define LTC_ADC_DELAY 8
20+
21+
#define CELL_VOLTAGE_MIN 3000
22+
#define CELL_VOLTAGE_MAX 4180
23+
#define CELL_TEMPERATURE_MIN 40
24+
#define CELL_TEMPERATURE_MAX 550
25+
#define CELL_TEMPERATURE_CHARGING_MAX 410
26+
27+
#define CELL_VOLTAGE_ERR_CNTR_THRESHOLD 9
28+
#define CELL_CURRENT_ERR_CNTR_THRESHOLD 9
29+
#define CELL_TEMPERATURE_ERR_CNTR_THRESHOLD 19
30+
31+
#define CELL_ERROR_VOLTAGE_FLAG 0x01
32+
#define CELL_ERROR_TEMPERATURE_FLAG 0x02
33+
#define CELL_ERROR_CURRENT_FLAG 0x04
34+
35+
#define LTC_BALANCE_ROUND_PERIOD 60000
36+
37+
struct stack_data_type{
38+
// measurements
39+
uint16_t voltages[9 * LTCS_IN_STACK];
40+
int16_t temperatures[3 * LTCS_IN_STACK];
41+
// summary
42+
uint32_t total_voltage_mv;
43+
int16_t temperature_max;
44+
uint16_t cell_minimum_voltage;
45+
// discharge
46+
uint8_t discharge[9 * LTCS_IN_STACK];
47+
// errors
48+
uint8_t voltages_err_cntr[9 * LTCS_IN_STACK];
49+
uint8_t temperatures_err_cntr[9 * LTCS_IN_STACK];
50+
uint8_t current_err_cntr;
51+
uint8_t error;
52+
// measurement time
53+
uint32_t data_refresh_tick;
54+
// minimum cell
55+
int minimum_cell_no;
56+
// balancing
57+
uint8_t balance_activation_flag;
58+
};
59+
60+
void LtcInitPec15Table();
61+
62+
uint16_t LtcPec15(uint8_t *data , int len);
63+
64+
void LtcInit(SPI_HandleTypeDef *hspi, GPIO_TypeDef *cs_gpio, uint16_t cs_pin);
65+
66+
void LtcCommunicationThread();
67+
68+
void LtcWakeupSleep();
69+
70+
void LtcWakeupIdle();
71+
72+
void LtcTxCallback();
73+
74+
void LtcCsPinSet(uint8_t pin_state);
75+
76+
void LtcSendConfig(uint8_t discharge_activation);
77+
78+
void LtcStartAdcCell();
79+
80+
void LtcStartAdcGpio();
81+
82+
void LtcStartReadCell(uint8_t group);
83+
84+
void LtcStartReadGpio(uint8_t group);
85+
86+
void LtcReadCell(uint8_t group);
87+
88+
void LtcReadGpio(uint8_t group);
89+
90+
void LtcStackDataReorder();
91+
92+
int16_t LtcCalculateTemperature(uint16_t gpio_voltage);
93+
94+
void LtcErrorCheck();
95+
96+
uint8_t LtcGetStackError();
97+
98+
void LtcStackSummary();
99+
100+
void LtcClearCellAdc();
101+
102+
void LtcClearGpioAdc();
103+
104+
void LtcStackBalance();
105+
106+
107+
108+
#endif
109+
110+
111+

firmware/Core/Inc/main.h

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
/* USER CODE BEGIN Header */
2+
/**
3+
******************************************************************************
4+
* @file : main.h
5+
* @brief : Header for main.c file.
6+
* This file contains the common defines of the application.
7+
******************************************************************************
8+
* @attention
9+
*
10+
* <h2><center>&copy; Copyright (c) 2021 STMicroelectronics.
11+
* All rights reserved.</center></h2>
12+
*
13+
* This software component is licensed by ST under BSD 3-Clause license,
14+
* the "License"; You may not use this file except in compliance with the
15+
* License. You may obtain a copy of the License at:
16+
* opensource.org/licenses/BSD-3-Clause
17+
*
18+
******************************************************************************
19+
*/
20+
/* USER CODE END Header */
21+
22+
/* Define to prevent recursive inclusion -------------------------------------*/
23+
#ifndef __MAIN_H
24+
#define __MAIN_H
25+
26+
#ifdef __cplusplus
27+
extern "C" {
28+
#endif
29+
30+
/* Includes ------------------------------------------------------------------*/
31+
#include "stm32f4xx_hal.h"
32+
33+
/* Private includes ----------------------------------------------------------*/
34+
/* USER CODE BEGIN Includes */
35+
36+
/* USER CODE END Includes */
37+
38+
/* Exported types ------------------------------------------------------------*/
39+
/* USER CODE BEGIN ET */
40+
41+
/* USER CODE END ET */
42+
43+
/* Exported constants --------------------------------------------------------*/
44+
/* USER CODE BEGIN EC */
45+
46+
/* USER CODE END EC */
47+
48+
/* Exported macro ------------------------------------------------------------*/
49+
/* USER CODE BEGIN EM */
50+
51+
/* USER CODE END EM */
52+
53+
/* Exported functions prototypes ---------------------------------------------*/
54+
void Error_Handler(void);
55+
56+
/* USER CODE BEGIN EFP */
57+
58+
/* USER CODE END EFP */
59+
60+
/* Private defines -----------------------------------------------------------*/
61+
#define AIR_PLUS_Pin GPIO_PIN_0
62+
#define AIR_PLUS_GPIO_Port GPIOC
63+
#define AIR_MINUS_Pin GPIO_PIN_1
64+
#define AIR_MINUS_GPIO_Port GPIOC
65+
#define AIR_PRE_Pin GPIO_PIN_2
66+
#define AIR_PRE_GPIO_Port GPIOC
67+
#define SAFETY_DETECTION_Pin GPIO_PIN_3
68+
#define SAFETY_DETECTION_GPIO_Port GPIOC
69+
#define AMS_FAULT_MCU_Pin GPIO_PIN_4
70+
#define AMS_FAULT_MCU_GPIO_Port GPIOC
71+
#define LED1_Pin GPIO_PIN_1
72+
#define LED1_GPIO_Port GPIOB
73+
#define LED2_Pin GPIO_PIN_2
74+
#define LED2_GPIO_Port GPIOB
75+
#define LED3_Pin GPIO_PIN_10
76+
#define LED3_GPIO_Port GPIOB
77+
#define SPI2_CS1_Pin GPIO_PIN_6
78+
#define SPI2_CS1_GPIO_Port GPIOC
79+
#define SPI2_CS2_Pin GPIO_PIN_7
80+
#define SPI2_CS2_GPIO_Port GPIOC
81+
#define CARD_DETECT_Pin GPIO_PIN_8
82+
#define CARD_DETECT_GPIO_Port GPIOA
83+
#define DIN_1_Pin GPIO_PIN_3
84+
#define DIN_1_GPIO_Port GPIOB
85+
#define DIN_2_Pin GPIO_PIN_4
86+
#define DIN_2_GPIO_Port GPIOB
87+
#define DIN_3_Pin GPIO_PIN_5
88+
#define DIN_3_GPIO_Port GPIOB
89+
/* USER CODE BEGIN Private defines */
90+
91+
/* USER CODE END Private defines */
92+
93+
#ifdef __cplusplus
94+
}
95+
#endif
96+
97+
#endif /* __MAIN_H */
98+
99+
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

firmware/Core/Inc/serialport.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#ifndef SERIALPORT_H
2+
#define SERIALPORT_H
3+
4+
#include "stm32f4xx_hal.h"
5+
6+
#ifdef __cplusplus
7+
extern "C" {
8+
#endif
9+
10+
11+
#define SERIAL_RX_BUF_SIZE 50
12+
#define SERIAL_TX_BUF_SIZE 2000
13+
14+
struct serialport_type{
15+
UART_HandleTypeDef *huart;
16+
17+
uint8_t rx_buffer[SERIAL_RX_BUF_SIZE];
18+
uint16_t rx_head;
19+
uint16_t rx_tail;
20+
21+
uint8_t tx_buffer[SERIAL_TX_BUF_SIZE];
22+
uint16_t tx_head;
23+
uint16_t tx_tail;
24+
25+
uint8_t tx_busy;
26+
uint16_t tx_length;
27+
};
28+
29+
void SerialportOpen(UART_HandleTypeDef *huart);
30+
void SerialportRxCallback();
31+
void SerialportTxCallback();
32+
uint8_t SerialportWrite(uint8_t *data, uint16_t length);
33+
char* SerialportReadLine(uint16_t *length);
34+
35+
#ifdef __cplusplus
36+
}
37+
#endif
38+
39+
#endif

0 commit comments

Comments
 (0)