Comma Pedal: Updating the Firmware over CAN

Having installed Pedal is not easy. Having to install firmware on Pedal isn’t exactly something I would describe as “fun” either.

IMPORTANT: This is only needed if you already have Pedal installed in your vehicle and are running v0.5.10+ of Openpilot. For initial USB flashing of Pedal before it is installed, follow my guide below.

Considering I’m constantly working to build tools to make things easier, it’s no question that when Comma requests we update our Pedal firmware to remain compatible in v0.5.10 then I must find a solution to making that as easy as possible as well.

I will detail the “manual” way for the do’ers and go’getters out there. This is the method that is proposed internally by Comma staff (that are smarter than I am, and also I’m not Comma staff).

Connect EON to Vehicle

This type of update only works when Pedal and all other devices have power and are already installed with the network cable and receiving CAN signals.
If you’re in a Toyota / Honda Bosch that requires external power before the vehicle starts, you will need to have the vehicle running. Your vehicle will throw errors, that is normal. It’ll go away once you’ve patched your Pedal.

For my 2017 Honda Pilot, however, I did not need to have the vehicle running as all my devices are powered by the vehicle by default.

Once you’re sure everything has power, continue on.

Connect to EON via SSH

First we need to SSH into our EON with Workbench or via Terminal. When doing this in a vehicle, wifi may not be easily accessible so you will either need to be near WiFi or have both your laptop and EON connected to your personal hotspot.

If you’ve never done this before, checkout my guide on the subject or try your luck with my desktop app known as Workbench that aims to make it a breeze.

Update Openpilot to v0.5.10+

We then need to proceed to update our Openpilot version to ensure we’re using the latest version (or a version greater than v0.5.10). If you’re on the release build, you should be updated automatically and are probably here because your car is having a shit about itself right about now.

If you’re not running release, then update with the following or clone a fresh version of Openpilot from commaai/openpilot:

cd /data/openpilot && git pull origin master

I’m not sure if this is required but I do it for good measure if you updated so everything is fresh.

reboot

Flash the Comma Pedal over CAN

Now that your EON is back up and your vehicle dash is full of errors…

We’re going to SSH back in if you rebooted above.

TIP: If you’re using Workbench v0.1.5+ you can run the rest of this guide via the built-in command. Scroll-down to see those instructions.

We need to start by making sure all Openpilot processes are dead.
The way I did this was with the following command:

tmux kill-session -t comma

This terminates a special shell session that was used to run all the Openpilot processes, in turn by terminating this we’re terminating all of it.

Now we need to flash the firmware.
Luckily there is a command for that too.

Let’s change into the pedal directory for clarity's sake.

cd /data/openpilot/panda/board/pedal

Now we run one more command to flash it.

PYTHONPATH=/data/openpilot && make

You should get some positive reinforcement and successful responses from this command.

Shut off Vehicle and Reboot EON

Now that you’ve flashed the Pedal successfully, you will need to turn off your vehicle and reboot EON.

Wait for EON to boot up successfully and then start your vehicle when you see all signs are good on the EON screen.

What to do if things go wrong…

Let’s face it, these guides never go quite as planned for whatever reason… in this case, hopefully one of these will help you.

If you receive No module named panda the following:

Traceback (most recent call last):   File "../../tests/pedal/enter_canloader.py", line 7, in <module>     from panda import Panda ImportError: No module named panda make: *** [Makefile:22: canflash] Error 1

This means that the PYTHONPATH didn’t get set properly.

Ensure you run the command exactly as above with PYTHONPATH=/data/openpilotor optionally you can run it as a separate command with export PYTHONPATH=/data/openpilot and then follow it up with a make while in the/data/openpilot/panda/board/pedal directory.

If you receive CAN: BAD RECV, RETRYING or more specifically the following:

PYTHONPATH=/data/openpilot make ../../tests/pedal/enter_canloader.py obj/comma.bin opening device 07000f800f51363038363036 0xddcc exception LIBUSB_ERROR_BUSY [-6] Traceback (most recent call last):   File "/data/openpilot/panda/python/__init__.py", line 177, in connect     self._handle.claimInterface(0)   File "/usr/local/lib/python2.7/site-packages/usb1.py", line 1162, in claimInterface     libusb1.libusb_claim_interface(self.__handle, interface),   File "/usr/local/lib/python2.7/site-packages/usb1.py", line 121, in mayRaiseUSBError     raiseUSBError(value)   File "/usr/local/lib/python2.7/site-packages/usb1.py", line 117, in raiseUSBError     raise STATUS_TO_EXCEPTION_DICT.get(value, USBError)(value) USBErrorBusy: LIBUSB_ERROR_BUSY [-6] connected 
CAN: BAD RECV, RETRYING
CAN: BAD RECV, RETRYING
CAN: BAD RECV, RETRYING
CAN: BAD RECV, RETRYING
CAN: BAD RECV, RETRYING
CAN: BAD RECV, RETRYING
CAN: BAD RECV, RETRYING

This means that something didn’t kill properly when you ran tmux kill-session -t comma so you will need to try again. I had a problem where running tmux a and then hitting ctrl+c didn’t fully terminate the processes so I had to reboot and try again. I think tmux kill-session -t comma should be more reliable and less destructive than the tmux a and ctrl-c approach.

If something else goes wrong, please connect with the community on Discord in the #hw-pedal channel.

Flashing the Pedal over CAN with Workbench v0.1.5

You can also perform the flashing commands above with Workbench.

Workbench Support: If you experience issues with Workbench, please reach out on the Workbench Discord or report bugs to GitHub Issues

By the time you read this guide, v0.1.5 of Workbench should be up but if it isn’t don’t fret, it’ll be available soon.

You will need the latest version of Workbench or at least v0.1.5+ which you can download below…

If you’ve already downloaded Workbench, ensure you’re running v0.1.5+ when it’s released for your platform. For Workbench support, please connect to Discord and enter the #topic-workbench channel.

Scan and find your EON or add it’s IP manually using the + icon.

Click your EON once it is found.

If you receive the unknown host warning, type Yes in the console and press enter.

Click the Update Pedal Firmware via CAN link on the left…

Read through the notes on the right about the command.

Then press the Run button.

If all goes well, you should see successful messages.