Files
dragonpilot/drivers/windows
Vehicle Researcher 38faf7f8a4 Squashed 'panda/' changes from 9881e6118..30c7ca8a5
30c7ca8a5 bump version to 1.5.3
9403dbebe Need to fix wifi test before re-enabling.
0812362b5 GPS UART fix until boardd is refactored (#294)
ffbdb87a8 python2 -> 3 fixes to pedal flasher (#292)
78b75ef59 Added build type to release version strings
736c2cbf7 Fixed sending of bytes over PandaSerial
0894b28f1 Fixed USB power mode on black (#291)
4b3358c92 patch to be able to switch from EON to PC with a Panda that has EON b… (#290)
a95c44a71 Made setting of NOOUTPUT on no heartbeat more efficient (#287)
948683688 UART instability fix with high interrupt load (#283)
9a9e9d47b Fix usb_power_mode missing initialization (#289)
af0960ad3 DFU fix (#288)
70219d7bb match safety enum in cereal (#285)
a338d3932 Fix build for jenkins test
78ef4a6eb Stop charge (#284)
5266a4028 Fix typo (#286)
f4787ec5a Revert "turn on CDP when ignition switches on (#281)"
d37daee97 Revert "NONE and CLIENT should be the same thing in white/grey pandas"
e97b283e7 NONE and CLIENT should be the same thing in white/grey pandas
8c1df559f turn on CDP when ignition switches on (#281)
847a35d42 Fix bullet points
fac027716 Misra update (#280)
5a04df6b1 Added description of regression tests to README
c4aabae59 Fixed some python3 bugs in the test scripts and PandaSerial
9af0cb353 Bump version
c4ac3d63b Disable GPS load switching on black pandas
078ee588c This is the correct table, actually
578b95ee3 Misra table of coverage added
d383a2625 bump panda
b98ca010d fix sdk build in python3 env (#279)
63d3dc7d3 Set python3 env before runnign get_sdk, so we know if it fails
e951d79c0 legacy code we don't control can remain python2
11b715118 Merge pull request #276 from commaai/python3
9893a842a Merge pull request #277 from zorrobyte/patch-1
d3268690c Revert "revert back esptool to python2 and force to build esptools with python2"
875e76012 revert back esptool to python2 and force to build esptools with python2
9c40e6240 needed to install python3
ed2ac87cf Also moved safety tests to python3
6842b2d2c move esptool sdk installation before python3 env is set. Kind of a cheat
b5a2cabcd this hopefully fixes build test
628050955 Fixes safety replay
2c220b623 this fixes language regr test
fdbe789b8 use python 3 in Docker container
ee1ae4f86 Better hash print
0de9ef73c Revert "Final 2to3 on the whole repo"
c92fd3bc9 Final 2to3 on the whole repo
5f2bc4460 better
b2a30fdbd make works!
b74005d10 fix sign.py
fe727706b read file as byte and no tab before sleep
32a344ef6 Update README.md
2dc34096a 2to3 applied
ffa68ef71 undo unnecessary brackets for print
dbc248027 Fix all the prints with 2to3, some need to be undo
5a7aeba0f xrange is gone
982c4c928 one more python3 env
1e2412a29 env python -> env python3

git-subtree-dir: panda
git-subtree-split: 30c7ca8a53a3adb05d23d7cfe64fb716a656ef1a
2019-10-09 18:31:56 +00:00
..

                                                                                                        ;"   ^;     ;'   ",
______/\\\\\\\\\\\____/\\\\\\\\\_______/\\\\\\\\\\\\\\\______/\\\\\\\\\\_____________/\\\____           ;    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:

Download

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:

  1. Install DrewTech J2534-1 Bus Analysis Tool http://www.drewtech.com/downloads/tools/Drew%20Technologies%20Tool%20for%20J2534-1%20API%20v1.07.msi
  2. Open DrewTech tool and make sure it shows "panda" as a device listed (this means registry settings are correct)
  3. When DrewTech tool attempts to load the driver it will show an error if it fails
  4. 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