Difference between revisions of "Carberry"

From OpenGarages
Jump to: navigation, search
(CAN Communication)
(Management Commands)
Line 241: Line 241:
=== Management Commands ===
=== Management Commands ===
{| class="Command Table"
{| class="wikitable"
! Command
! Command
Line 272: Line 272:
=== CAN Connection Modes ===
=== CAN Connection Modes ===
{| Class = "CAN Connection Commands"
{| Class = "CAN Connection Commands"

Revision as of 18:59, 3 March 2016


The Carberry is designed as a drop in replacement for some dash controls. This page is dedicated to research into making it do more than the pre-designed usage.

Top down view of the Carberry, courtesy of Carberry.it

Hardware Specifications

Wiring Pinout



Position Wire color Description
1 Red +12V Power Supply
2 Black Power Ground
3 Blu/Yellow +12V Ignition Input
4 Black/Orange +12V Ignition Output
5 White General Purpose Input #1
6 Black Signal Ground
7 White/Green General Purpose Input #2
8 Green CAN BUS High Channel #1
9 White CAN BUS Low Channel #1
10 Yellow/Green CAN BUS High Channel #2
11 Yellow/White CAN BUS Low Channel #2
12 Red/Green LIN BUS
13 Blu General Purpose Output #1
14 Blu/Green General Purpose Output #2
15 Pink Resistive Input Channel #1
16 Yellow Resistive Input Channel #2
17 Pink/Black Resistive Output Channel #1
18 Yellow/Black Resistive Output Channel #2
19 Gray GMLAN BUS Channel #1
20 Yellow/Gray GMLAN BUS Channel #2
21 Cyan External UART Output (TXD)
22 Cyan/White External UART Input (RXD)

Credit: http://carberry.it/wiki/start

Raspberry Pi Setup

Setting up the OS

Carberry.it provides multiple versions of the Carbian OS for download at Carberry Downloads. For Raspberry Pi 2 and above you must use the Carbian-Jessie distribution. This page also provides firmware updates, additional Carberry operating systems and Carberry daemons.

If you wish to use your own Raspbian distribution with Carberry Pi's daemons, follow the instructions at the below links.

To install the "Carberry" daemon on Raspbian follow the instructions at Carberry Daemon

To install the Carberry's "Shutdown" Daemon on Raspbian follow the instructions at Shutdown Daemon

To utilize UART with the Carberry, follow the instructions at UART. Raspbian "Jessie" does not have inittab as mentioned in this set of instructions, however, Raspbian "Wheezy" and earlier distributions do.

Connecting the Carberry

If testing functionality without a vehicle, connect your Carberry's +12v Power Supply and +12v Ignition Input (Carberry pins 1 and 3) to a +12v DC power source and Ground (Carberry pin 2) to ground. To use with a vehicle connect your Carberry's +12v Power Supply and +12v Ignition Input (Carberry pins 1 and 3) to a battery (pin 16 on OBD II ports), Ground (Pin 2 on Carberry) to Chassis Ground (Pin 4 on OBD II ports) and Signal Ground (Pin 6 on Carberry) to Signal Ground (Pin 5 on OBD II ports). Connect your Carberry's SWCAN or CAN ports to the applicable OBD II pins.

Updating Carberry Firmware

Communication via Raspberry Pi

Communication via USB

Setup on Windows

The Carberry can communicate with a PC via USB or UART. To use with Microsoft Windows download USB Drivers. Extract the files. Connect your Carberry via MicroUSB to your computer. Once connected, navigate to Device Manager, Ports (COM & LPT) and right click on your device. Select Update Driver Software and click "Browse my computer for driver software." Navigate to the files you previously extracted and click "Okay." Once you click "Next" your drivers should begin installing.
Make note of the COM port assigned to your Carberry for later use in serial communication. Install a suitable terminal application, such as PuTTY.

Connecting via PuTTY

Open PuTTY and choose "Serial" under connection type. Enter the COM port you obtained from your "Device Manager" under Serial Line. Leave the speed at 9600 (the speed should not matter when connected via USB, however, leaving at default presents no issues). Adjust any of the other settings as you please. When ready, press "Open" and your computer should connect to the Carberry. Type in "AT" and push enter. If setup properly, the Carberry should return with an "OK."

Setup on Linux

If Minicom is not installed on your distribution, follow the instructions at Minicom to install it. Linux should not require any additional drivers for communicating with the Carberry via USB. Connect the Carberry via MicroUSB to your computer's USB port. Once connected, open a terminal and "enter dmesg | grep tty" to determine your Carberry's serial port. It should look similar to ttyAMA0.
Plug a micro USB Cable into the Carberry's Micro USB port and the opposing end into your computer.


Using the Carberry

Once connected to your Carberry, send the command AT to test communication with your Carberry. A response of OK indicates all is in working order. If you do not receive a response, double check your baud rate and COM ports. If you do not see your text as you type, send the command ECHO to display your commands as they're typed.

CAN Communication

Set CAN mode

To query the CAN mode enter CAN MODE. You should receive SERIES, PARALLEL or USER as a response.

To set the CAN mode enter CAN MODE <MODE>.

The available CAN Modes are SERIES, PARALLEL and USER. For the free reception of CAN messages, USER mode is recommended.

CAN bus free reception

When in user mode, you can manually open channels to allow for reception and transmission of CAN messages.

To set the CAN mode enter CAN USER OPEN CH<1|2> <500K|250K|125K|100K|95K2|83K3|50K|33K3|AUTO> [GMLAN]

For example, to open channel 1 with baud rate detection:
Please wait for timing result
Baud rate = 250K (250Kbps)

To enable GMLAN (SWCAN) on channel 2 type:

Please wait for timing result
Baud rate = 33k3(33.3Kbps)

Reception filters & masks

To receive CAN frames you must set at least one reception filter and you may also set a reception mask. The default reception mask for the Carberry is 0000:00000, which will accept any message, regardless of the active reception filter.

To set a reception mask enter CAN USER MASK CH<1|2> <MASK>. The mask can use a standard CAN ID of 0000 to FFE0 or an extended CAN ID of 0000:000000-FFFFC0.

For example, to set a mask of FFE0:FFFFC0 on CH1 enter: CAN USER MASK CH1 FFE0:FFFFC0

CAN alignment

Convert (default) left aligned CAN ID to proper ID

The following Ruby code will convert the CAN ID to the correct format (courtesy of Craig Smith):

carb = "carb_var".split(":") x = ((carb[0].hex >> 5) << 18) + (carb[1].hex >> 6) puts x.to_s(16)

Replace the carb_var with the mislabeled CAN ID.

Convert right aligned CAN ID to proper ID

The following Python script will convert a right aligned CAN ID to the correct format:

rightid=input('Enter your right aligned CAN ID XXXX:XXXXXX: ')
sid, eid=(rightid.split(':',2))
sid=int(sid, 16)
eid=int(eid, 16)
print (converted)

GMLAN communication example

Please wait for timing result
. baud rate = 33K3 (33.3 Kbps)
RX1 8000:302000-0180
RX1 8140:282000-0000
RX1 7FE0:F82000
RX1 8140:282000-0000
RX1 7FE0:F82000
RX1 8140:282000-0000
RX1 7FE0:F82000
RX1 8140:282000-0000
RX1 7FE0:F82000
+++ (suspends reception)
ATO (resume reception)
RX1 8000:302000-0180
RX1 8140:282000-0000
RX1 7FE0:F82000
RX1 8140:282000-0000
RX1 7FE0:F82000
RX1 8140:282000-0000
RX1 7FE0:F82000
RX1 8140:282000-0000
RX1 7FE0:F82000

Command Index

Management Commands

Command Expected Response Purpose
AT OK Tests communication with Carberry
ECHO OFF or ON Echo the commands typed by the user
VERSION Version number Display current Carberry firmware and hardware version
REBOOT OK System reboot (only reboots Carberry, not the Pi)
+++ Suspends message reception
ATO Resumes message reception

CAN Connection Modes

Command Expected Response Purpose
CAN MODE Informs the user of the current CAN mode
CAN MODE PARALLEL OK Sets the Carberry's CAN channels into parallel mode
CAN MODE SERIES OK Sets the Carberry's CAN channels into series mode
CAN MODE USER OK Provides the user full control over RX and TX of both CAN channels


Known Issues

Other issues