a648ccae Add os import 042562dd Extracted wifi connect from test helpers ac0fd5dd query fw versions example - use extended diagnostic session 4e9d788a Remove not-needed cadillac-init f0a5d154 typo c093286b Add bootkick after re-enabling phone power (#401) eadb0dbb security upgrades (#397) 7c13bec0 Command to get signature (#399) dad439a4 static assert on size of health packet (#398) da9da466 Fix VERSION df4159c8 Revert "Revert "Register readback on most modules. Still need to convert the other ones (#396)"" 56ec2150 Revert "Register readback on most modules. Still need to convert the other ones (#396)" 893e4861 Register readback on most modules. Still need to convert the other ones (#396) 6bbae7be VW safety: allow cancel spam on both buses to be compatible with camera and gateway integration d5f7a287 bump panda 1bcc351f ignition_can: set it to False after 2s of not seeing CAN msgs 96137f1a VW can based ignition not needed. it has ignition line at camera as well. 1b004a18 Same flake8 version as the one in openpilot e82ba5f2 Same pylint version as the one in openpilot 656f99b0 Interrupt refactor (NVIC_SM_1: #334) and Fault handling (#377) (PR #373) 000282e5 Fix can_logger.py to run correctly on python3 (#392) 7f9b4a59 Fix USB device enumeration on Windows 8.1 and Windows 10 (#393) dec565c7 Update Misra test coverage, which now includes rule 2.7 fb6bc3ba Fix Misra 878dd00a solve race condition is relay_malfunction right after changing the relay status by adding a counter 2d4cb05c add a safety mode counter a6797a21 Implement USB power mode on uno 670f90cc Merge branch 'master' of github.com:commaai/panda ca39a5d8 Added faults integer to health packet e1c34a1a Panda Jungle testing (#394) 2a093a39 Added heartbeat to echo test 22464356 Fixed health struct size. We should really get an automated test for this f458d67a Add uptime counter to the health packet (#391) 16624811 enable CAN transcievers outside the set_safety_mode function, which is not related a7c98744 bump panda ver 1192d934 Power saving refactor (#389) d58d08fb Fix Misra 17.8: can't mod function params bc685ac9 Minor indent a54b86c4 Failure of set_safety_mode falls back to SILENT. Failure to set silent results in hanging 597436d3 NOOUTPUT safety mode is now SILENT. NOOUTPUT still exists but keeps C… (#388) d229f8dc ESP forced off in EON build. this prevents ESP to be turned on when e… (#387) 8a044b34 forgot Hyundai: now also using make_msg 4f9c8796 remove abunch of lines from safety regression tests by using common make_msg function fb814143 mispelled word 57f5ef8c Fix misra: addr can't be more than 29 bits anyway 68ff5012 typo d5c772b0 Fixe Toyota message white-list 48197a92 Better masking for ELM mode b8fe78c3 VW is also tested for safety replay 212d336b Safety Chrysler: Added cancel spam button check d44b5621 fix print in example 02d579a5 functional addr handling 6249a183 tx_hook shall have a white-list of messages (#381) 8138fc14 uds: handle function addrs and fw version query example 6626a542 Fixed python health api b9b79e8b uds zero second timeout e0de1a4f define ALLOW_DEBUG in safety tests 86dec4b8 Safety modes that violate ISO26262 requirements are not compiled in RELEASE build e74ed936 safety tests a bit more simplified 2027765b relay malfunction test centralized 8af1a01a clean up safety tests e8f7a3b2 upd panda cfcce8f0 WIP: Relay malfunction (#384) 69d9d610 No tabs in mazda safety a86418c1 insignificant changes f239b996 single addr was better d063a188 Hyundai safety: re-enable button spam safety check 4d1edc06 skip tx_hook if a message is forwarded (#379) df2ff045 bump version 168461d5 added fault state to health packet b3e1a133 uds: better debug prints 68c39fb3 uds: no need for threads if you always drain rx 91b7c5bb bump Panda Ver 26cb4dc4 Fixed pylint error 32725cc3 Fixed misra compliance e33b4bea Added echo script 312ba62d minor comment cleanupo e90897a8 Fix board detection on white 0e72c183 always stop executing if safety mode fails to be set (suggested by jyoung8607) e8d7ed1d Rename function name to not confuse safety_set_mode and set_safety_mode ff86db65 improve uds message processing 512ab3f2 except Exception 37ce507a py3 all bac4d854 dos and python3 501db8d1 uds drain before send and use has_obd() f2cbec16 Added has_obd() to python library 48e5b182 Add SDK downloading to the build step (#314) e0762c2e Add Python & USB API for controlling phone power (#313) ba9fb69f New health packet struct also in the python libs git-subtree-dir: panda git-subtree-split: a648ccae4b3661ca6de7a4ac199cc44a41442b74
;" ^; ;' ",
______/\\\\\\\\\\\____/\\\\\\\\\_______/\\\\\\\\\\\\\\\______/\\\\\\\\\\_____________/\\\____ ; s$$$$$$$s ;
_____\/////\\\///___/\\\///////\\\____\/\\\///////////_____/\\\///////\\\__________/\\\\\____ , ss$$$$$$$$$$s ,'
_________\/\\\_____\///______\//\\\___\/\\\_______________\///______/\\\_________/\\\/\\\____ ;s$$$$$$$$$$$$$$$
_________\/\\\_______________/\\\/____\/\\\\\\\\\\\\_____________/\\\//________/\\\/\/\\\____ $$$$$$$$$$$$$$$$$$
_________\/\\\____________/\\\//______\////////////\\\__________\////\\\_____/\\\/__\/\\\____ $$$$P""Y$$$Y""W$$$$$
_________\/\\\_________/\\\//____________________\//\\\____________\//\\\__/\\\\\\\\\\\\\\\\_ $$$$ p"$$$"q $$$$$
__/\\\___\/\\\_______/\\\/____________/\\\________\/\\\___/\\\______/\\\__\///////////\\\//__ $$$$ .$$$$$. $$$$
_\//\\\\\\\\\_______/\\\\\\\\\\\\\\\_\//\\\\\\\\\\\\\/___\///\\\\\\\\\/_____________\/\\\____ _ $$$$$$$$$$$$$$$$
__\/////////_______\///////////////___\/////////////_______\/////////_______________\///_____| | "Y$$$"*"$$$Y"
_ __ __ _ _ __ __| | __ _"$b.$$"
| '_ \ / _` | '_ \ / _` |/ _` |
| |_) | (_| | | | | (_| | (_| |
| .__/ \__,_|_| |_|\__,_|\__,_|
| | A comma.ai product.
|_| (Code by Jessy Diamond Exum)
Installing J2534 driver:
Depending on what version of windows you are on, you may need to separately install the WinUSB driver (see next section).
Installing WinUSB driver:
Installation automatically happens for Windows 8 and Windows 10 because the panda firmware contains the USB descriptors necessary to auto-install the WinUSB driver.
Windows 7 will not auto-install the WinUSB driver. You can use Zadig to install the WinUSB driver. This software is not tested on anything before 7.
More details here: WinUSB (Winusb.sys) Installation WCID Devices Zadig for installing libusb compatible driver
Using J2534:
After installing the J2534 drivers for the panda, you can do... nothing. You first need to get a J2534 client that can load the drivers and talk to the panda for you.
A simple tool for testing J2534 drivers is DrewTech's 'J2534-1 Bus Analysis Tool' available in the 'Other Support Applications' section of their Download Page.
What is J2534?
J2534 is an API that tries to provide a consistent way to send/receive messages over the many different protocols supported by the OBD II port. The place this is perhaps most obvious, is sending data over different protocols (each using unique packetizing methods) using the same data format.
For each PassThru Device that should be used with J2534 (in this case, the panda), a 'driver' has to be written that can be loaded by a client application wanting to send/receive data.
A lot of J2534 has good ideas behind it, but the standard has some odd choices:
- Platform Locked: Requires using the Windows Registry to find installed J2534 libraries/drivers. Drivers have to be DLLs.
- Architecture Locked: So far there is only support for x86.
- No device autodetect, and poor support for selecting from multiple devices.
- Constant vague language about important behavior (small differences between vendors).
- Most common differences become standard in later revisions.
Why use J2534 with the panda?
J2534 is the only interface supported by most professional grade vehicle diagnostics systems (such as HDS). These tools are useful for diagnosing vehicles, as well as reverse engineering some lesser known features.
What parts are supported with panda?
- J1850VPW (Outdated, and not physically supported by the panda)
- J1850PWM (Outdated, and not physically supported by the panda)
- CAN
- ISO15765
- ISO9141 (This protocol could be implemented if 5 BAUD init support is added to the panda.)
- ISO14230/KWP2000 (Could be supported with FAST init, 5baud init if panda adds support for 5bps serial)
Building the Project:
This project is developed with Visual Studio 2017, the Windows SDK, and the Windows Driver Kit (WDK).
The WDK is only required for creating the signed WinUSB inf file. The WDK may also provide the headers for WinUSB.
To build all the projects required for the installer, in Visual Studio, select Build->Batch Build. In the project list select:
- "panda" Release|x86
- "panda" Release|x64
- "panda Driver Package" Debug|x86 (Note this inf file works with x86/amd64).
- "pandaJ2534DLL" Release|x86
The installer is generated with NullSoft NSIS. Use NSIS to run panda_install.nsi after building all the required projects.
Before generating the installer, you must go to copy vscruntimeinfo.nsh.sample to vscruntimeinfo.nsh and follow the instructions to bundle in the Visual Studio C Runtime required by your version of Visual Studio. Without this runtime, the panda code will not work, so without this file, the installer will refuse to build.
Developing:
- Edit and merge pandaJ2534DLL\J2534register_x64.reg to register your development J2534 DLL.
- Add your output directory (panda\drivers\windows\Debug_x86) to your system PATH to avoid insanity.
ToDo Items:
- Apply a style-guide and consistent naming convention for Classes/Functions/Variables.
- Send multiple messages (each with a different address) from a given connection at the same time.
- Implement ISO14230/KWP2000 FAST (LIN communication is already supported with the raw panda USB driver).
- Find more documentation about SW_CAN_PS (Single Wire CAN, aka GMLAN).
- Find example of client using a _PS version of a protocol (PS is pin select, and may support using different CAN buses).
Known Issues:
-
ISO15765 Multi-frame TX: Hardware delays make transmission overshoot STMIN by several milliseconds. This does not violate the requirements of STMIN, it just means it is a little slower than it could be.
-
All Tx messages from a single Connection are serialized. This can be relaxed to allow serialization of messages based on their address (making multiple queues, effectively one queue per address).
Troubleshooting:
troubleshooting:
- Install DrewTech J2534-1 Bus Analysis Tool http://www.drewtech.com/downloads/tools/Drew%20Technologies%20Tool%20for%20J2534-1%20API%20v1.07.msi
- Open DrewTech tool and make sure it shows "panda" as a device listed (this means registry settings are correct)
- When DrewTech tool attempts to load the driver it will show an error if it fails
- To figure out why the driver fails to load install Process Monitor and filter by the appropriate process name https://docs.microsoft.com/en-us/sysinternals/downloads/procmon
Other:
Panda head ASCII art by dcau