Difference between revisions of "Carberry"

From OpenGarages
Jump to: navigation, search
Line 231: Line 231:
 
== API ==
 
== API ==
 
== Known Issues ==
 
== Known Issues ==
=== Incorrect CAN ID ===
 
The Carberry may return incorrect CAN ID's. Using the Carberry's default CAN Bus identifier alignment (left alignment) appends padding bits to the right of the CAN ID, which returns an entirely incorrect CAN ID in hexadecimal. For example, CAN ID 100AA097 will be misrepresented as 8040:A825C0.
 
  
If the Carberry's CAN Bus identifier is set to right alignment, the padding bits are added to the left of the CAN ID. This partially corrects the ID. For example, the CAN ID 100AA097 will be represented as 0402:02'''A097''', a partial match.
+
==== Convert (default) left aligned CAN ID to proper ID ====
 
 
==== Convert left aligned CAN ID to proper ID ====
 
  
 
The following Ruby code will convert the CAN ID to the correct format (courtesy of Craig Smith):
 
The following Ruby code will convert the CAN ID to the correct format (courtesy of Craig Smith):
Line 245: Line 241:
  
 
Replace the carb_var with the mislabeled CAN ID.
 
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: ')<br>
 +
sid, eid=(rightid.split(':',2))<br>
 +
sid=int(sid, 16)<br>
 +
eid=int(eid, 16)<br>
 +
converted=hex(int("{0:b}".format(sid)+"{0:b}".format(eid),2))<br>
 +
print (converted)<br>
 +
  
 
=== Other issues ===
 
=== Other issues ===

Revision as of 18:15, 3 March 2016

Summary

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

Carberrypinout.jpg

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.

[ADDITIONAL INSTRUCTIONS]

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.

GMLAN communication example

AT
OK
ECHO
OK
CAN MODE USER
OK
CAN USER OPEN CH1 AUTO GMLAN
Please wait for timing result
. baud rate = 33K3 (33.3 Kbps)
OK
CAN USER MASK CH1 0000
OK
CAN USER FILTER CH1 0 100A
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

API

Known Issues

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)
converted=hex(int("{0:b}".format(sid)+"{0:b}".format(eid),2))
print (converted)


Other issues