From OpenGarages
Revision as of 20:07, 7 March 2016 by Scrambles (talk | contribs) (Hardware Specifications)
Jump to: navigation, search


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





  • Same size printed circuit board as of Raspberry Pi, with proper shaping.
  • Connection to Raspberry via the P1 26 pin GPIO header located on the board.
    • The Raspberry Pi 2 Carberry attaches to the 40 pin RPi 2 GPIO while providing a breakout for the unused pins.
  • 22 pin Microfit connector for vehicle connection.
  • Power supply +12 V and GND from the vehicle.
  • Power supply 5V 1A for Rasperry Pi generated onboard by Carberry.
  • Control of the Raspberry Pi power supply by MOSFET, for the management of low consumption.
  • Logic shutdown signal to Raspberry Pi to perform a controlled shutdown.
    • The Carberry "Shutdown Daemon" tells the Raspberry Pi to begin shutting down when the ignition is switched off.
  • Low power consumption compatible whit automotive standards (< 3mA).
  • Communication to the Raspberry Pi via UART (Pin 15/16 of P1 header).
  • +12V Ignition signal input.
  • +12V Ignition signal output with a 2.5A power mosfet.
  • Two CAN Bus lines for series or parallel connection at vehicle buses.
  • Two GMLAN lines for series or parallel connection at vehicle buses.
  • One LIN Bus
  • Two channels for resistive steering wheel controls, with single key bypass capability.
  • One general purpose UART 5V/3V3.
  • Two general purpose 100mA open collector outputs.
  • Two general purpose inputs (to ground or 5V tolerant).
  • Two general purpose user-programmable LEDs.
  • Microchip PIC32MX microcontroller.
  • Button and two-color LED for can bus profiles learning and reset functions.
  • PWM signal to Raspberry Pi for LIRC management.
  • Infrared remote control emulation for media centers via steering wheel controls.
  • Infrared sensor for 38KHz IR remote controls.
  • Infrared LED for IR codes emission.
  • Ready to Apple MFI program to develop applications under Linux (coprocessor not provided).
  • RTCC to handle date and time with car battery backup.
  • Raspberry Pi wakeup by RTCC at programmed date/time.
  • External EEPROM with a unique identifier to be used for any licenses related to the card.
  • Accelerometer + magnetometer, for anti-theft features, positioning, blackboxes.
  • Raspberry Pi wakeup by accelerometer and magnetometer events.
  • Microusb device connector for a stand-alone operation of the shield or future functionality.
    • The MicroUSB provides a means to communicate directly with the Carberry via a serial terminal, without the need of a Raspberry Pi.

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)


Raspberry Pi Setup

Setting up the OS 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 on your open channel(s) and you may also set a reception mask. A filter combined with a mask can dictate whether you receive one specific frame, or a range of frames. A reception mask dictates which bits of CAN frames must match the CAN filter bits. 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:


All CAN filters are disabled by default, but you may enable up to 32 filters per channel. To set a filter enter CAN USER FILTER CH<1|2> <filter number(0-31)> <FILTER>. The filter can use a standard CAN ID of 0000 to FFE0 or an extended CAN ID of 0000:000000-FFFFC0.

For example, to set a filter of 8040 on CH1 enter:

How filters & masks work together

To understand how masks and filters work together, you must convert them to binary. Masks are simply bitmasks, common to networking or other forms of coding. If you want to receive a range of CAN ID's with only one filter, it is best to convert your requirements to binary and determine which filters/masks to enable. In the table below, any 1 in the mask means the bit in the same position of incoming CAN ID's must match the filter you've set. Any 0 means the condition of the bit in the same position of incoming CAN ID's does not matter.

MASK 07FF 0F00 1000
FILTER 100A 0700 1900
MASK BINARY 0000 0111 1111 1111 0000 1111 0000 0000 0001 0000 0000 0000
FILTER BINARY 0001 0000 0000 1010 0000 0111 0000 0000 0001 1001 0000 0000
RESULTS Any frame matching bits 1 thru 11 Any frame matching bits 9 thru 12 Any frame matching bit 13

CAN Connection Modes

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