Compare commits
5 Commits
main
...
SDCLv2-bod
Author | SHA1 | Date | |
---|---|---|---|
18d02abf9d | |||
3fedb7117b | |||
f9256860e8 | |||
460578e359 | |||
1bc02e7f02 |
@ -141,6 +141,8 @@ const mission_t mission2next[] = {M_MANUAL , M_SKIDPAD , M_AUTOX , M_EBSTEST
|
||||
|
||||
mission_t mission = M_NONE;
|
||||
|
||||
bool setup_done = false;
|
||||
|
||||
#ifdef WATCHDOG_STM
|
||||
bool pHeartbeat = false;
|
||||
bool WD_OK = false;
|
||||
@ -208,6 +210,8 @@ int main(void)
|
||||
|
||||
// Ensure we start with SDC disabled
|
||||
HAL_GPIO_WritePin(Watchdog_GPIO_Port, Watchdog_Pin, GPIO_PIN_RESET);
|
||||
// Due to bodge, AScSDC is inverted, so it is set by default
|
||||
HAL_GPIO_WritePin(AS_close_SDC_GPIO_Port, AS_close_SDC_Pin, GPIO_PIN_SET);
|
||||
|
||||
if (HAL_CAN_Start(&hcan) != HAL_OK)
|
||||
Error_Handler();
|
||||
@ -250,24 +254,28 @@ int main(void)
|
||||
/* USER CODE BEGIN WHILE */
|
||||
|
||||
bool pAMC = false;
|
||||
bool pASMS = false;
|
||||
mission_t new_mission = mission; // By default, don't change mission
|
||||
|
||||
// Wait 1s to prevent bus error state while ABX is starting up
|
||||
// Wait at least 1s to prevent bus error state while ABX is starting up
|
||||
// Wait at least 5s for the discharge of the DC link (so AMS can't restart)
|
||||
// During that time, show loading animation to show LEDs work
|
||||
setMissionLED(M_MANUAL, GPIO_PIN_SET);
|
||||
HAL_Delay(150);
|
||||
setMissionLED(M_MANUAL, GPIO_PIN_RESET);
|
||||
for (mission_t m = M_ACCEL; m != M_MANUAL; m = mission2next[m]) {
|
||||
setMissionLED(m, GPIO_PIN_SET);
|
||||
while (HAL_GetTick() < 5000) {
|
||||
setMissionLED(M_MANUAL, GPIO_PIN_SET);
|
||||
HAL_Delay(150);
|
||||
setMissionLED(m, GPIO_PIN_RESET);
|
||||
setMissionLED(M_MANUAL, GPIO_PIN_RESET);
|
||||
for (mission_t m = M_ACCEL; m != M_MANUAL; m = mission2next[m]) {
|
||||
setMissionLED(m, GPIO_PIN_SET);
|
||||
HAL_Delay(150);
|
||||
setMissionLED(m, GPIO_PIN_RESET);
|
||||
}
|
||||
}
|
||||
|
||||
MX_IWDG_Init();
|
||||
WD_initialized = true;
|
||||
setup_done = true;
|
||||
|
||||
while (true) {
|
||||
|
||||
// Compare with RESET for signals obtained via inverting buffer
|
||||
bool TS_activate_MUXed = HAL_GPIO_ReadPin(TS_activate_MUXed_GPIO_Port, TS_activate_MUXed_Pin) == GPIO_PIN_RESET;
|
||||
bool ASMS = HAL_GPIO_ReadPin(ASMS_GPIO_Port, ASMS_Pin) == GPIO_PIN_RESET;
|
||||
#ifdef WATCHDOG_UCC
|
||||
@ -294,6 +302,12 @@ int main(void)
|
||||
|
||||
}
|
||||
|
||||
// TEMP: Only enable WD if in autonomous mode because EMI currently messes it up during R2D
|
||||
if (ASMS > pASMS) {
|
||||
MX_IWDG_Init();
|
||||
WD_initialized = true;
|
||||
}
|
||||
|
||||
txData = (tx_data_t) {
|
||||
.signals = {
|
||||
.asms_state = ASMS,
|
||||
@ -315,6 +329,7 @@ int main(void)
|
||||
|
||||
// Store previous button value to detect signal edges
|
||||
pAMC = AMC;
|
||||
pASMS = ASMS;
|
||||
|
||||
HAL_Delay(TX_UPDATE_PERIOD);
|
||||
|
||||
@ -498,9 +513,6 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan) {
|
||||
if (rxHeader.StdId != CAN_ID_RX)
|
||||
return;
|
||||
|
||||
HAL_GPIO_WritePin(ASB_Error_GPIO_Port, ASB_Error_Pin, rxData.signals.asb_error);
|
||||
HAL_GPIO_WritePin(AS_close_SDC_GPIO_Port, AS_close_SDC_Pin, rxData.signals.as_close_sdc);
|
||||
|
||||
#ifdef WATCHDOG_STM
|
||||
|
||||
if (rxData.signals.heartbeat != pHeartbeat) {
|
||||
@ -511,17 +523,28 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan) {
|
||||
}
|
||||
pHeartbeat = rxData.signals.heartbeat;
|
||||
|
||||
bool close_sdc = setup_done && rxData.signals.as_close_sdc;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef WATCHDOG_UCC
|
||||
HAL_GPIO_WritePin(Watchdog_GPIO_Port, Watchdog_Pin, rxData.signals.heartbeat);
|
||||
|
||||
bool close_sdc = rxData.signals.as_close_sdc;
|
||||
#endif
|
||||
|
||||
// Set whether to close the relay
|
||||
// Inverted because the NAND was bodged out
|
||||
HAL_GPIO_WritePin(AS_close_SDC_GPIO_Port, AS_close_SDC_Pin, !close_sdc);
|
||||
|
||||
// Reset old mission LED
|
||||
setMissionLED(mission, GPIO_PIN_RESET);
|
||||
mission = rxData.signals.as_mission;
|
||||
setMissionLED(mission, GPIO_PIN_SET);
|
||||
|
||||
// Set ASB Error status
|
||||
HAL_GPIO_WritePin(ASB_Error_GPIO_Port, ASB_Error_Pin, rxData.signals.asb_error);
|
||||
|
||||
}
|
||||
|
||||
/* USER CODE END 4 */
|
||||
|
@ -38,7 +38,7 @@
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_txt_serial_number" value=""/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.watchdog_config" value="none"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkenable_rtos" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkrestart_configurations" value="{"fItems":[{"fDisplayName":"Reset","fIsSuppressible":false,"fResetAttribute":"Software system reset","fResetStrategies":[{"fDisplayName":"Software system reset","fLaunchAttribute":"system_reset","fGdbCommands":["monitor reset\n"],"fCmdOptions":["-g"]},{"fDisplayName":"Hardware reset","fLaunchAttribute":"hardware_reset","fGdbCommands":["monitor reset hardware\n"],"fCmdOptions":["-g"]},{"fDisplayName":"Core reset","fLaunchAttribute":"core_reset","fGdbCommands":["monitor reset core\n"],"fCmdOptions":["-g"]},{"fDisplayName":"None","fLaunchAttribute":"no_reset","fGdbCommands":[],"fCmdOptions":["-g"]}],"fGdbCommandGroup":{"name":"Additional commands","commands":[]}}]}"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkrestart_configurations" value="{"fVersion":1,"fItems":[{"fDisplayName":"Reset","fIsSuppressible":false,"fResetAttribute":"Software system reset","fResetStrategies":[{"fDisplayName":"Software system reset","fLaunchAttribute":"system_reset","fGdbCommands":["monitor reset\n"],"fCmdOptions":["-g"]},{"fDisplayName":"Hardware reset","fLaunchAttribute":"hardware_reset","fGdbCommands":["monitor reset hardware\n"],"fCmdOptions":["-g"]},{"fDisplayName":"Core reset","fLaunchAttribute":"core_reset","fGdbCommands":["monitor reset core\n"],"fCmdOptions":["-g"]},{"fDisplayName":"None","fLaunchAttribute":"no_reset","fGdbCommands":[],"fCmdOptions":["-g"]}],"fGdbCommandGroup":{"name":"Additional commands","commands":[]},"fStartApplication":true}]}"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.enableRtosProxy" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyCustomProperties" value=""/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyDriver" value="threadx"/>
|
||||
|
@ -12232,6 +12232,10 @@
|
||||
(stroke (width 0.1) (type solid)) (layer "F.Mask") (tstamp d5cd8f5d-dcad-49f4-9bec-bdd5034814d2))
|
||||
(gr_line (start 155.75 87.75) (end 155.75 83.5)
|
||||
(stroke (width 0.1) (type solid)) (layer "F.Mask") (tstamp d600852a-8332-4c22-b092-84351c799b6e))
|
||||
(gr_line (start 161.5 71) (end 162.8 73.7)
|
||||
(stroke (width 0.5) (type default)) (layer "Dwgs.User") (tstamp 2eb53f89-3aef-4e30-b632-ca118e66f702))
|
||||
(gr_line (start 135 76.3) (end 134.9 75.1)
|
||||
(stroke (width 0.5) (type default)) (layer "Dwgs.User") (tstamp 41109076-736a-43e6-83d2-869be0c8ee79))
|
||||
(gr_line (start 100 95) (end 100 55)
|
||||
(stroke (width 0.1) (type solid)) (layer "Edge.Cuts") (tstamp 00000000-0000-0000-0000-000061bdb244))
|
||||
(gr_arc (start 200 95) (mid 198.535534 98.535534) (end 195 100)
|
||||
|
@ -516,125 +516,6 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(symbol "Custom:MC74HC1G00" (pin_names (offset 1.016)) (in_bom yes) (on_board yes)
|
||||
(property "Reference" "U" (at 1.27 7.62 0)
|
||||
(effects (font (size 1.27 1.27)))
|
||||
)
|
||||
(property "Value" "MC74HC1G00" (at 7.62 5.08 0)
|
||||
(effects (font (size 1.27 1.27)))
|
||||
)
|
||||
(property "Footprint" "" (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Datasheet" "https://www.mouser.de/datasheet/2/308/1/MC74HC1G00_D-2315437.pdf" (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "ki_keywords" "nand" (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "ki_description" "Single 2-input NAND gate" (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "ki_fp_filters" "DIP*W7.62mm* SO14*" (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(symbol "MC74HC1G00_1_1"
|
||||
(arc (start 0 -3.81) (mid 3.7934 0) (end 0 3.81)
|
||||
(stroke (width 0.254) (type default))
|
||||
(fill (type background))
|
||||
)
|
||||
(polyline
|
||||
(pts
|
||||
(xy 0 3.81)
|
||||
(xy -3.81 3.81)
|
||||
(xy -3.81 -3.81)
|
||||
(xy 0 -3.81)
|
||||
)
|
||||
(stroke (width 0.254) (type default))
|
||||
(fill (type background))
|
||||
)
|
||||
(pin input line (at -7.62 2.54 0) (length 3.81)
|
||||
(name "~" (effects (font (size 1.27 1.27))))
|
||||
(number "1" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
(pin input line (at -7.62 -2.54 0) (length 3.81)
|
||||
(name "~" (effects (font (size 1.27 1.27))))
|
||||
(number "2" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
(pin power_in line (at -1.27 -6.35 90) (length 2.54)
|
||||
(name "GND" (effects (font (size 0.9906 0.9906))))
|
||||
(number "3" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
(pin output inverted (at 7.62 0 180) (length 3.81)
|
||||
(name "~" (effects (font (size 1.27 1.27))))
|
||||
(number "4" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
(pin power_in line (at 0 6.35 270) (length 2.54)
|
||||
(name "VCC" (effects (font (size 0.9906 0.9906))))
|
||||
(number "5" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
)
|
||||
(symbol "MC74HC1G00_1_2"
|
||||
(arc (start -3.81 -3.81) (mid -2.589 0) (end -3.81 3.81)
|
||||
(stroke (width 0.254) (type default))
|
||||
(fill (type none))
|
||||
)
|
||||
(arc (start -0.6096 -3.81) (mid 2.1842 -2.5851) (end 3.81 0)
|
||||
(stroke (width 0.254) (type default))
|
||||
(fill (type background))
|
||||
)
|
||||
(polyline
|
||||
(pts
|
||||
(xy -3.81 -3.81)
|
||||
(xy -0.635 -3.81)
|
||||
)
|
||||
(stroke (width 0.254) (type default))
|
||||
(fill (type background))
|
||||
)
|
||||
(polyline
|
||||
(pts
|
||||
(xy -3.81 3.81)
|
||||
(xy -0.635 3.81)
|
||||
)
|
||||
(stroke (width 0.254) (type default))
|
||||
(fill (type background))
|
||||
)
|
||||
(polyline
|
||||
(pts
|
||||
(xy -0.635 3.81)
|
||||
(xy -3.81 3.81)
|
||||
(xy -3.81 3.81)
|
||||
(xy -3.556 3.4036)
|
||||
(xy -3.0226 2.2606)
|
||||
(xy -2.6924 1.0414)
|
||||
(xy -2.6162 -0.254)
|
||||
(xy -2.7686 -1.4986)
|
||||
(xy -3.175 -2.7178)
|
||||
(xy -3.81 -3.81)
|
||||
(xy -3.81 -3.81)
|
||||
(xy -0.635 -3.81)
|
||||
)
|
||||
(stroke (width -25.4) (type default))
|
||||
(fill (type background))
|
||||
)
|
||||
(arc (start 3.81 0) (mid 2.1915 2.5936) (end -0.6096 3.81)
|
||||
(stroke (width 0.254) (type default))
|
||||
(fill (type background))
|
||||
)
|
||||
(pin input inverted (at -7.62 2.54 0) (length 4.318)
|
||||
(name "~" (effects (font (size 1.27 1.27))))
|
||||
(number "1" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
(pin input inverted (at -7.62 -2.54 0) (length 4.318)
|
||||
(name "~" (effects (font (size 1.27 1.27))))
|
||||
(number "2" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
(pin output line (at 7.62 0 180) (length 3.81)
|
||||
(name "~" (effects (font (size 1.27 1.27))))
|
||||
(number "3" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
)
|
||||
)
|
||||
(symbol "Custom:MC74HC1G32" (pin_names (offset 1.016)) (in_bom yes) (on_board yes)
|
||||
(property "Reference" "U6" (at 2.54 6.35 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left))
|
||||
@ -1375,9 +1256,6 @@
|
||||
(junction (at 224.79 93.98) (diameter 0) (color 0 0 0 0)
|
||||
(uuid 27373484-7b88-483b-87bb-dc98c4baecb2)
|
||||
)
|
||||
(junction (at 113.03 50.8) (diameter 0) (color 0 0 0 0)
|
||||
(uuid 2a400b18-f18f-4d5d-b4fa-4c92967a23f0)
|
||||
)
|
||||
(junction (at 87.63 86.995) (diameter 0) (color 0 0 0 0)
|
||||
(uuid 3a66ec48-c77d-4e4c-ab11-9f3ec8df845d)
|
||||
)
|
||||
@ -1420,6 +1298,9 @@
|
||||
(junction (at 147.955 181.61) (diameter 0) (color 0 0 0 0)
|
||||
(uuid 9536fd35-7a97-4e02-8768-a3519ffd7c9f)
|
||||
)
|
||||
(junction (at 144.78 132.715) (diameter 0) (color 0 0 0 0)
|
||||
(uuid 9e45864f-f6e9-434b-a6a6-aeceeaa32cbf)
|
||||
)
|
||||
(junction (at 58.42 92.075) (diameter 0) (color 0 0 0 0)
|
||||
(uuid a4012a8d-76e2-4192-b70f-a8d6ec2c3826)
|
||||
)
|
||||
@ -1451,6 +1332,10 @@
|
||||
(stroke (width 0) (type default))
|
||||
(uuid 0377af72-3f9a-49c8-a725-6fe5b209413a)
|
||||
)
|
||||
(wire (pts (xy 138.43 53.34) (xy 153.67 53.34))
|
||||
(stroke (width 0) (type default))
|
||||
(uuid 0a2f2a7d-7c0c-4922-9eeb-6cdb84068c68)
|
||||
)
|
||||
(wire (pts (xy 245.11 96.52) (xy 256.54 96.52))
|
||||
(stroke (width 0) (type default))
|
||||
(uuid 105d77fe-c5a5-4238-a46e-30111e876fe0)
|
||||
@ -1471,10 +1356,6 @@
|
||||
(stroke (width 0) (type default))
|
||||
(uuid 19e11f7f-d84d-46e7-a9a1-1cc9ce02617a)
|
||||
)
|
||||
(wire (pts (xy 113.03 50.8) (xy 138.43 50.8))
|
||||
(stroke (width 0) (type default))
|
||||
(uuid 1b76406f-deff-4733-b380-a3e992efb328)
|
||||
)
|
||||
(wire (pts (xy 127 55.88) (xy 129.54 55.88))
|
||||
(stroke (width 0) (type default))
|
||||
(uuid 1c18c3c3-eb51-4ec2-ad8d-10c9a9a776fe)
|
||||
@ -1575,6 +1456,10 @@
|
||||
(stroke (width 0) (type default))
|
||||
(uuid 849a3884-6222-465d-904a-7f90db89d3cd)
|
||||
)
|
||||
(wire (pts (xy 144.78 127.635) (xy 144.78 132.715))
|
||||
(stroke (width 0) (type default))
|
||||
(uuid 87b084f5-82a2-4c5e-b1e1-cc1b3b3f1fae)
|
||||
)
|
||||
(wire (pts (xy 63.5 113.03) (xy 69.85 113.03))
|
||||
(stroke (width 0) (type default))
|
||||
(uuid 891fae02-4f14-4d6f-9809-59b80f62ca63)
|
||||
@ -1695,6 +1580,10 @@
|
||||
(stroke (width 0) (type default))
|
||||
(uuid c7c6cef9-f855-45e0-9399-3c51d2568867)
|
||||
)
|
||||
(wire (pts (xy 138.43 53.34) (xy 138.43 55.88))
|
||||
(stroke (width 0) (type default))
|
||||
(uuid c9183c00-2b30-4577-8d38-f6d7aba7f8ed)
|
||||
)
|
||||
(wire (pts (xy 113.03 39.37) (xy 113.03 50.8))
|
||||
(stroke (width 0) (type default))
|
||||
(uuid ce2745ea-4de5-40af-be0d-1cda790fd766)
|
||||
@ -1844,10 +1733,6 @@
|
||||
)
|
||||
)
|
||||
|
||||
(hierarchical_label "SDC_in_3V3" (shape input) (at 144.78 127.635 180) (fields_autoplaced)
|
||||
(effects (font (size 1.27 1.27)) (justify right))
|
||||
(uuid 1e5effb6-4427-4d83-9020-853fc3da73e7)
|
||||
)
|
||||
(hierarchical_label "TS_activate_dash" (shape input) (at 63.5 52.07 180) (fields_autoplaced)
|
||||
(effects (font (size 1.27 1.27)) (justify right))
|
||||
(uuid 3e7f3004-2604-4829-b7ff-04a92fc9ac68)
|
||||
@ -2047,35 +1932,6 @@
|
||||
)
|
||||
)
|
||||
|
||||
(symbol (lib_id "Custom:MC74HC1G00") (at 146.05 53.34 0) (unit 1)
|
||||
(in_bom yes) (on_board yes) (dnp no)
|
||||
(uuid 00000000-0000-0000-0000-000061b3096f)
|
||||
(property "Reference" "U3" (at 149.86 55.88 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left))
|
||||
)
|
||||
(property "Value" "MC74HC1G00" (at 146.05 58.42 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left))
|
||||
)
|
||||
(property "Footprint" "Package_TO_SOT_SMD:SOT-23-5_HandSoldering" (at 146.05 53.34 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Datasheet" "http://www.ti.com/lit/gpn/sn74ls00" (at 146.05 53.34 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(pin "1" (uuid 99503064-8b7a-4591-8529-95bd02d748ff))
|
||||
(pin "2" (uuid dc5c2675-97e6-4fb0-9c24-d11a5605ce4c))
|
||||
(pin "3" (uuid 223840d9-59aa-41ab-b9b5-d2feca11776a))
|
||||
(pin "4" (uuid 646e6a0c-47e0-4c6c-bcec-8dc1e345d1cb))
|
||||
(pin "5" (uuid 913b9b0c-7d1b-46d7-9a4e-d1f0510cb90d))
|
||||
(instances
|
||||
(project "SDCL"
|
||||
(path "/bcec61a8-2c2c-45a3-8515-40c63927a0a2/00000000-0000-0000-0000-000061a897b7"
|
||||
(reference "U3") (unit 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(symbol (lib_id "power:GND") (at 144.78 59.69 0) (unit 1)
|
||||
(in_bom yes) (on_board yes) (dnp no)
|
||||
(uuid 00000000-0000-0000-0000-000061b319a2)
|
||||
|
Loading…
x
Reference in New Issue
Block a user