Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
482 changes: 39 additions & 443 deletions .vscode/launch.json

Large diffs are not rendered by default.

143 changes: 9 additions & 134 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,6 @@
"command": "configure",
"preset": "${command:cmake.activeConfigurePresetName}"
},
{
"label": "Build Embedded Quintuna",
"detail": "CMake Generate step",
"group": "build",
"type": "cmake",
"command": "build",
"targets": [
"quintuna_BMS.hex",
"quintuna_VC.hex",
"quintuna_CRIT.hex",
"quintuna_RSM.hex",
"quintuna_FSM.hex",
"quintuna_DAM.hex",
"can_bus_load_quintuna"
]
},
{
"label": "Build Embedded Hexray",
"detail": "CMake Generate step",
Expand All @@ -69,88 +53,6 @@
"command": "clean",
"preset": "${command:cmake.activeBuildPresetName}"
},
{
"label": "Build Embedded: VCR (Quintuna)",
"group": "build",
"type": "cmake",
"command": "build",
"targets": [
"quintuna_VCR_app.elf",
]
},
{
"label": "Build Embedded: BMS (Quintuna)",
"group": "build",
"type": "cmake",
"command": "build",
"targets": [
"quintuna_BMS.hex",
]
},
{
"label": "Run Tests: BMS (Quintuna)",
"type": "shell",
"command": "${workspaceFolder}/build_fw_test/firmware/quintuna/BMS/quintuna_BMS_test",
"group": "test",
"presentation": {
"reveal": "always"
},
"problemMatcher": []
},
{
"label": "Build Embedded: VC (Quintuna)",
"group": "build",
"type": "cmake",
"command": "build",
"targets": [
"quintuna_VC.hex",
]
},
{
"label": "Build Embedded: CRIT (Quintuna)",
"group": "build",
"type": "cmake",
"command": "build",
"targets": [
"quintuna_CRIT.hex",
]
},
{
"label": "Build Embedded: DAM (Quintuna)",
"group": "build",
"type": "cmake",
"command": "build",
"targets": [
"quintuna_DAM.hex",
]
},
{
"label": "Build Embedded: RSM (Quintuna)",
"group": "build",
"type": "cmake",
"command": "build",
"targets": [
"quintuna_RSM.hex",
]
},
{
"label": "Build Embedded: FSM (Quintuna)",
"group": "build",
"type": "cmake",
"command": "build",
"targets": [
"quintuna_FSM.hex",
]
},
{
"label": "Build Embedded: PCM (Quintuna)",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Similarly here wna delete all quintuna configs?

"group": "build",
"type": "cmake",
"command": "build",
"targets": [
"quintuna_PCM_app.elf",
]
},
{
"label": "Build Embedded: h7dev",
"group": "build",
Expand Down Expand Up @@ -178,33 +80,6 @@
"ssm.hex"
]
},
{
"label": "Build Tests: CRIT (Quintuna)",
"group": "build",
"type": "cmake",
"command": "build",
"targets": [
"quintuna_CRIT_test"
]
},
{
"label": "Build Tests: VC (Quintuna)",
"group": "build",
"type": "cmake",
"command": "build",
"targets": [
"quintuna_VC_test"
]
},
{
"label": "Build Tests: BMS (Quintuna)",
"group": "build",
"type": "cmake",
"command": "build",
"targets": [
"quintuna_BMS_test"
]
},
{
"label": "Build Embedded: BMS (Hexray)",
"group": "build",
Expand Down Expand Up @@ -313,6 +188,15 @@
"hexray_FSM_chimera.elf"
]
},
{
"label": "Build Embedded: PCM (Hexray)",
"group": "build",
"type": "cmake",
"command": "build",
"targets": [
"hexray_PCM_app.elf",
]
},
{
"label": "Build Embedded: RSM (Hexray)",
"group": "build",
Expand Down Expand Up @@ -386,15 +270,6 @@
"jsoncan_test"
]
},
{
"label": "CAN Bus Load: Quintuna",
"group": "build",
"type": "cmake",
"command": "build",
"targets": [
"can_bus_load_quintuna"
]
},
{
"label": "Run Telem Backend",
"type": "shell",
Expand Down
1 change: 1 addition & 0 deletions firmware/hexray/PCM/src/cubemx/Inc/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ extern "C"
#define SWO_GPIO_Port GPIOB
#define PCM_EN_Pin GPIO_PIN_5
#define PCM_EN_GPIO_Port GPIOB
#define PCM_EN_EXTI_IRQn EXTI9_5_IRQn
#define VICOR_SMBUS_SCL_Pin GPIO_PIN_6
#define VICOR_SMBUS_SCL_GPIO_Port GPIOB
#define VICOR_SMBUS_SDA_Pin GPIO_PIN_7
Expand Down
1 change: 1 addition & 0 deletions firmware/hexray/PCM/src/cubemx/Inc/stm32f4xx_it.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ extern "C"
void UsageFault_Handler(void);
void DebugMon_Handler(void);
void SysTick_Handler(void);
void EXTI9_5_IRQHandler(void);
void I2C1_EV_IRQHandler(void);
void I2C1_ER_IRQHandler(void);
/* USER CODE BEGIN EFP */
Expand Down
17 changes: 8 additions & 9 deletions firmware/hexray/PCM/src/cubemx/PCM.ioc
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ Mcu.Pin6=PB6
Mcu.Pin7=PB7
Mcu.Pin8=VP_SYS_VS_Systick
Mcu.PinsNb=9
Mcu.ThirdParty0=STMicroelectronics.X-CUBE-SMBUS.2.1.0
Mcu.ThirdPartyNb=1
Mcu.ThirdPartyNb=0
Mcu.UserConstants=
Mcu.UserName=STM32F412RGTx
MxCube.Version=6.15.0
MxDb.Version=DB.6.0.150
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.EXTI9_5_IRQn=true\:5\:0\:true\:false\:true\:true\:true\:true
NVIC.ForceEnableDMAVector=true
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.I2C1_ER_IRQn=true\:5\:0\:true\:false\:true\:true\:true\:true
Expand Down Expand Up @@ -62,10 +62,12 @@ PB3.GPIO_Label=SWO
PB3.Locked=true
PB3.Mode=Trace_Asynchronous_SW
PB3.Signal=SYS_JTDO-SWO
PB5.GPIOParameters=GPIO_Label
PB5.GPIOParameters=GPIO_Label,GPIO_ITMode,GPIO_ModeDefaultEXTI
PB5.GPIO_ITMode=Interrupt_Rising_Falling_Edge
PB5.GPIO_Label=PCM_EN
PB5.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_RISING_FALLING
PB5.Locked=true
PB5.Signal=GPIO_Input
PB5.Signal=GPXTI5
PB6.GPIOParameters=GPIO_Label
PB6.GPIO_Label=VICOR_SMBUS_SCL
PB6.Locked=true
Expand Down Expand Up @@ -144,11 +146,8 @@ RCC.VCOI2SInputFreq_Value=1000000
RCC.VCOI2SOutputFreq_Value=192000000
RCC.VCOInputFreq_Value=1000000
RCC.VCOOutputFreq_Value=192000000
STMicroelectronics.X-CUBE-SMBUS.2.1.0.ApplicationJjApplication_Checked=false
STMicroelectronics.X-CUBE-SMBUS.2.1.0.IPParameters=SMB_master
STMicroelectronics.X-CUBE-SMBUS.2.1.0.SMB_master=1
STMicroelectronics.X-CUBE-SMBUS.2.1.0.SMbusJjSMBusIiPMBusIiStack_Checked=false
STMicroelectronics.X-CUBE-SMBUS.2.1.0_SwParameter=ApplicationCcApplicationJjApplication\:true;SMBusIiPMBusIiStackCcSMbusJjSMBus\:true;
SH.GPXTI5.0=GPIO_EXTI5
SH.GPXTI5.ConfNb=1
VP_SYS_VS_Systick.Mode=SysTick
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
board=custom
2 changes: 1 addition & 1 deletion firmware/hexray/PCM/src/cubemx/PCM.ioc.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9075300837875b8e54de77a35ad094c7
6c152407cb5a0d57cb1ccdd44010ea4c
6 changes: 5 additions & 1 deletion firmware/hexray/PCM/src/cubemx/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,14 @@ static void MX_GPIO_Init(void)

/*Configure GPIO pin : PCM_EN_Pin */
GPIO_InitStruct.Pin = PCM_EN_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(PCM_EN_GPIO_Port, &GPIO_InitStruct);

/* EXTI interrupt init*/
HAL_NVIC_SetPriority(EXTI9_5_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(EXTI9_5_IRQn);

/* USER CODE BEGIN MX_GPIO_Init_2 */

/* USER CODE END MX_GPIO_Init_2 */
Expand Down
14 changes: 14 additions & 0 deletions firmware/hexray/PCM/src/cubemx/Src/stm32f4xx_it.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,20 @@ void SysTick_Handler(void)
/* please refer to the startup file (startup_stm32f4xx.s). */
/******************************************************************************/

/**
* @brief This function handles EXTI line[9:5] interrupts.
*/
void EXTI9_5_IRQHandler(void)
{
/* USER CODE BEGIN EXTI9_5_IRQn 0 */

/* USER CODE END EXTI9_5_IRQn 0 */
HAL_GPIO_EXTI_IRQHandler(PCM_EN_Pin);
/* USER CODE BEGIN EXTI9_5_IRQn 1 */

/* USER CODE END EXTI9_5_IRQn 1 */
}

/**
* @brief This function handles I2C1 event interrupt.
*/
Expand Down
17 changes: 13 additions & 4 deletions firmware/hexray/PCM/src/tasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,21 @@ static const hw::gpio pcm_en_in{ PCM_EN_GPIO_Port, PCM_EN_Pin };
static const hw::gpio lv_buck_en_out{ LV_BUCK_EN_GPIO_Port, LV_BUCK_EN_Pin };
static const hw::gpio led_out{ LED_GPIO_Port, LED_Pin };

static auto state = PcmState::OFF;
static auto state = PcmState::OFF;
static volatile bool pcm_en_state = false;

#ifdef PCM_DEBUG
static char debug_buf[1024];
#endif

void HAL_GPIO_EXTI_Callback(const uint16_t GPIO_Pin)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious, why does this need to be an interrupt instead of the polling we had?

{
if (GPIO_Pin == pcm_en_in.getPin())
{
pcm_en_state = pcm_en_in.readPin();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗿

}
}

[[noreturn]] static void tasks_tick(void *arg)
{
forever
Expand Down Expand Up @@ -143,7 +152,7 @@ static char debug_buf[1024];
{
case PcmState::OFF:
{
if (pcm_en_in.readPin())
if (pcm_en_state)
{
LOG_INFO("trying to clear faults and turn on");
if (vicor::clearFaults().has_value() and vicor::operation(true).has_value())
Expand All @@ -161,7 +170,7 @@ static char debug_buf[1024];
}
case PcmState::VICOR_ONLY:
{
if (not pcm_en_in.readPin() and vicor::operation(false).has_value())
if (not pcm_en_state and vicor::operation(false).has_value())
{
LOG_INFO("Going to OFF state");
state = PcmState::OFF;
Expand All @@ -181,7 +190,7 @@ static char debug_buf[1024];
}
case PcmState::ON: // everything on
{
if (not pcm_en_in.readPin())
if (not pcm_en_state)
{
lv_buck_en_out.writePin(false);

Expand Down
Loading