forked from commaai/panda
-
Notifications
You must be signed in to change notification settings - Fork 62
hkg: Add ESCC (Enhanced Smart Cruise Control) support #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
devtekve
wants to merge
3
commits into
master
Choose a base branch
from
master-new-escc-reworked
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.