Skip to content

Commit

Permalink
Fixed L471 not Building, Renaming Navigation (#76)
Browse files Browse the repository at this point in the history
* Added LF71 to Cmake, modified necessary HALs to support nav

* Fixed include path error

* Renamed Navigation to Torque Vectoring, changed old TV to Torque Vectoring (FPGA)

---------

Co-authored-by: AdityaAsGithub <[email protected]>
  • Loading branch information
AdityaAsGithub and AdityaAsGithub authored Dec 9, 2023
1 parent 0d829b9 commit 4560da9
Show file tree
Hide file tree
Showing 57 changed files with 1,434 additions and 1,375 deletions.
18 changes: 9 additions & 9 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
"preLaunchTask": "build",
"runToEntryPoint": "main"
},
{ "name": "Navigation",
{ "name": "Torque Vectoring",
"cwd": "${workspaceRoot}",
"executable": "./output/navigation/navigation.elf",
"executable": "./output/torque_vector/torque_vector.elf",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
Expand All @@ -75,7 +75,7 @@
],
"debuggerArgs": [
"-d",
"${workspaceFolder}/source/navigation"
"${workspaceFolder}/source/torque_vector"
],
"preLaunchTask": "build",
"runToEntryPoint": "main"
Expand Down Expand Up @@ -156,9 +156,9 @@
// "preLaunchTask": "build",
"runToEntryPoint": "main"
},
{ "name": "Torque Vectoring",
{ "name": "Torque Vectoring (FPGA)",
"cwd": "${workspaceRoot}",
"executable": "./output/torque_vector/torque_vector.elf",
"executable": "./output/torque_vector_fpga/torque_vector_fpga.elf",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
Expand All @@ -170,7 +170,7 @@
],
"debuggerArgs": [
"-d",
"${workspaceFolder}/source/torque_vector"
"${workspaceFolder}/source/torque_vector_fpga"
],
"preLaunchTask": "build",
"runToEntryPoint": "main"
Expand Down Expand Up @@ -289,9 +289,9 @@
"preLaunchTask": "build",
"runToEntryPoint": "main"
},
{ "name": "BL App - Torque Vectoring",
{ "name": "BL App - Torque Vectoring (FPGA)",
"cwd": "${workspaceRoot}",
"executable": "./output/torque_vector/BL_torque_vector.elf",
"executable": "./output/torque_vector_fpga/BL_torque_vector_fpga.elf",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
Expand All @@ -303,7 +303,7 @@
],
"debuggerArgs": [
"-d",
"${workspaceFolder}/source/torque_vector"
"${workspaceFolder}/source/torque_vector_fpga"
],
"preLaunchTask": "build",
"runToEntryPoint": "main"
Expand Down
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ include(cmake/FindSTM32HAL.cmake)

# See cmake/FindCMSIS.cmake and cmake/FindSTM32HAL.cmake for constructing additional libraries
make_cmsis_library(CMSIS_L432 STM32L4xx STM32L432xx ${CMAKE_SOURCE_DIR}/common/STM32CubeL4/Drivers/CMSIS)
make_cmsis_library(CMSIS_L471 STM32L4xx STM32L471xx ${CMAKE_SOURCE_DIR}/common/STM32CubeL4/Drivers/CMSIS)
make_cmsis_library(CMSIS_L496 STM32L4xx STM32L496xx ${CMAKE_SOURCE_DIR}/common/STM32CubeL4/Drivers/CMSIS)
make_cmsis_library(CMSIS_F407 STM32F4xx STM32F407xx ${CMAKE_SOURCE_DIR}/common/STM32CubeF4/Drivers/CMSIS)
make_cmsis_library(CMSIS_F732 STM32F7xx STM32F732xx ${CMAKE_SOURCE_DIR}/common/STM32CubeF7/Drivers/CMSIS)
Expand Down Expand Up @@ -86,10 +87,14 @@ add_subdirectory(source/bootloader)
add_subdirectory(source/l4_testing)
add_subdirectory(source/f4_testing)
add_subdirectory(source/f7_testing)
add_subdirectory(source/torque_vector)
add_subdirectory(source/precharge)
# add_subdirectory(source/driveline)
add_subdirectory(source/torque_vector)
add_subdirectory(source/dashboard)
add_subdirectory(source/pdu)


# Deprecated Components
# add_subdirectory(source/driveline)
# add_subdirectory(source/torque_vector_fpga)
# add_subdirectory(source/template)
# add_subdirectory(source/bms)
add_subdirectory(source/pdu)
4 changes: 2 additions & 2 deletions common/daq/can_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
]
},
{
"node_name":"Torque_Vector",
"node_name":"Torque_Vector_fpga",
"node_ssa":2,
"tx":[
{ "msg_name":"torque_request",
Expand Down Expand Up @@ -583,7 +583,7 @@
]
},
{
"node_name":"Navigation",
"node_name":"torque_vector",
"node_ssa": 55,
"tx":[
{ "msg_name":"gps_velocity",
Expand Down
36 changes: 18 additions & 18 deletions common/daq/per_dbc.dbc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ NS_ :

BS_:

BU_: Main_Module Torque_Vector Driveline Precharge OrionBMS Navigation Dashboard Steering Acceleration bootloader BMS_LV BITSTREAM Charger DAQ Precharge ARDUINO TEST_NODE TEST_NODE_2 DAQ
BU_: Main_Module Torque_Vector_fpga Driveline Precharge OrionBMS torque_vector Dashboard Steering Acceleration bootloader BMS_LV BITSTREAM Charger DAQ Precharge ARDUINO TEST_NODE TEST_NODE_2 DAQ


BO_ 2214598913 main_hb: 2 Main_Module
Expand Down Expand Up @@ -129,17 +129,17 @@ BO_ 2148059649 fault_sync_main_module: 3 Main_Module
BO_ 2550136769 daq_response_MAIN_MODULE: 8 Main_Module
SG_ daq_response : 0|64@1+ (1,0) [0|0] "" Vector__XXX

BO_ 2214592578 torque_request: 6 Torque_Vector
BO_ 2214592578 torque_request: 6 Torque_Vector_fpga
SG_ rear_right : 36|12@1+ (1,0) [0|0] "" Vector__XXX
SG_ rear_left : 24|12@1+ (1,0) [0|0] "" Vector__XXX
SG_ front_right : 12|12@1+ (1,0) [0|0] "" Vector__XXX
SG_ front_left : 0|12@1+ (1,0) [0|0] "" Vector__XXX

BO_ 2147490050 bitstream_flash_status: 1 Torque_Vector
BO_ 2147490050 bitstream_flash_status: 1 Torque_Vector_fpga
SG_ flash_timeout_rx : 1|1@1+ (1,0) [0|0] "" Vector__XXX
SG_ flash_success : 0|1@1+ (1,0) [0|0] "" Vector__XXX

BO_ 2148059714 fault_sync_torque_vector: 3 Torque_Vector
BO_ 2148059714 fault_sync_torque_vector_fpga: 3 Torque_Vector_fpga
SG_ latched : 16|1@1+ (1,0) [0|0] "" Vector__XXX
SG_ idx : 0|16@1+ (1,0) [0|0] "" Vector__XXX

Expand Down Expand Up @@ -315,64 +315,64 @@ BO_ 2348812088 orion_errors: 4 OrionBMS
SG_ charger_safety_relay : 1|1@1+ (1,0) [0|0] "" Vector__XXX
SG_ discharge_limit_enforce : 0|1@1+ (1,0) [0|0] "" Vector__XXX

BO_ 2348810935 gps_velocity: 8 Navigation
BO_ 2348810935 gps_velocity: 8 torque_vector
SG_ gps_vel_total : 48|16@1- (0.01,0) [0|0] "m/s" Vector__XXX
SG_ gps_vel_d : 32|16@1- (0.01,0) [0|0] "m/s" Vector__XXX
SG_ gps_vel_e : 16|16@1- (0.01,0) [0|0] "m/s" Vector__XXX
SG_ gps_vel_n : 0|16@1- (0.01,0) [0|0] "m/s" Vector__XXX

BO_ 2348819255 gps_position: 8 Navigation
BO_ 2348819255 gps_position: 8 torque_vector
SG_ height : 48|16@1- (0.01,0) [0|0] "m" Vector__XXX
SG_ gps_pos_z : 32|16@1- (0.01,0) [0|0] "m" Vector__XXX
SG_ gps_pos_y : 16|16@1- (0.01,0) [0|0] "m" Vector__XXX
SG_ gps_pos_x : 0|16@1- (0.01,0) [0|0] "m" Vector__XXX

BO_ 2348819319 gps_coordinates: 8 Navigation
BO_ 2348819319 gps_coordinates: 8 torque_vector
SG_ longitude : 32|32@1- (1,0) [0|0] "deg" Vector__XXX
SG_ latitude : 0|32@1- (1,0) [0|0] "deg" Vector__XXX

BO_ 2348810999 imu_gyro: 6 Navigation
BO_ 2348810999 imu_gyro: 6 torque_vector
SG_ imu_gyro_z : 32|16@1- (0.01,0) [0|0] "rad/s" Vector__XXX
SG_ imu_gyro_y : 16|16@1- (0.01,0) [0|0] "rad/s" Vector__XXX
SG_ imu_gyro_x : 0|16@1- (0.01,0) [0|0] "rad/s" Vector__XXX

BO_ 2348819383 imu_accel: 6 Navigation
BO_ 2348819383 imu_accel: 6 torque_vector
SG_ imu_accel_z : 32|16@1- (0.01,0) [0|0] "m/s^2" Vector__XXX
SG_ imu_accel_y : 16|16@1- (0.01,0) [0|0] "m/s^2" Vector__XXX
SG_ imu_accel_x : 0|16@1- (0.01,0) [0|0] "m/s^2" Vector__XXX

BO_ 2348819447 bmm_mag: 6 Navigation
BO_ 2348819447 bmm_mag: 6 torque_vector
SG_ bmm_mag_z : 32|16@1- (1,0) [0|0] "uT" Vector__XXX
SG_ bmm_mag_y : 16|16@1- (1,0) [0|0] "uT" Vector__XXX
SG_ bmm_mag_x : 0|16@1- (1,0) [0|0] "uT" Vector__XXX

BO_ 2348902711 sfs_pos: 6 Navigation
BO_ 2348902711 sfs_pos: 6 torque_vector
SG_ sfs_pos_z : 32|16@1- (0.01,0) [0|0] "m" Vector__XXX
SG_ sfs_pos_y : 16|16@1- (0.01,0) [0|0] "m" Vector__XXX
SG_ sfs_pos_x : 0|16@1- (0.01,0) [0|0] "m" Vector__XXX

BO_ 2348902775 sfs_vel: 6 Navigation
BO_ 2348902775 sfs_vel: 6 torque_vector
SG_ sfs_vel_z : 32|16@1- (0.01,0) [0|0] "m/s" Vector__XXX
SG_ sfs_vel_y : 16|16@1- (0.01,0) [0|0] "m/s" Vector__XXX
SG_ sfs_vel_x : 0|16@1- (0.01,0) [0|0] "m/s" Vector__XXX

BO_ 2348902839 sfs_acc: 6 Navigation
BO_ 2348902839 sfs_acc: 6 torque_vector
SG_ sfs_acc_z : 32|16@1- (0.01,0) [0|0] "m/s^2" Vector__XXX
SG_ sfs_acc_y : 16|16@1- (0.01,0) [0|0] "m/s^2" Vector__XXX
SG_ sfs_acc_x : 0|16@1- (0.01,0) [0|0] "m/s^2" Vector__XXX

BO_ 2348902903 sfs_ang: 8 Navigation
BO_ 2348902903 sfs_ang: 8 torque_vector
SG_ sfs_ang_d : 48|16@1- (0.0001,0) [0|0] "" Vector__XXX
SG_ sfs_ang_c : 32|16@1- (0.0001,0) [0|0] "" Vector__XXX
SG_ sfs_ang_b : 16|16@1- (0.0001,0) [0|0] "" Vector__XXX
SG_ sfs_ang_a : 0|16@1- (0.0001,0) [0|0] "" Vector__XXX

BO_ 2348902967 sfs_ang_vel: 6 Navigation
BO_ 2348902967 sfs_ang_vel: 6 torque_vector
SG_ sfs_ang_vel_z : 32|16@1- (0.0001,0) [0|0] "" Vector__XXX
SG_ sfs_ang_vel_y : 16|16@1- (0.0001,0) [0|0] "" Vector__XXX
SG_ sfs_ang_vel_x : 0|16@1- (0.0001,0) [0|0] "" Vector__XXX

BO_ 2348819895 throttle_remapped: 4 Navigation
BO_ 2348819895 throttle_remapped: 4 torque_vector
SG_ remap_k_rr : 16|16@1- (1,0) [0|0] "none" Vector__XXX
SG_ remap_k_rl : 0|16@1- (1,0) [0|0] "none" Vector__XXX

Expand Down Expand Up @@ -834,11 +834,11 @@ BO_ 2483032050 daq_command_TEST_NODE: 8 DAQ


CM_ BU_ Main_Module "";
CM_ BU_ Torque_Vector "";
CM_ BU_ Torque_Vector_fpga "";
CM_ BU_ Driveline "";
CM_ BU_ Precharge "";
CM_ BU_ OrionBMS "";
CM_ BU_ Navigation "";
CM_ BU_ torque_vector "";
CM_ BU_ Dashboard "";
CM_ BU_ Steering "";
CM_ BU_ Acceleration "";
Expand Down
4 changes: 2 additions & 2 deletions common/faults/fault_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,8 @@
]
},
{
"node_name": "tv",
"can_name": "torque_vector",
"node_name": "tv_old",
"can_name": "torque_vector_fpga",
"faults": [
{
"fault_name": "tv_offline",
Expand Down
2 changes: 1 addition & 1 deletion common/faults/fault_nodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define NODE_DRIVELINE_FRONT 1
#define NODE_DASHBOARD 2
#define NODE_PRECHARGE 3
#define NODE_TV 4
#define NODE_TV_OLD 4
#define NODE_TEST 5
//END AUTO NODE DEFS

Expand Down
2 changes: 1 addition & 1 deletion common/faults/faults.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#define TOTAL_DRIVELINE_FRONT_FAULTS 4
#define TOTAL_DASHBOARD_FAULTS 6
#define TOTAL_PRECHARGE_FAULTS 28
#define TOTAL_TV_FAULTS 1
#define TOTAL_TV_OLD_FAULTS 1
#define TOTAL_TEST_FAULTS 4
#define TOTAL_MCU_NUM 6
#define TOTAL_NUM_FAULTS 52
Expand Down
1 change: 1 addition & 0 deletions common/phal_L4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ MACRO(MAKE_PHAL_LIBRARY lib_name lib_link)
ENDMACRO(MAKE_PHAL_LIBRARY)

MAKE_PHAL_LIBRARY(PHAL_L432 CMSIS_L432)
MAKE_PHAL_LIBRARY(PHAL_L471 CMSIS_L471)
MAKE_PHAL_LIBRARY(PHAL_L496 CMSIS_L496)
9 changes: 4 additions & 5 deletions common/phal_L4/adc/adc.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file adc.h
* @author Luke Oxley ([email protected])
* @brief
* @brief
* @version 0.1
* @date 2021-12-27
*/
Expand Down Expand Up @@ -41,7 +41,7 @@ bool PHAL_initADC(ADC_TypeDef* adc, ADCInitConfig_t* config, ADCChannelConfig_t

#ifdef STM32L432xx
#define ADC_COMMON ADC1_COMMON
#elif STM32L496xx
#elif STM32L496xx || STM32L471xx
#define ADC_COMMON ADC123_COMMON
#else
#error "STM32 Arch not currently supported for ADC"
Expand All @@ -58,7 +58,7 @@ bool PHAL_initADC(ADC_TypeDef* adc, ADCInitConfig_t* config, ADCChannelConfig_t
adc->CFGR &= ~(ADC_CFGR_CONT);
adc->CFGR |= (config->cont_conv_mode << ADC_CFGR_CONT_Pos) & ADC_CFGR_CONT_Msk;

// Overrun
// Overrun
adc->CFGR &= ~(ADC_CFGR_OVRMOD);
adc->CFGR |= (config->overrun << ADC_CFGR_OVRMOD_Pos) & ADC_CFGR_OVRMOD_Msk;

Expand All @@ -77,7 +77,7 @@ bool PHAL_initADC(ADC_TypeDef* adc, ADCInitConfig_t* config, ADCChannelConfig_t
// DMA configuration
if (config->dma_mode != ADC_DMA_OFF)
{
adc->CFGR |= (ADC_CFGR_DMAEN) |
adc->CFGR |= (ADC_CFGR_DMAEN) |
(((config->dma_mode == ADC_DMA_CIRCULAR) << ADC_CFGR_DMACFG_Pos) & ADC_CFGR_DMACFG);
}
else adc->CFGR &= ~(ADC_CFGR_DMAEN);
Expand Down Expand Up @@ -149,4 +149,3 @@ uint16_t PHAL_readADC(ADC_TypeDef* adc)
{
return (uint16_t) (adc->DR & ADC_DR_RDATA_Msk);
}

14 changes: 8 additions & 6 deletions common/phal_L4/dma/dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

#ifdef STM32L496xx
#include "stm32l496xx.h"
#elif STM32L471xx
#include "stm32l471xx.h"
#elif STM32L432xx
#include "stm32l432xx.h"
#else
Expand Down Expand Up @@ -48,7 +50,7 @@ typedef struct {
/**
* @brief Initialize DMA peripheral to set m2m, p2p, or p2m with set size
* and length of txfer
*
*
* @param init -> Address of initialization structure
* @return true -> Successful init (no clashing params)
* @return false -> Init not complete (parameters clash)
Expand All @@ -57,35 +59,35 @@ bool PHAL_initDMA(dma_init_t* init);

/**
* @brief Start txfer after sucessful DMA peripheral initialization
*
*
* @param init -> Address of initialization structure
*/
void PHAL_startTxfer(dma_init_t* init);

/**
* @brief Stop txfer
*
*
* @param init -> Address of initialization structure
*/
void PHAL_stopTxfer(dma_init_t* init);

/**
* @brief Re-enable DMA txfer after error ISR fires
*
*
* @param init -> Address of initialization structure
*/
void PHAL_reEnable(dma_init_t* init);

/**
* @brief Set memory address for DMA transfer. In Mem to Mem this acts as the source address
*
*
* @param init -> Address of initialization structure
*/
void PHAL_DMA_setMemAddress(dma_init_t* init, const uint32_t address);

/**
* @brief Set transfer length for DMA transaction
*
*
* @param init -> Address of initialization structure
*/
void PHAL_DMA_setTxferLength(dma_init_t* init, const uint32_t length);
Expand Down
6 changes: 4 additions & 2 deletions common/phal_L4/eeprom/eeprom.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

#ifdef STM32L496xx
#include "stm32l496xx.h"
#elif STM32L471xx
#include "stm32l432xx.h"
#elif STM32L432xx
#include "stm32l432xx.h"
#else
Expand Down Expand Up @@ -47,7 +49,7 @@
#define S_BCMP 63

#define M_INIT 0
#define M_VERSION (M_INIT + S_INIT)
#define M_VERSION (M_INIT + S_INIT)
#define M_FNAME (M_VERSION + S_VERSION)
#define M_ADDR (M_FNAME + S_FNAME)
#define M_LEN (M_ADDR + S_ADDR)
Expand Down Expand Up @@ -76,7 +78,7 @@
* +-----------------------------------------+
* + PAGE 63 +
* +-----------------------------------------+
*
*
*/

// Structures
Expand Down
Loading

0 comments on commit 4560da9

Please sign in to comment.