Skip to content

Commit 2c551d2

Browse files
committed
PCU + Sensor Node fixes
1 parent eaa0ae0 commit 2c551d2

26 files changed

Lines changed: 819 additions & 77 deletions

File tree

.cubemx-manifest.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"boards": {
55
"BMS": {
66
"ioc_checksum": "08670b75875f2feedea3280eecc4821f36b742ccf7680976ae6f87bc3937ebfc",
7-
"generated_at": "2026-04-28T02:39:59Z",
7+
"generated_at": "2026-05-03T23:38:05Z",
88
"files": {
99
"Core/Inc/FreeRTOSConfig.h": "363755b7a21dd5a790f0bafbfd68f00abe141fd8691720b3604bc84b7dbaa81b",
1010
"Core/Inc/adc.h": "0ac97025a4065f07b7b65a906bd0c45ea800215434ed43c287c1685507f3f612",
@@ -75,7 +75,7 @@
7575
},
7676
"DASH": {
7777
"ioc_checksum": "6a1107c7b14166a666108bc4a87f26c99e19d25fb6f62b9fbcdd016db4457371",
78-
"generated_at": "2026-04-28T02:40:00Z",
78+
"generated_at": "2026-05-03T23:38:07Z",
7979
"files": {
8080
"Core/Inc/FreeRTOSConfig.h": "692168cbc9c915133ce3f329cec850c5372c1759ec0412ced61fc14741de14be",
8181
"Core/Inc/can.h": "d9c82c8382c196a76d472a6b82a292a0384a086536ca280ce701ebbba9f5c682",
@@ -177,7 +177,7 @@
177177
},
178178
"DART": {
179179
"ioc_checksum": "5e40a62867a13bf2ccbc21a8343b896b2979b658d024cb6721e46e05b32b5a45",
180-
"generated_at": "2026-04-28T02:40:01Z",
180+
"generated_at": "2026-05-03T23:38:08Z",
181181
"files": {
182182
"Core/Inc/can.h": "8bb6621564cd436d9b9697bc86bc4c6f6ae0492b84673344dfa5a3a2d0ee06cb",
183183
"Core/Inc/dma.h": "7cf6f7450a29d26303cbba5a3ca8c6cb24a02635d6a5ba4d05141fdfc75c4c49",
@@ -203,7 +203,7 @@
203203
},
204204
"DCU": {
205205
"ioc_checksum": "75f4a1174af99a72596dd7f739c38e22b0459b215bc0ddb3e22a6cfd49a8e736",
206-
"generated_at": "2026-04-28T02:40:01Z",
206+
"generated_at": "2026-05-03T23:38:08Z",
207207
"files": {
208208
"Core/Inc/gpio.h": "e2d62f964a0b7f238384ed6a20a181d09df9647240a268dc547acf5b35099f74",
209209
"Core/Inc/main.h": "e07a43ebc634ce451e2f80884378d112e048e06235fb49fdc2d9a2b5057d28c5",
@@ -223,7 +223,7 @@
223223
},
224224
"LVPDB": {
225225
"ioc_checksum": "35fab767f9e0e1027a136ca482edf00568850e7bd941f793ae156215fec1ca33",
226-
"generated_at": "2026-04-28T02:40:02Z",
226+
"generated_at": "2026-05-03T23:38:08Z",
227227
"files": {
228228
"Core/Inc/can.h": "17611aeff90b90e352bc2ace2749644663492ecb10c71539567ef9b1441fd5d9",
229229
"Core/Inc/dma.h": "7cf6f7450a29d26303cbba5a3ca8c6cb24a02635d6a5ba4d05141fdfc75c4c49",
@@ -251,7 +251,7 @@
251251
},
252252
"PCU": {
253253
"ioc_checksum": "dce88e9916056d652c3fdf3d09dd8a7ad066bc7c7b6af576218e9be7277811b8",
254-
"generated_at": "2026-04-28T02:40:02Z",
254+
"generated_at": "2026-05-03T23:38:09Z",
255255
"files": {
256256
"Core/Inc/adc.h": "e36acfe1b822eff1de7e9f93073b8da32c94dd5b09484b716e190c6aa63eb3d0",
257257
"Core/Inc/can.h": "98925d7f4010f054e17d240116244377377c15248a5413a09ff811cdc23084e5",
@@ -280,8 +280,8 @@
280280
}
281281
},
282282
"Sensor_Nodes": {
283-
"ioc_checksum": "2aa197f3fd419c6ece9ea9fc99ccd8fa3acc197e02f96dfc6386dda5b6f1fc3e",
284-
"generated_at": "2026-05-03T19:03:35Z",
283+
"ioc_checksum": "be12ff3a8379f17c1b0a08bbdaf4953fb8f1c19bc8888a1df18d8395bb5a58f1",
284+
"generated_at": "2026-05-03T23:38:09Z",
285285
"files": {
286286
"Core/Inc/adc.h": "0ac97025a4065f07b7b65a906bd0c45ea800215434ed43c287c1685507f3f612",
287287
"Core/Inc/can.h": "98925d7f4010f054e17d240116244377377c15248a5413a09ff811cdc23084e5",
@@ -297,7 +297,7 @@
297297
"Core/Src/can.c": "394f8a4a99d9c65784aa27c3745eca549717dfba4749d379acdfd212a5e80ca5",
298298
"Core/Src/dma.c": "34e9a60453cff20a0e179e43e2464abb3aa205dd8faf7acd7581ca0086f3a673",
299299
"Core/Src/gpio.c": "12d70d25d5a8026905bcf10ea026c982e785528fe85bd1861d2095dbae583e0e",
300-
"Core/Src/i2c.c": "ad7c6a964844941003cc19eac436fd531c82106f18ef2e2e24afddd6363c3425",
300+
"Core/Src/i2c.c": "0f52452004f5449129f1065f0d51ea4b2b4a69837c098a8bb6190372e5a113e1",
301301
"Core/Src/main.c": "63b74204d8837f4da7fc73912967c5134ab6abfcbbea1bd7d0665a4837a60830",
302302
"Core/Src/stm32f4xx_hal_msp.c": "3217d99dc7006dc46ac384717641fe84386f05fc71db0a3340fa0eae810bc1b7",
303303
"Core/Src/stm32f4xx_it.c": "ceaa18875b9504a3e34d1821555549042e62d7c1b4c4fe6fcd4d54662a34bb59",
@@ -311,7 +311,7 @@
311311
},
312312
"UART": {
313313
"ioc_checksum": "9ff281c674a516d9870dbee5d60587351e97884ecd27127e2d1464987bf16a17",
314-
"generated_at": "2026-04-28T02:40:04Z",
314+
"generated_at": "2026-05-03T23:38:10Z",
315315
"files": {
316316
"Core/Inc/FreeRTOSConfig.h": "2a0e6022391d5ec198a77021ec3bf284583e245f9ce20c420fb7608f638330d6",
317317
"Core/Inc/dma.h": "7cf6f7450a29d26303cbba5a3ca8c6cb24a02635d6a5ba4d05141fdfc75c4c49",
@@ -371,7 +371,7 @@
371371
},
372372
"UART_TEST": {
373373
"ioc_checksum": "06c9618835096e44e3f73cd158bbc2e3fcf76e65dc9a29db68fe607180843efd",
374-
"generated_at": "2026-04-28T02:40:05Z",
374+
"generated_at": "2026-05-03T23:38:12Z",
375375
"files": {
376376
"Core/Inc/FreeRTOSConfig.h": "773dad076864ff18d5d85603d348d4931d29dde9925486e58f95a97ac98b8404",
377377
"Core/Inc/app_freertos.h": "6229601c2ebf192d40ceef377f3c1785571eaf6407f10bc87be5b06357dd3515",

BMS/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.1
1+
1.4.2

DART/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.1
1+
1.4.2

DASH/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.1
1+
1.4.2

DCU/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.1
1+
1.4.2

LVPDB/Core/User/Src/FEB_Main.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,20 @@ void FEB_Main_Setup(void)
280280
}
281281
printf("Done! \r\n\r\n");
282282

283+
/* The 127-address I2C scan above leaves hi2c1.ErrorCode = AF and may leave
284+
* the BUSY flag stuck on STM32F4. Drain stale state before the first real
285+
* transaction so HAL_I2C_Mem_Write doesn't trip on residual error state. */
286+
LOG_I(TAG_MAIN, "Pre-reset I2C: State=0x%02X ErrorCode=0x%08lX SCL=%d SDA=%d", (unsigned)hi2c1.State,
287+
(unsigned long)hi2c1.ErrorCode, (int)HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_8),
288+
(int)HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_9));
289+
__HAL_I2C_CLEAR_FLAG(&hi2c1, I2C_FLAG_AF);
290+
HAL_Delay(10);
291+
HAL_I2C_DeInit(&hi2c1);
292+
HAL_I2C_Init(&hi2c1);
293+
LOG_I(TAG_MAIN, "Post-reset I2C: State=0x%02X ErrorCode=0x%08lX SCL=%d SDA=%d", (unsigned)hi2c1.State,
294+
(unsigned long)hi2c1.ErrorCode, (int)HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_8),
295+
(int)HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_9));
296+
283297
// Initialize TPS devices using the new library
284298
int maxiter = 0;
285299
tps_init_success = false;

LVPDB/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.1
1+
1.4.2

PCU/Core/User/Inc/FEB_PINOUT.h

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,14 @@ extern "C"
135135
* drive state. */
136136

137137
/* Accelerator Pedal Default Calibration (APPS) */
138-
/* Calibrated values based on actual measurements with safety margin */
139-
#define APPS1_DEFAULT_MIN_VOLTAGE_MV 2500 /* Calibrated min for APPS1 (0% position) - measured: 2500 mV */
140-
#define APPS1_DEFAULT_MAX_VOLTAGE_MV 2920 /* Calibrated max for APPS1 (100% position) - measured: 2900 mV */
141-
#define APPS2_DEFAULT_MIN_VOLTAGE_MV 1240 /* Calibrated min for APPS2 (0% position) - measured: 1240 mV */
142-
#define APPS2_DEFAULT_MAX_VOLTAGE_MV 1680 /* Calibrated max for APPS2 (100% position) - measured: 1670 mV */
138+
/* Vendor-datasheet nominal values. Asymmetric slopes (APPS1: 0.5–3.057 V,
139+
* APPS2: 0.5–0.922 V) are intentional for FSAE EV.5.3 transfer-function
140+
* diversity. Each car must run PCU|apps|cal|capture per-install to lock in
141+
* the actual values for that pedal assembly. */
142+
#define APPS1_DEFAULT_MIN_VOLTAGE_MV 500 /* APPS1 at 0% — vendor nominal, recapture per-car */
143+
#define APPS1_DEFAULT_MAX_VOLTAGE_MV 3057 /* APPS1 at 100% — vendor nominal, recapture per-car */
144+
#define APPS2_DEFAULT_MIN_VOLTAGE_MV 500 /* APPS2 at 0% — vendor nominal, recapture per-car */
145+
#define APPS2_DEFAULT_MAX_VOLTAGE_MV 922 /* APPS2 at 100% — vendor nominal, recapture per-car */
143146
#define APPS_MIN_PHYSICAL_PERCENT 0.0f /* Physical minimum: 0% throttle */
144147
#define APPS_MAX_PHYSICAL_PERCENT 100.0f /* Physical maximum: 100% throttle */
145148
#define APPS_DEADZONE_PERCENT 5 /* Deadzone at pedal extremes (%) */
@@ -174,8 +177,12 @@ extern "C"
174177
/* FSAE Rules Compliance */
175178
#define APPS_IMPLAUSIBILITY_TIME_MS 100 /* Time before APPS implausibility fault */
176179
#define BRAKE_PLAUSIBILITY_TIME_MS 100 /* Time before brake plausibility fault */
177-
#define APPS_SHORT_CIRCUIT_DETECT_MV 100 /* Voltage below this indicates short */
178-
#define APPS_OPEN_CIRCUIT_DETECT_MV 4900 /* Voltage above this indicates open */
180+
#define APPS_SHORT_CIRCUIT_DETECT_MV 100 /* Voltage below this indicates short (both sensors) */
181+
/* Per-sensor open-circuit thresholds: each must sit above the sensor's valid
182+
* max (3057 mV for APPS1, 922 mV for APPS2) and below the post-divider ADC
183+
* ceiling (~3854 mV for APPS1, ~3300 mV for APPS2 with no divider). */
184+
#define APPS1_OPEN_CIRCUIT_DETECT_MV 3500 /* APPS1 above this indicates open */
185+
#define APPS2_OPEN_CIRCUIT_DETECT_MV 1500 /* APPS2 above this indicates open */
179186

180187
/* Brake Over Travel Protection (BOTS) */
181188
#define BOTS_ACTIVATION_PERCENT 25 /* Brake travel % that triggers BOTS */

PCU/Core/User/Src/FEB_ADC.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ void FEB_ADC_TickAPPS(void)
591591

592592
/* Sensor circuit faults — voltage is post-divider, in mV. */
593593
bool short_circuit = (voltage1 < APPS_SHORT_CIRCUIT_DETECT_MV) || (voltage2 < APPS_SHORT_CIRCUIT_DETECT_MV);
594-
bool open_circuit = (voltage1 > APPS_OPEN_CIRCUIT_DETECT_MV) || (voltage2 > APPS_OPEN_CIRCUIT_DETECT_MV);
594+
bool open_circuit = (voltage1 > APPS1_OPEN_CIRCUIT_DETECT_MV) || (voltage2 > APPS2_OPEN_CIRCUIT_DETECT_MV);
595595
apps_cache.short_circuit = short_circuit;
596596
apps_cache.open_circuit = open_circuit;
597597

PCU/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.1
1+
1.4.2

0 commit comments

Comments
 (0)