forked from commaai/panda
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add escc flag to the scons build args
Add initial README for ESCC board This commit introduces a new README for the ESCC board detailing the pinout configurations and connections between the Molex connector and IONIQ harness and radar components. The documentation provides a clear, structured guide to assist with proper wiring and setup. Improving comments for clarity and explicitness IDE is behaving now. Wd don't need this hack anymore Add ESCC build option and refine ESCC specific code Introduce --escc option in SCons to conditionally build ESCC firmware. Update build_project to support CPPDEFINES and modify main.c to handle ESCC-specific safety modes and behaviors more cleanly. Remove unnecessary send_escc_msg calls in Hyundai safety code The updates in the code remove redundant send_escc_msg calls in the Hyundai safety code. We don't really need to send the FCA or AEB data through the ESCC packet because we don't block it at all. So we don't really need to "package" it anymore on the ESCC message Add send_escc_msg call in case blocks The send_escc_msg function is now called within the individual case blocks for SCC11, SCC12, and FCA11, enhancing code readability. Before, it was called on any message that the radar sends, but this strategy was inefficient as it was piggybacking on their frequencies. Refactor `escc_tx_hook` function in Hyundai safety code The commented-out `escc_tx_hook` function in Hyundai ESCC safety code has been refactored and is now in use again, replacing the formerly used `alloutput_tx_hook`. Debugging functionality has been preserved and conditions for when the function is unused have also been handled. The resulting code is now cleaner and more efficient. Add ESCC firmware and build files, and safety mode for Hyundai ESCC This commit introduces ESCC firmware and the corresponding build files. We have also defined a new safety mode for Hyundai ESCC. The necessary scripts for flashing and recovery have been added, alongside the gitignore file for the ESCC board. Additionally, we have implemented new message processing and forwarding logic to handle ESCC specific messages in main and safety files.
- Loading branch information
Showing
14 changed files
with
481 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
obj/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
## Documentation | ||
[see more](https://github.com/sunnypilot/sunnypilot/blob/5d754169a6285e88e755ff9a592a851cb92b0abc/docs/escc/ESCC%20IONIQ%20PHEV%20Guide.md) | ||
|
||
### Detailed Connection List | ||
|
||
#### Molex 5018762640 Pinout: | ||
|
||
- Pin 1: GND | ||
- Pin 2: IGN | ||
- Pin 3: internal 120 Ohm Resistor, simply bridge to Pin 5 | ||
- Pin 4: C-CAN HIGH | ||
- Pin 5: internal 120 Ohm Resistor, simply bridge to Pin 3 | ||
- Pin 6: C-CAN LOW | ||
- Pin 8: L-CAN HIGH | ||
- Pin 10: L-CAN LOW | ||
- Pin 12: 12v | ||
- Pin 14: 12v | ||
- Pin 16: IGN | ||
- Pin 18: L-CAN HIGH | ||
- Pin 20: L-CAN LOW | ||
- Pin 22: C-CAN HIGH | ||
- Pin 24: C-CAN LOW | ||
- Pin 26: GND | ||
|
||
#### **IONIQ 2203663 (Car Harness, Female):** | ||
|
||
- Pin 1: 12v -> Molex Pin 12 | ||
- Pin 4: GND -> Molex Pin 1 | ||
- Pin 7: C-CAN LOW -> Molex Pin 6 | ||
- Pin 8: C-CAN HIGH -> Molex Pin 4 | ||
- Pin 9: L-CAN LOW -> Molex Pin 10 | ||
- Pin 10: IGPM (IGN) -> Molex Pin 2 | ||
- Pin 18: L-CAN HIGH -> Molex Pin 8 | ||
|
||
#### **IONIQ 2203663 (Car Radar, Male):** | ||
|
||
- Molex Pin: 14 -> Pin 1: 12v | ||
- Molex Pin: 26 -> Pin 4: GND | ||
- Molex Pin: 24 -> Pin 7: C-CAN LOW | ||
- Molex Pin: 22 -> Pin 8: C-CAN HIGH | ||
- Molex Pin: 20 -> Pin 9: L-CAN LOW | ||
- Molex Pin: 16 -> Pin 10: IGN | ||
- Molex Pin: 18 -> Pin 18: L-CAN HIGH | ||
|
||
|
||
``` | ||
IONIQ 2203663 Molex 5018762640 IONIQ 2203663 | ||
Car Harness (Female) Car Radar (Male) | ||
+-----+-----+ +-----+-----+ +-----+-----+ | ||
| 18 | 9 | | 2 | 1 | | 10 | 1 | | ||
| 17 | 8 | | 4 | 3 | | 11 | 2 | | ||
| 16 | 7 | | 6 | 5 | | 12 | 3 | | ||
| 15 | 6 | | 8 | 7 | | 13 | 4 | | ||
| 14 | 5 | NOTCH | 10 | 9 | | 14 | 5 | NOTCH | ||
| 13 | 4 | | 12 | 11 | | 15 | 6 | | ||
| 12 | 3 | | 14 | 13 | NOTCH | 16 | 7 | | ||
| 11 | 2 | | 16 | 15 | | 17 | 8 | | ||
| 10 | 1 | | 18 | 17 | | 18 | 9 | | ||
+-----+-----+ | 20 | 19 | +-----+-----+ | ||
| 22 | 21 | | ||
| 24 | 23 | | ||
| 26 | 25 | | ||
+-----+-----+ | ||
Connections: | ||
Molex Pin 3 (120 Ohm) <--> Molex Pin 5 (120 Ohm) | ||
Harness Pin 1 (12V) <--> Molex Pin 12 (12V) | ||
Harness Pin 4 (GND) <--> Molex Pin 1 (GND) | ||
Harness Pin 10 (IGN) <--> Molex Pin 2 (IGN) | ||
Harness Pin 8 (C-CAN H) <--> Molex Pin 4 (C-CAN H) | ||
Harness Pin 7 (C-CAN L) <--> Molex Pin 6 (C-CAN L) | ||
Harness Pin 18 (L-CAN H) <--> Molex Pin 8 (L-CAN H) | ||
Harness Pin 9 (L-CAN L) <--> Molex Pin 10 (L-CAN L) | ||
Molex Pin 20 (L-CAN L) <--> Radar Pin 9 (L-CAN L) | ||
Molex Pin 18 (L-CAN H) <--> Radar Pin 18 (L-CAN H) | ||
Molex Pin 24 (C-CAN L) <--> Radar Pin 7 (C-CAN L) | ||
Molex Pin 22 (C-CAN H) <--> Radar Pin 8 (C-CAN H) | ||
Molex Pin 16 (IGN) <--> Radar Pin 10 (IGN) | ||
Molex Pin 14 (12V) <--> Radar Pin 1 (12V) | ||
Molex Pin 26 (GND) <--> Radar Pin 4 (GND) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import os | ||
import copy | ||
|
||
Import('build_project') | ||
|
||
build_projects = {} | ||
|
||
build_projects["escc"] = { | ||
"MAIN": "../main.c", | ||
"BOOTSTUB": "../bootstub.c", | ||
"STARTUP_FILE": File("../stm32f4/startup_stm32f413xx.s"), | ||
"LINKER_SCRIPT": File("../stm32f4/stm32f4_flash.ld"), | ||
"APP_START_ADDRESS": "0x8004000", | ||
"PROJECT_FLAGS": [ | ||
"-mcpu=cortex-m4", | ||
"-mhard-float", | ||
"-DSTM32F4", | ||
"-DSTM32F413xx", | ||
"-mfpu=fpv4-sp-d16", | ||
"-fsingle-precision-constant", | ||
"-Os", | ||
"-g", | ||
], | ||
} | ||
|
||
for project_name, project in build_projects.items(): | ||
flags = [ | ||
"-DPANDA", | ||
"-DESCC", | ||
] | ||
if ("ENABLE_SPI" in os.environ or "h7" in project_name) and not project_name.startswith('pedal'): | ||
flags.append('-DENABLE_SPI') | ||
|
||
build_project(project_name, project, flags, ["ESCC"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env python3 | ||
import os | ||
import subprocess | ||
|
||
from panda import Panda | ||
|
||
board_path = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
if __name__ == "__main__": | ||
print(board_path) | ||
subprocess.check_call(f"scons -C {board_path}/../.. -j$(nproc) {board_path} --escc", shell=True) | ||
|
||
serials = Panda.list() | ||
print(f"found {len(serials)} panda(s) - {serials}") | ||
for s in serials: | ||
print("flashing", s) | ||
with Panda(serial=s) as p: | ||
p.flash("obj/escc.bin.signed") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env sh | ||
set -e | ||
|
||
cd .. | ||
scons -u -j$(nproc) --escc | ||
cd escc | ||
|
||
../../tests/escc/enter_canloader.py obj/escc.bin.signed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env sh | ||
set -e | ||
|
||
DFU_UTIL="dfu-util" | ||
|
||
cd .. | ||
scons -u -j$(nproc) --escc | ||
cd escc | ||
|
||
$DFU_UTIL -d 0483:df11 -a 0 -s 0x08004000 -D obj/escc.bin.signed | ||
$DFU_UTIL -d 0483:df11 -a 0 -s 0x08000000:leave -D obj/bootstub.escc.bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.