VOLVO+ Development Story (9), A-SS development

VOLVO made the A-SS default on. I spent hundreds of hours to learn CAN bus programming from scratch to make the A-SS default off. The article illustrates the idea to hack car, and A-SS OFF development detail. 


Build development Tool

  • I typically interact with CAN bus via Raspberry Pi + Linux toolchain
    • Pro
      • Raspberry Pi had built-in WiFi, bluetooth, high performance
      • Convenient can-utils package
      • It's basically a computer and we can write program
    • Con
      • No commercial or GUI based tool, higher entry barrier
      • No technical support, develop everything on our own
      • No solid mechanical structure, I spend a lot of time debugging toolkit before doing experiment
  • Hardware selection
    • Raspberry Pi 3B+
    • Candlelight FW based USB-to-CAN bus converter
    • Adjustable DC-to-DC converter module for 12V-to-5V
  • I made several HW and picture below is the one I'm using
  • I also had a outdoor version, which used Raspberry Pi ZW to reduce size
  • Debian Linux had can-utils package, whose candump can sniffer CAN bus
    • The command can output CAN bus packet to the screen (so we can feel the packets). It looks like screenshot below
      • The Linux had convenient pipe + grep command to filter the packets we're interested
      • We may also direct the screen output to some files for further analysis
    • The package also had a "cansend" command which can send arbitrary packet

Find the trigger signal

Since this is CAN bus product, our judgement is based on CAN bus packets. To turn off A-SS after engine-on, this means detecting engine on by CAN bus and sending some packet to turn off A-SS

With my homebrew development, I recorded some log containing the transition from engine off->on. The log file contained thousands of CAN packets, how to find it? It's impossible to consult technical support from VOLVO, they will not provide CAN bus packet definition. Well.. let's do hard working

  • Reading the CAN packets seems stupid, but that's worthy. VOLVO selected fixed 8bytes format whose timing is probably more predictable (but wasting bandwidth)
    • As far as I know, Japanese car used variable length packets
  • Analyze the log file by Excel
    • There must be duplicated packets in the log files. Excel can find the unique set of packages and calculate the count of each packet. The picture below is the result
      • The method is basic but useful. Imagine you trigger some events 3/5/7 times and some CAN packets also appear 3/5/7 times, then you're lucky to find the event
    • Excel can also do quick filtering to check the desired ID, and plotting diagram to do visualization analysis
    • Different ID usually means different purpose. I ever checked each ID individually to find clues. In my previous article, the VOLVO low CAN had ID=2E7 indicating sort of timestamp
  • CAN packet visualization tool
    • I wrote Python utility to visualize CAN packet. Below is the visualization result of 2E7. Unique packets appeared as time goes by



Find the A-SS off packet
  • I tried to press the A-SS button under different scenarios and recording the CAN bus traffic. I tried to find the rules in these logs
  • Finding the A-SS stop behavior is a bit tricky. After locating some suspicious packet, I tried to send another packet to "overwrite" the previous state, and the A-SS light were OFF!
    • To read the CAN bus is safe. After all, everyone on the bus can do reception without risk
    • To write the CAN bus is another story. We don't know whether the inject packet will affect the system
  • As mentioned before, I also bought the Module 4.0 as reference design. By sniffer the CAN bus, I also double check my answer with it. I'm happy that we're doing the same design
    • MITM tricks also used to examine Module 4.0 behavior directly

FW development
STM provided STM32CUBEMX that generated the boot code and provided CAN library. By just some clicking, I had skeleton of the system with FreeRTOS. Then I wrote FW to connect the engine-on message, and send A-SS off packet. The essential code is roughly 20 lines. Final production code experienced several times of re-written to support multiple model and cars. Doing prototype with my car is easy, but supporting various car models and years is nightmare


Picture below indicating how the VOLVO+ working. The upper yellow row is the engine start event while the lower yellow row is the A-SS off! Now I had an invisible hand to press the A-SS button as engine on



Special thanks
VOLVO made the A-SS default on. I spent hundreds of hours to learn CAN bus programming from scratch to make the A-SS default off

In the end of the article, I want to say thanks for all XC60 owners who helped me test VOLVO+. Without your help, the verification is just limited to a single XC60 only
  • Taipei, Mr. Yang, Mr. Huang
  • Taoyuan, Mr. Chen
  • Hsinchu, Mr. Hsu, Mr Chang, Mr. Chen
  • Yilan, Mr. Chang
  • Kaohsiung, Mr. Yang

Comments

Popular posts from this blog

OBD-II and ELM327 (1)

OBD-II and ELM327 (3), try to decode CAN package recorded by ELM327

OBD-II and ELM327 (2), the underlying interface of ELM327