Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperkarlsson committed Jun 10, 2015
2 parents 89e1983 + 21fa4cc commit de10499
Show file tree
Hide file tree
Showing 6 changed files with 215 additions and 165 deletions.
153 changes: 6 additions & 147 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@ CaringCaribou is module based with a master command (cc.py) that runs the show.
- services - Service Discovery.Brute force all Service Id's (SID) and report any responses (anything that is not xx F7 11)
- subfunc - Sub-function Discovery. Brute force engine that takes SID and an index indicating which positions to brute force as input.

Detailed information on the [dcm-module](https://github.com/CaringCaribou/caringcaribou/edit/master/documentation/dcm.md).
Detailed information on the [dcm-module](https://github.com/CaringCaribou/caringcaribou/blob/master/documentation/dcm.md).

### xcp.py - Universal Measurement and Calibration Protocol (XCP)
- discovery - ArbId Discovery. Tries to connect (FF) to all possible ArbId (000-7FF) and collect all valid responses (FF or FE)
- info - XCP Get Basic Information. Connects and gets information about XCP abilities in the target environment
- dump - XCP Upload. Used to dump ECU memory (SRAM, flash and bootloader) to file


Detailed information on the [xcp-module](https://github.com/CaringCaribou/caringcaribou/edit/master/documentation/xcp.md).
Detailed information on the [xcp-module](https://github.com/CaringCaribou/caringcaribou/blob/master/documentation/xcp.md).

### listener.py - Listener
- ArbId listener - register all ArbIds heard on the CAN bus

Detailed information on the [listener-module](https://github.com/CaringCaribou/caringcaribou/edit/master/documentation/listener.md).
Detailed information on the [listener-module](https://github.com/CaringCaribou/caringcaribou/blob/master/documentation/listener.md).

### send.py - Send CAN packets
- Raw message transmission module, used to drive manual test cases

Detailed information on the [send-module](https://github.com/CaringCaribou/caringcaribou/edit/master/documentation/send.md).
Detailed information on the [send-module](https://github.com/CaringCaribou/caringcaribou/blob/master/documentation/send.md).

### CAN.Action.py
This is the daddy of all classes. Imported by all other modules. Abstraction for all access to the CAN bus
Expand All @@ -48,149 +48,7 @@ Some sort of interface towards an automotive bus that is compatible with socketC
- a pretty modern linux kernel

## How to install

### Linux
The setup consists of two steps. First we need to get the USB-to-Can device working and secondly configure Python-Can for the device.
#### USB-to-Can Setup
1. Install a Linux dist with a kernel >= 3.4 e.g. latest Ubuntu (we used Ubuntu 14.04 LTS)
2. Plug in the USB-to-Can device (we used [PEAK PCAN-USB](http://www.peak-system.com/PCAN-USB.199.0.html))
3. Load the CAN module:

```
sudo modprobe can
```
4. Set up the can device (bitrate may differ between different CAN buses):

```
sudo ip link set can0 up type can bitrate 500000
```
5. ```can0``` will now display as a normal network interface


#### Python-Can
Download Python-Can from [bitbucket.org/hardbyte/python-can commit 77eea796362b](https://bitbucket.org/hardbyte/python-can/get/77eea796362b.zip).

Use other commits at your own peril.

##### Install
1. Install [pip](https://pypi.python.org/pypi/pip)
2. Install python-can by running:

sudo python setup.py install

3. Verify that the installation worked by running python from the terminal and load the can module.

```
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import can
>>>
```
##### Configure
Python-Can uses a configuration file ```~/.canrc``` to specify a CAN interface.
The contents of this file should be:
[default]
interface = socketcan_ctypes
channel = can0
##### Test it
Connect the USB-to-CAN device to an actual CAN-bus and run the following:
``` python bin/canlogger.py ```
If packets are received everything is good to go!
### Windows 7
The simplest solution is to download [VMPlayer](https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/7_0), install a Linux distribution and to follow the Linux guide above.
### Raspberry Pi
#### Parts list
- Raspberry Pi model B
- SD-card 8 GB
- piCAN-shield
- DBUS 9 male
- 2 wires
#### Helpful sites
- http://skpang.co.uk/blog/archives/1141 (piCAN shield)
- http://www.cowfishstudios.com/blog/canned-pi-part1 (Kernel modules and howto)
- http://lnxpps.de/rpie/ (Kernel modules & config)
- http://ifinterface.com/page/page3.php?langid=1 (Kernel modules)
- http://www.raspberrypi.org/forums/viewtopic.php?p=675658#p675658 (Device Tree)
#### USB-to-CAN
##### Raspian
1. Download and flash latest raspian image to SD card.
We used ```http://downloads.raspberrypi.org/raspbian/images/raspbian-2015-02-17/```
1. Update, upgrade & reboot
```
sudo apt-get update
sudo apt-get upgrade
sudo reboot
```
##### Kernel modules
1. Download kernel modules for mcp2501x that fits your kernel version. We used ifinterface and ```rpi-can-3.18.7+ (not for Raspberry 2)```
1. ```cd /```
1. Unpack into ```/lib``` and ```/usr``` using ```sudo tar -jxvf /path-to/<archivename>```
1. Register the new modules
```
sudo depmod -a
sudo reboot
```
###### Add modules in /etc/modules to enable them at boot
```
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.

snd-bcm2835
spi_bcm2708

# MCP2515 configuration for PICAN module
spi-config devices=\
bus=0:cs=0:modalias=mcp2515:speed=10000000:gpioirq=25:pd=20:pds32-0=16000000:pdu32-4=0x2002:force_release

# load the module
mcp251x
```
Make sure they are not in a blacklist in ```/etc/modprobe.d/<blacklist>``` If they are - comment this entries:
```
#blacklist spi-bcm2708
#blacklist mcp251x
```
##### Enable spi in Device Tree
In /boot/config.txt, add
```
# add SPI-support for piCAN
dtparam=spi=on
```
Note: Enabling spi in the device tree was required when we performed install due to changes in how Raspberry handles devices. It will change and/or be removed with new releases.
##### Bring up the interface
11. Configure CAN interface
```sudo ip link set can0 type can bitrate 500000```
12. Bring the interface up
```sudo ip link set can0 up ```
##### Python-Can
See instructions above in the Linux guide
Instructions available [here](https://github.com/CaringCaribou/caringcaribou/blob/master/documentation/howtoinstall.md)

## How to use
The best way to understand how to use Caring Caribou is by envoking cc.py's help menu:
Expand All @@ -199,6 +57,7 @@ The best way to understand how to use Caring Caribou is by envoking cc.py's help


## Extending the project
Create a python file with a ```module_main(args)``` function. Put it in the ```modules``` folder. CaringCaribou (cc.py) will automagically recognize it as a module and list it in the output of ```./cc.py -h```

## The target
We used an open source implementation of Autosar from ArcCore available here: http://www.arccore.com/hg **FIXME**
Expand Down
143 changes: 143 additions & 0 deletions documentation/howtoinstall.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
## How to install

### Linux
The setup consists of two steps. First we need to get the USB-to-Can device working and secondly configure Python-Can for the device.
#### USB-to-Can Setup
1. Install a Linux dist with a kernel >= 3.4 e.g. latest Ubuntu (we used Ubuntu 14.04 LTS)
2. Plug in the USB-to-Can device (we used [PEAK PCAN-USB](http://www.peak-system.com/PCAN-USB.199.0.html))
3. Load the CAN module:

```
sudo modprobe can
```
4. Set up the can device (bitrate may differ between different CAN buses):

```
sudo ip link set can0 up type can bitrate 500000
```
5. ```can0``` will now display as a normal network interface


#### Python-Can
Download Python-Can from [bitbucket.org/hardbyte/python-can commit 77eea796362b](https://bitbucket.org/hardbyte/python-can/get/77eea796362b.zip).

Use other commits at your own peril.

##### Install
1. Install [pip](https://pypi.python.org/pypi/pip)
2. Install python-can by running:

sudo python setup.py install

3. Verify that the installation worked by running python from the terminal and load the can module.

```
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import can
>>>
```
##### Configure
Python-Can uses a configuration file ```~/.canrc``` to specify a CAN interface.
The contents of this file should be:
[default]
interface = socketcan_ctypes
channel = can0
##### Test it
Connect the USB-to-CAN device to an actual CAN-bus and run the following:
``` python bin/canlogger.py ```
If packets are received everything is good to go!
### Windows 7
The simplest solution is to download [VMPlayer](https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/7_0), install a Linux distribution and to follow the Linux guide above.
### Raspberry Pi
#### Parts list
- Raspberry Pi model B
- SD-card 8 GB
- piCAN-shield
- DBUS 9 male
- 2 wires
#### Helpful sites
- http://skpang.co.uk/blog/archives/1141 (piCAN shield)
- http://www.cowfishstudios.com/blog/canned-pi-part1 (Kernel modules and howto)
- http://lnxpps.de/rpie/ (Kernel modules & config)
- http://ifinterface.com/page/page3.php?langid=1 (Kernel modules)
- http://www.raspberrypi.org/forums/viewtopic.php?p=675658#p675658 (Device Tree)
#### USB-to-CAN
##### Raspian
1. Download and flash latest raspian image to SD card.
We used ```http://downloads.raspberrypi.org/raspbian/images/raspbian-2015-02-17/```
1. Update, upgrade & reboot
```
sudo apt-get update
sudo apt-get upgrade
sudo reboot
```
##### Kernel modules
1. Download kernel modules for mcp2501x that fits your kernel version. We used ifinterface and ```rpi-can-3.18.7+ (not for Raspberry 2)```
1. ```cd /```
1. Unpack into ```/lib``` and ```/usr``` using ```sudo tar -jxvf /path-to/<archivename>```
1. Register the new modules
```
sudo depmod -a
sudo reboot
```
###### Add modules in /etc/modules to enable them at boot
```
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.

snd-bcm2835
spi_bcm2708

# MCP2515 configuration for PICAN module
spi-config devices=\
bus=0:cs=0:modalias=mcp2515:speed=10000000:gpioirq=25:pd=20:pds32-0=16000000:pdu32-4=0x2002:force_release

# load the module
mcp251x
```
Make sure they are not in a blacklist in ```/etc/modprobe.d/<blacklist>``` If they are - comment this entries:
```
#blacklist spi-bcm2708
#blacklist mcp251x
```
##### Enable spi in Device Tree
In /boot/config.txt, add
```
# add SPI-support for piCAN
dtparam=spi=on
```
Note: Enabling spi in the device tree was required when we performed install due to changes in how Raspberry handles devices. It will change and/or be removed with new releases.
##### Bring up the interface
11. Configure CAN interface
```sudo ip link set can0 type can bitrate 500000```
12. Bring the interface up
```sudo ip link set can0 up ```
##### Python-Can
See instructions above in the Linux guide
18 changes: 18 additions & 0 deletions documentation/listener.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Listener
````
>./cc.py listener -h
-------------------
CARING CARIBOU v0.1
-------------------
Loaded module 'listener'
usage: cc.py listener [-h] [-r]
Passive listener module for CaringCaribou
optional arguments:
-h, --help show this help message and exit
-r, --reverse Reversed sorting of results
```
1 change: 0 additions & 1 deletion documentation/man.txt

This file was deleted.

28 changes: 28 additions & 0 deletions documentation/send.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Send
````
>./cc.py send -h
-------------------
CARING CARIBOU v0.1
-------------------
Loaded module 'send'
usage: cc.py send [-h] [--delay DELAY] msg [msg ...]
Raw message transmission module for CaringCaribou
positional arguments:
msg Message on format ARB_ID#DATA where ARB_ID is
interpreted as hex if it starts with 0x and decimal
otherwise. DATA consists of 1-8 bytes, written in hex.
optional arguments:
-h, --help show this help message and exit
--delay DELAY, -d DELAY
Delay between messages in seconds
Example usage:
cc.py send 0x7a0#c0.ff.ee.00.11.22.33.44
cc.py send -d 0.5 123#de.ad.be.ef 124#01.23.45
```
Loading

0 comments on commit de10499

Please sign in to comment.