Hacking the Tool That Hacks My Car – Part 1

For tech reference bits like baud rates and pinouts, check the appendix at the end.

I’ve wanted to know about what my 2005 Saturn Ion’s computer was saying to its instrument cluster since it first flashed “Low Fuel” on the built-in text display. Was the message from the ECU, or was it build into the dash? Oh the hacking possibilities could be endless! Enter this Bluetooth enabled clone of the ELM327:

This little guy was available on Amazon.ca for $23 (before shipping cost) and I thought it would be prefect to stream all of the data from my car’s CAN bus so I could search for text on the network. I was a little uninformed though as the 327 defaults to a baud rate of 38.4kbps and most cars after 2004 clock in at 500kbps or higher. That’s an order of magnitude off, so the flood of messages was way too much and I hit “BUFFER FULL” when I tried opening the firehose to stream the communication data from the network. I’d have to get creative. That’s where today’s adventure starts.

The main problem is with the Bluetooth to serial adapter pictured above. You can’t change its baud rate from the wireless end because it is a transparent bridge. To get both to work at a higher speed, I’d have to split them in half like an avocado and configure each over serial individually.  I opted for just the ELM327 for now, and would tackle Bluetooth another day.

On the hardware front, luckily the factory building this module only applied solder to five of the 32 pads making the desoldering a breeze and I the pinout for the Beken BK3231 was quickly found on this here forum thread.

Armed with knowledge, the soldering commensed! A few wires at SkullSpace later, and I had this:

I should take a quick break to mention that the electronics bench at SkullSpace has some great wire for this tiny work and a veritable cornucopia of through-hole diodes, resistors, and all kinds of random electronic bits. If you ever need something, just ask us. It’s normally for members, but we can be persuaded.

Back to the project now. With the delicate part done, it was time to hook the car half of the equation up to my trusty Bus Pirate for 3.3 volt serial fun. I found the probes a bit too fiddly, so I used a few 0.1” pitch jumper wires.

After some time of trying to hook up the ELM327 on my inside workbench, I found that it wouldn’t boot up and accept commands successfully on my desk with only the 12v lines, so it was out to the heated garage with the laptop to play around.

Then, good news and bad news: The good news was that it was able to pull data and I was able to get all the juicy documented OBD2 endpoints. The bad news was that even after ramping the baud rate up to 115,200bps I was still not getting data fast enough:

00 00 00 00 00 01 00 00 
00 03 20 03 22 00 00 00 
40 00 0F FF 3F FF F0 00 <DATA ERROR
00 FF 00 00 00 00 00 00 
00 00 00 00 00 01 00 00 
00 03 20 03 22 00 00 00 
80 00 0F FF 3F FE EF FF <DATA ERROR
00 FF 00 00 00 00 00 00 
00 00 00 00 00 01 00 00 
00 03 20 03 22 00 00 00 
80 00 80 00 80 00 80 00 <DATA ERROR
C0 00 0F FF 3F FD EF FE <DATA ERROR
00 FF 00 00 00 00 00 00 
00 00 00 00 00 01 00 00 
00 03 20 03 22 00 00 00 
00 00 0F FF 00 00 F0 01 
00 FF 00 00 00 00 00 00 
0A 43 FF 0A 
00 3E 08 
00 00 00 00 00 01 00 00 
00 03 20 03 
BUFFER FULL

So that’s where I sit at the moment, anti-climatically. I bought an FTDI adapter that can run at up to 3Mbps and subsequently bricked it. Join me next post for the unbricking process! Likely featuring our Seleae Logic8.

 

Appendix:

ELM327 commands used:

  • AT Z – Reset device. Make sure we start fresh.
  • AT L1 – Enable line breaks. Makes reading things as a human feasible
  • AT MA – Monitor everything on the CAN bus. This is what is failing due to that buffer overflow.
  • AT BRD xx – Attempt a new baud rate divisor
  • AT PP 0C SV xx – Set a new baud rate. Requires a commit (the next command) and restart
  • AT PP 0C ON – Makes the change permanent (dangerous if set beyond what your serial device can handle)

How to calculate ELM327 baud rates:

This should be obvious to most people, but it wasn’t for me the first time I needed the correct rate. Because the device uses a PIC micro controller, you’re supplying the divisor for the serial clock which is 4MHz. To get the right value value to feed into “AT BRD” and friends, just do the following:

4,000,000 / baud = rate

Then convert that to a hex value. Example:

4,000,000 / 115,200 = 34 -> 0x22

Note that if you set the rate outside of the range that your device supports (let’s say 0x24 which it a non-standard rate) you will have bricked your device until you can get yourself a Bus Pirate or similar that supports its own arbitrary divisor.

Also noteable is that there are error slew rates with different baud rates in micro controllers. Occasionally the rate may be off by 10% and the devices can’t communicate correctly. That’s where I’m at. 🙂

 

Bluetooth Pinout:

The Beken BK3231 is actually a pretty capable microcontroller with some nice features. On this device it’s potential seems a little wasted as it just comes with a serial-bridge firmware flashed to it, but it does make it convenient to use. I’ve read it has a compatible pinout to the HC-05, but I’m not certain there. For your convenience I pulled an image from this thread which was mentioned above. There is some great information there.

Comments 3

  1. Hi, I did the same but my BT module which has the same pinout as yours uses RX/TX lines (not MISO MOSI CLK and CS) – I simply wired a USB to Serial FTDI module to it to access the ELM327. Are you sure you wired it like this or does that board you show have a UART mode (hence the MISO and MOSI pins of the SPI bus can become RX and TX)? It’s practically impossible to read out full 500kbit CAN data without filtering out some information with this device. For that you need to hookup a CANbus transceiver (MCP2515) shield and dump that data through it’s SPI bus to a fast MCU (STM32 or similar) for processing or directly to a USB 2.0 port and decode with PC.
    P.S. my ELM327 is a chinese clone and shows v1.5 which ELM never released. It is actually a pseudo v1.3 (I also have an original ELM and STN model).

  2. I’m fairly sure my board is just preconfigured for UART. I think all I did was wire up the pins that were there to the UART because I only
    saw two wires hooked up.

    I’m also having trouble with my new car and the data rate. I’ve tried with an STN device but its on-board UART doesn’t want to go above 230400 baud.

  3. I was wondering if there was a part 2 to this or if you fixed the buffer full issue.

Leave a Reply to Luke Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.