![](/media/cache/profiles/98be175f18ff12118f056c7e448ade23.50x50_q85.jpg)
A working demonstration on how to read GMLAN packets using an mbed and a compatible CAN transceiver such as (and tested with) the CAN-Bus demo board. The SparkFun CAN Shield should also work perfectly too, as should just about every MCP2551-based solution (but this code should be portable to other transceivers). Please note to get this to work, you must tie CAN_L to ground and connect CAN_H to the single wire CAN.
GMLAN Sniffer
Introduction
This project makes use of CAN on an LPC1768 to communicate with General Motors GMLAN network via a compatible transceiver. GMLAN is a single wire CAN Bus that operates at 33.333 kbit with 29-bit header packets and is commonly used for transmission of non-critical information between such nodes on automobiles as the following;
- Dash cluster
- Entertainment system (head unit)
- Satellite Navigation (OnStar for example)
- HVAC controls
- Immobiliser / alarm / other security systems
- Door locks and door status
- Power Windows
- Interior / exterior lighting
- Reversing sensors
The list is extensive, for a better idea of what can be done, view the ARBIDs tab on the GMLAN Bible Google Docs spreadsheet (tabs are at the bottom of the page).
Hardware setup
This is just one example of how you can interface with GMLAN using an SKPang CAN-Bus Breakout Board (based around an MCP2551 CAN Transceiver), using these instructions I assembled the following on my trusty prototyping board;
(Click to open high resolution version)
Diff: main.cpp
- Revision:
- 8:cdd2bb40e72f
- Parent:
- 7:8bc6a5d2ba1e
diff -r 8bc6a5d2ba1e -r cdd2bb40e72f main.cpp --- a/main.cpp Mon Dec 10 21:11:23 2012 +0000 +++ b/main.cpp Mon Dec 10 22:24:49 2012 +0000 @@ -110,7 +110,7 @@ // Set CANBUS to 33.3kbit and put into monitor mode (does not ACK packets, aka stealth mode) int baudrate = 33333; gmlan.frequency(baudrate); - gmlan.monitor(false); + gmlan.monitor(true); // Clear serial terminal clearAndHome();