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)
History
Switched back to monitor / sniffing mode, inadvertent change from a project running in parallel I copy/pasted from.
2012-12-10, by foxdie [Mon, 10 Dec 2012 22:24:49 +0000] rev 8
Switched back to monitor / sniffing mode, inadvertent change from a project running in parallel I copy/pasted from.
Updated startup information to be more user-friendly
2012-12-10, by foxdie [Mon, 10 Dec 2012 21:11:23 +0000] rev 7
Updated startup information to be more user-friendly
Added support to remotely reboot mbed to activate firmware updates (suitable for deep-installation in automobiles)
2012-12-10, by foxdie [Mon, 10 Dec 2012 21:04:40 +0000] rev 6
Added support to remotely reboot mbed to activate firmware updates (suitable for deep-installation in automobiles)
Added rudimentary support for filtering GMLAN packets and migrated header code into its own class
2012-12-10, by foxdie [Mon, 10 Dec 2012 20:02:19 +0000] rev 5
Added rudimentary support for filtering GMLAN packets and migrated header code into its own class
Commented code to help assist others in future
2012-12-06, by foxdie [Thu, 06 Dec 2012 22:36:10 +0000] rev 4
Commented code to help assist others in future
Removed unneeded code, tested and works.
2012-12-06, by foxdie [Thu, 06 Dec 2012 22:25:51 +0000] rev 3
Removed unneeded code, tested and works.
Cleaned up obsolete code and comments
2012-12-06, by foxdie [Thu, 06 Dec 2012 11:10:52 +0000] rev 2
Cleaned up obsolete code and comments
Properly presents information however still needs verification on packets being accurate
2012-12-06, by foxdie [Thu, 06 Dec 2012 08:51:04 +0000] rev 1
Properly presents information however still needs verification on packets being accurate
Initial version - logs but oddly formatted data
2012-12-05, by foxdie [Wed, 05 Dec 2012 22:14:50 +0000] rev 0
Initial version - logs but oddly formatted data