From 1bc02e7f02698936536af741409e2d0b8886ac58 Mon Sep 17 00:00:00 2001 From: Oskar Date: Wed, 24 May 2023 12:54:30 +0200 Subject: [PATCH] Add bodged PCB version with adapted code - No SDC latching - No TSOn needed to close SDC --- sdcl-firmware/Core/Src/main.c | 19 ++++++++++++------- sdcl-hardware/npl.kicad_sch | 25 ++++++++++++++----------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/sdcl-firmware/Core/Src/main.c b/sdcl-firmware/Core/Src/main.c index ecd257a..9296b1a 100644 --- a/sdcl-firmware/Core/Src/main.c +++ b/sdcl-firmware/Core/Src/main.c @@ -208,6 +208,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(); @@ -253,14 +255,17 @@ int main(void) mission_t new_mission = mission; // By default, don't change mission // Wait 1s to prevent bus error state while ABX is starting up + // Wait 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(); @@ -499,7 +504,7 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan) { 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); + HAL_GPIO_WritePin(AS_close_SDC_GPIO_Port, AS_close_SDC_Pin, !rxData.signals.as_close_sdc); #ifdef WATCHDOG_STM diff --git a/sdcl-hardware/npl.kicad_sch b/sdcl-hardware/npl.kicad_sch index f6e49d0..89b311f 100644 --- a/sdcl-hardware/npl.kicad_sch +++ b/sdcl-hardware/npl.kicad_sch @@ -1375,9 +1375,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 +1417,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) ) @@ -1438,6 +1438,9 @@ (junction (at 76.2 46.99) (diameter 0) (color 0 0 0 0) (uuid d3d4329e-fd16-40b2-9537-230d42c119d0) ) + (junction (at 138.43 55.88) (diameter 0) (color 0 0 0 0) + (uuid df1234f8-8a4d-4bd7-a294-a3728a7fcdcf) + ) (junction (at 87.63 40.64) (diameter 0) (color 0 0 0 0) (uuid eb432c68-9e96-480c-b1e5-cac6fcf77253) ) @@ -1471,10 +1474,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 +1574,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) @@ -1691,6 +1694,10 @@ (stroke (width 0) (type default)) (uuid c1ee9d6e-edb3-4215-8476-f4f4f983ade2) ) + (wire (pts (xy 138.43 50.8) (xy 138.43 55.88)) + (stroke (width 0) (type default)) + (uuid c307bb0d-1b96-475c-a18e-7ca587785626) + ) (wire (pts (xy 87.63 113.03) (xy 105.41 113.03)) (stroke (width 0) (type default)) (uuid c7c6cef9-f855-45e0-9399-3c51d2568867) @@ -1844,10 +1851,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)