Files
StarPilot/drivers/windows
Vehicle Researcher 1b8e5096c2 Squashed 'panda/' changes from ae816c104..45d0d286f
45d0d286f remove whitespace (#255)
e49d0dbbd Pedal: use avg between tracks (#253)
c597dcc89 VERSION update after health packet changes and minor misra test change
01072bec0 Misra 11.x: pointer usage. (#250)
fd68c26ab Propagate can_push errors (#249)
ce1daf206 Misra check only done for EON config
70d4fd7f6 cleanup docker container on failure
04756a037 Turning back Misra check: unvoluntarily change
fcb1208e1 fix weird code in USB_ReadPacket
b983cc8fe Re-wrote test_misra.sh
0b1920636 Misra 17.7: The value returned by a function having non-void return type shall be used. We should hang on initial failed safety_set_mode
06ee8bd2d Ignore Misra 5.4 until cppcheck bug (?) is fixed
4be858224 Update cppcheck commit and pass predefined params to avoid impossible combinations of configs
f45dd04c6 cppcheck: ignore redundantAssignment and selfAssignment for registers in llcan.h
9ce631155 Misra 12.1 (operator order) and 10.4 (incompatible essential types) fixes, arised after properly checking UID_BASE config
1cd34e564 Explicitly set the define and undefine for unknown configs in misra checks
5a024999d remove esp flash from run_automated_tests.sh
23e3684d7 Cppcheck unused functions (#247)
c97d60be6 Removed bad language
b031480a7 Missed adding Dockerfile
91ff6bb21 Run language checker in CI
205ec342a Improved language checker
f7bbab072 Language checker test
d9d0a62f2 Misra 5.5: missed this change from previous PR
85fa3c02a Misra 5.5: Identifiers shall be distinct from macro names (#246)
190d604a0 Pedal: 2 minor fixes to Misra 15.7 (else needed) and 17.7 (non-void output must be used)
8ea01ff12 Pedal: no built-in functions to avoid puts and putc re-definitions
1f40d1e6a Misra pedal (#245)
a4554e3e6 Ignore advisory Misra 19.2: the union keyword should not be used
e6dc4172b Minor indent error
247e128b4 Fix strict compiler on bootstub build
ba6856921 Removed build strict test and enabled -Werror flag
da11f0fa0 safety replay: update openpilot-tools after logreader fix
fc8b9e49b Cppcheck: also check pedal
f7bd2c2f3 Misra 10.4: fix last 2 violations (#242)
9be5fdead finished misra 17.8 (#241)
3c3aba3db Misra 10.4: Both operands of an operator in which the usual arithmetic conversions are performed shall have the same essential type category (#240)
f2a3a177b Misra 15_7: fix what seems to be a false positive of cppcheck
812ace538 Misra 15_7: if … else if constructs should be terminated with an else clause (#230)
79e9735ae rename 5_wifi_udp.py
3c3ff0c03 Update Jenkinsfile (#239)
1bd928437 Misra 17.7: the value returned by a function having non-void return shall be used (#237)
18c9e88bc Merge pull request #238 from commaai/misra_17_8
7ac321de4 Merge pull request #235 from commaai/memxxx
004e543cc Jenkins: run EON test first
4bff28620 Merge branch 'memxxx' of github.com:commaai/panda into memxxx
7cd80de23 typo
385e33b32 12.1 regression
955842bae WIP
ea908cbb7 10_1 violations: Operands shall not be of an inappropriate essential type (#233)
fa3303805 Fix Misra 5.3: An identifier declared in an inner scope shall not hide an identifier declared in an outer scope (#236)
ebfe1c512 Merge branch 'master' of github.com:commaai/panda into memxxx
8c11470ef Fix EON test case
64e18e841 fix inverted logic to differentiate between dev and EON panda builds
36755a0fd Merge branch 'master' of github.com:commaai/panda into memxxx
e2981d612 skip wifi tests for EON panda build
db2eec98c Merge branch 'master' of github.com:commaai/panda into memxxx
11257e79a Ignore test 5_wifi_udp.py_ignore: too unreliable for now
6973c2a81 fix wifi tests
cf6985ad1 memxxx function changes to be Misra compliant
3a6cd2930 wifi threshold perc back to 20%. Problem wasn't this.
d92a03528 faster docker build for safety replay
3e9469b3e Fixing tests after min->MIN  change
ecb9b6c01 Revert "Misra 10 1: Operands shall not be of an inappropriate essential type (#232)"
8732e4faf Misra 10 1: Operands shall not be of an inappropriate essential type (#232)

git-subtree-dir: panda
git-subtree-split: 45d0d286f4b5c893590a98ec1438b8a143b9605d

old-commit-hash: 1ff59baea7
2019-07-22 19:15:27 +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