Hi All,
I have a 10.1" Android Head Unit and it has two wires for steering wheel control. I thought this unit had CAN or CANBUS capabilities but its Key 1 / Key 2 for the steering wheel controls.
How do other units interface the CAN BUS?
What hardware do they use?
Is it standard SLCAN (can over serial) or native can0?
Does can-utils work on other units?
I'm looking at adding the hardware myself if it uses some kind of common hardware.
My car (Mazda 3) and a friends (Volvo XC90) have the steering wheel controls on the CAN bus.
My plan was to code together a canbus to SWC but if I can get native CAN on the device that would be great.
I2C, SPI, USB, Serial... do we know anything about the chips used for decoding the CAN?
I'd really like something and I will do hardware and program code as long as it's not java!
YT9218C_AHD_00005_V004_20190522_HIFI
Android 6.0 kernel 3.18.22
no canbus-V4.7.2-disconnect
A7 1.3GHz x 4
NXP6851
AC7315 45W x 4
1024*600
HW8227L-3.3-SW0-3.1
Thanks for any info,
O.i.D said:
Hi All,
I have a 10.1" Android Head Unit and it has two wires for steering wheel control. I thought this unit had CAN or CANBUS capabilities but its Key 1 / Key 2 for the steering wheel controls.
How do other units interface the CAN BUS?
What hardware do they use?
Is it standard SLCAN (can over serial) or native can0?
Does can-utils work on other units?
I'm looking at adding the hardware myself if it uses some kind of common hardware.
My car (Mazda 3) and a friends (Volvo XC90) have the steering wheel controls on the CAN bus.
My plan was to code together a canbus to SWC but if I can get native CAN on the device that would be great.
I2C, SPI, USB, Serial... do we know anything about the chips used for decoding the CAN?
I'd really like something and I will do hardware and program code as long as it's not java!
YT9218C_AHD_00005_V004_20190522_HIFI
Android 6.0 kernel 3.18.22
no canbus-V4.7.2-disconnect
A7 1.3GHz x 4
NXP6851
AC7315 45W x 4
1024*600
HW8227L-3.3-SW0-3.1
Thanks for any info,
Click to expand...
Click to collapse
Hi, I have same version of software as you. My HU have a "Raise" CAN bus adapter/converter and wires SWC1 and SWC2 on iso audio connector are out, then i suspect it take steering wheel controls orders form canbus.
Canbus adapter are wired on connector [ C ] of head unit, see next draw
[ A ][ B ]
[ C ][D][ E ][ F ]
https://cs5-1.4pda.to/15659740.jpg
https://cs5-1.4pda.to/15659744.jpg
I'm a beginner with canbus, without knowledge about it, but very interested.
---------- Post added at 05:26 PM ---------- Previous post was at 05:10 PM ----------
Here a picture of a similar device and wires.
https://es.aliexpress.com/item/3294...chweb0_0,searchweb201602_1,searchweb201603_52
t3l3m4k0 said:
Hi, I have same version of software as you. My HU have a "Raise" CAN bus adapter/converter and wires SWC1 and SWC2 on iso audio connector are out, then i suspect it take steering wheel controls orders form canbus.
Canbus adapter are wired on connector [ C ] of head unit, see next draw
[ A ][ B ]
[ C ][D][ E ][ F ]
https://cs5-1.4pda.to/15659740.jpg
https://cs5-1.4pda.to/15659744.jpg
I'm a beginner with canbus, without knowledge about it, but very interested.
---------- Post added at 05:26 PM ---------- Previous post was at 05:10 PM ----------
Here a picture of a similar device and wires.
https://es.aliexpress.com/item/3294...chweb0_0,searchweb201602_1,searchweb201603_52
Click to expand...
Click to collapse
Hi!
Thanks for the information! I will check today and see if I have any connection on the CAN pins.
I've been poking about the factory setting and seeing the different cars and in car supported systems. Really interesting.
Hopefully the pins are connected to a can controller.
Regards,
other link with wired canbus decoder wired.
https://es.aliexpress.com/item/32904642849.html?spm=a219c.12057483.0.0.1a531be3TWLwde
On factory settings, there is a option (https://4pda.ru/forum/dl/post/15184101/Screenshot_20190128-030741.png) "Canbus information" that shows some bus messages like this: https://dl.xda-developers.com/4/7/5/1/6/2/7/03.jpg?key=pjd1FmblWQjFmFe11abA6A&ts=1564507515
Thanks for the info. I've been poking around with the oscilloscope and a CAN bus tool but nothing. I'm wondering if it's actually serial transmission instead of can but all the other pins match 100% with my unit.
Are you from Spain, since the links are in Spanish?
Ah... I really want to know how these CAN decoders work! Do they decode the CAN and send as Serial? Or do they filter CAN messages?
Sorry, can't see the last link, Error 401!
I'll go look for more info on these decoders. For now my oscilloscope is showing nothing and the can sniffer is silent!
Thanks!
Ok, looks like I found something.
On the 8 pin connector "C" when I go through the list of "decoder protocols" the message changes as well as the baud rate.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
On the 6 pin connector "E" it looks like it spits out serial data during boot on the "CAN" pins.
The device lists a dev/tty, ttyGS0 to ttyGS7, ttyMT0 to ttyMT4, ttyS0 to ttyS3, ttyp0 to ttypf. So lot's of ports to try.
Yes, I come from Spain.
I suspect my canbox converts canbus signals to serial levels and filter messages.
Probably devices to monitor are ttySX. Have you rooted your device?
This is the previous broken link
https://forum.xda-developers.com/showpost.php?p=79443358&postcount=62
There is no much info about this canbox converters.
https://forum.xda-developers.com/android-auto/mtcd-hardware-development/canbox-versions-t3763383
t3l3m4k0 said:
Yes, I come from Spain.
I suspect my canbox converts canbus signals to serial levels and filter messages.
Probably devices to monitor are ttySX. Have you rooted your device?
This is the previous broken link
https://forum.xda-developers.com/showpost.php?p=79443358&postcount=62
There is no much info about this canbox converters.
https://forum.xda-developers.com/android-auto/mtcd-hardware-development/canbox-versions-t3763383
Click to expand...
Click to collapse
In that case, Hola!
Thanks for the info. I've poked around the threads and have made a post over at https://forum.xda-developers.com/showpost.php?p=79991391&postcount=61. Hopefully they can provide some more details as it looks like they have also been looking into CANBUS-MCU communications.
Today I will try to setup some serial terminals instead of the oscilloscope and logic analyzer to check try and find the ttySx ports.
Status update.
Connector "E" CanL is RX and CanH is TX. TTL 3.3V 912600baud N/8/1. This spits out a long stream of information during boot;
Code:
Some serial data:[HIDE]
RM2 BC] ERROR BCCustomEntry MetaZonebufRead[312]=0
RM2 BC] ERROR BCCustomEntry MetaZonebufRead[313]=0
RM2 BC] ERROR BCCustomEntry MetaZonebufRead[314]=0
RM2 BC] ERROR BCCustomEntry MetaZonebufRead[315]=0
RM2 BC] ERROR BCCustomEntry MetaZonebufRead[316]=0
RM2 BC] ERROR BCCustomEntry MetaZonebufRead[317]=0
RM2 BC] ERROR BCCustomEntry MetaZonebufRead[318]=0
RM2 BC] ERROR BCCustomEntry MetaZonebufRead[319]=0
SS][arm2] DpEngine_COLORonInit
EDS]ARM2: mt65xx_backlight_on
RM2 Dualarm] backcar_dualIsr Start!
RM2 BC] INFO ARM2 Detect Android Ready
RM2 BC] INFO arm1 is ready, close arm2 backcar!
RM2 BC] INFO arm2 notify arm1 arm2 will exit
RM2] Sleep!
[/HIDE]
Code:
Cleaner output:[HIDE][ARM2] ARM2 Cmain enter++
[ARM2 Dualarm] temp_offset = 0x40000 , g_u4Arm2MemoryOffset 0x90000000
[ARM2 Dualarm] g_u4MemorySize 0x40000000
[ARM2] ARM2 get ADDr ++
[ARM2 Dualarm] ARM1PHY2ARM2UCV u4ARM1phyadress: 0x93400000
[ARM2] _pArm2Log: 3400000;_uArm2LogSize 180000
[ARM2] arm2 start time get_timer(0) = 707,TickCount = 0
![ARM2] power mode: 0x82278227
[ARM2] Power mode: normal!Show logo at main loop task
[ARM2 Dualarm] ARM1PHY2ARM2UCV u4ARM1phyadress: 0x90F00000
[MTZ][ARM2] Metazone init success. The dword index 0x10001 value is (22B)
[DSS]disp_path_ddp_clock_on
[DSS]DISI_MODULE_DPI0
[BLS] bls mutex check(0x688)
[BLS] disp_bls_init : srcWidth = 1024, srcHeight = 600
[BLS] disp_bls_init : BLS_EN=0x10000, PWM_DUTY=409, PWM_DUTY_RD=1023, CG=0xFFF00000
[BLS] disp_bls_config_full, width=1024, height=600, reg=0x2580400
[DSS][arm2] DpEngine_COLORonInit
[ARM2] Task num [2]
[ARM2 BC] INFO ARM2 VER is 01-02-01
[ARM2 BC] INFO BackCar_Init +, at TickCount (58)
[ARM2 BC] INFO normal boot
[ARM2 BC] INFO mdp_from_metazone enter
[ARM2 BC] INFO mdp is enable
[ARM2 BC] INFO rotation is 0, video rect is (0,0,1024,600)
[ARM2 BC] INFO mdp_from_metazone exit
[ARM2 BC] INFO before CustomUIInit
[ARM2 BC] INFO using gpio pin: 51
[ARM2 BC] INFO backcar_frame_base:0x93200000, backcar_frame_size:0x200000
[ARM2 Dualarm] ARM1PHY2ARM2UCV u4ARM1phyadress: 0x93200000
[ARM2 BC] INFO video FrameBuf addr is 0x3200000
[ARM2 BC] INFO BackCar_Init -, at TickCount (278)
[ARM2 BC] INFO BCCustomEntry enter, at TickCount (279)
[ARM2 BC] E OR BCCustomEntry MetaZonebufRead[0]=100
[ARM2 BC] ERROR BCCustomEntry MetaZonebufRead[1]=2
[ARM2 BC] ERROR BCCustomEntry MetaZonebufRead[2]=3
[ARM2 BC] ERROR BCCustomEntry MetaZonebufRead[3]=18
[ARM2 BC] ERROR BCCustomEntry MetaZonebufRead[4]=0
[ARM2 BC] ERROR BCCustomEntry MetaZonebufRead[5]=40
[ARM2 BC] ERROR BCCustomEntry MetaZonebufRead[6]=100
[ARM2 BC] ERROR BCCustomEntry MetaZonebufRead[7]=4
[ARM2 BC] ERROR BCCustomEntry MetaZonebufRead[8]=4[/HIDE]
Connector "C" RX(Chinese text then TX) is RX and TX(Chinese text then RX) is TX. TTL 3.3V 38400baud N/8/1. This is where the CANBOX or CANBUS decoder goes.
I have tested with the example command from @JeeBee87 post at https://forum.xda-developers.com/showpost.php?p=69712351&postcount=37;
"For example, to increase the volume (VOL+) the box send 46, 32, 2, 1, 1, -37 (command)"
I'm using realterm to send the serial data so the data is "46 32 2 1 1 219" as realterm doesn't send negative numbers.
I have tested this command with the following "Protocol settings" (I only went down the list of car brand/model until one responded and moved to the next decoder brand);
RAISE, Volkswagen, Toyota, Nissan, Honda, Ford.
BNR, VW.
XBS, VW.
XINPU, VW.
Daojun, Nissan.
Oudi, M Benz.
Ruishengwei, BYD.
HCY, BYD.
Ansheng, BYD.
Anyuan, M Benz.
NFCK, Chery.
CML, Dongfeng. This one didn't increase the volume, it was similar to pressing home or toggle between app's.
Time to start testing commands!
Great to know!!!
For codes i suggest you to take a look at openbcd github.
t3l3m4k0 said:
Great to know!!!
For codes i suggest you to take a look at openbcd github.
Click to expand...
Click to collapse
Sorry, can't seem to find the relevant Git. Do you have any more info on that?
Here is what I've found so far;
Code:
Action DEC HEX
Vol+ 46 32 2 1 1 219 2E 20 02 01 01 DB
Vol- 46 32 2 2 1 218 2E 20 02 02 01 DA
Next 46 32 2 3 1 217 2E 20 02 03 01 D9
Back 46 32 2 4 1 216 2E 20 02 04 01 D8
BT connect 46 32 2 5 1 215 2E 20 02 05 01 D7
Mute/Unmute 46 32 2 6 1 214 2E 20 02 06 01 D6
Home/Switch app 46 32 2 7 1 213 2E 20 02 07 01 D5
Front left door 46 65 2 1 1 186 2E 41 02 01 01 BA
Front right door 46 65 2 1 2 185 2E 41 02 01 02 B9
Rear left door 46 65 2 1 4 183 2E 41 02 01 04 B7
Rear right door 46 65 2 1 8 179 2E 41 02 01 08 B3
Trunk 46 65 2 1 16 171 2E 41 02 01 10 AB
Parking brake 46 65 2 1 32 155 2E 41 02 01 20 9B
Wiper fluid level 46 65 2 1 64 123 2E 41 02 01 40 7B
Seat belt 46 65 2 1 128 59 2E 41 02 01 80 3B
Closes decoder soft? 46 34 1 0 0 220 2E 22 01 00 00 DC
Still trying to decode the messages from the head unit so I can send the messages to the OEM LCD in the car. Missing phone buttons, play/pause, mode....
Would be great to find other commands but even when dumping prepared hex filed this is very slow... :silly:
sorry, i make a mistake
opendbc
https://github.com/commaai/opendbc
I was looking into this for my HU, it seems that a number of people have bought a number of off the shelf SWC decoders $40-120 that either do not work or have limited functionality. It is great you researching this-I hope you success. Apparently CAN-BUS coding is car model specific.
Arduino (or other) with CAN coding specific for your car would be ideal.
Alternatively, Euro cars have simpler coding down Steering column to CAN terminal at base.
i.e.
1-button presses on steering wheel to
2- LIN then send it through the rotating joint
3- receive it as LIN at base box
4- covert it back to button presses
5-send the button presses to the CAN processor to get converted to CAN to be sent on the CAN bus.
So button presses are available in steering wheel, encoded LIN bus, decoded separately at base box, then re-encoded to CANbus
Hope this helps.
One alternate solution if your HU supports IR remote-Ebay has for <$10 a learn-able IR remote control gizmo that attaches to the steering wheel, or could be incorporated inside the steering wheel using existing buttons...
Pxdev said:
I was looking into this for my HU, it seems that a number of people have bought a number of off the shelf SWC decoders $40-120 that either do not work or have limited functionality. It is great you researching this-I hope you success. Apparently CAN-BUS coding is car model specific.
Arduino (or other) with CAN coding specific for your car would be ideal.
Alternatively, Euro cars have simpler coding down Steering column to CAN terminal at base.
i.e.
1-button presses on steering wheel to
2- LIN then send it through the rotating joint
3- receive it as LIN at base box
4- covert it back to button presses
5-send the button presses to the CAN processor to get converted to CAN to be sent on the CAN bus.
So button presses are available in steering wheel, encoded LIN bus, decoded separately at base box, then re-encoded to CANbus
Hope this helps.
Click to expand...
Click to collapse
Pxdev said:
One alternate solution if your HU supports IR remote-Ebay has for <$10 a learn-able IR remote control gizmo that attaches to the steering wheel, or could be incorporated inside the steering wheel using existing buttons...
Click to expand...
Click to collapse
Hi Pxdev,
Thanks for the input and support
For my car (Mazda 3) the steering wheel buttons are resistors/a voltage divider so I was able to connect one end to ground and the other to KEY1.
For my car I am still pushing to get the original car LCD to work as I don't have any clock or trip/consumption information. I have found the commands for the LCD text area and enable the clock.
For my friends car I still need to implement the steering wheels and hopefully other functions. I have found most of the CAN commands.
I'm currently fighting with an MCP2515 and it's weird register filters for the CAN bus. I should have some free time these days to move this forward!
I will then need to learn how to write an app for android again as the last time I made an app was about 8 years ago...
Well,
Now that I have some free time I whipped up Version 1 of the device. Basically it converts the CAN bus codes from the Volvo XC90 steering wheel to SWC for the Android head unit.
I've also added 4 extra outputs to control reverse, brake, illumination and whatever else can be found on the CAN bus.
Now to work on getting my Mazda's original LCD to display at least display the fuel information again. Should be easier as I have access to my car!
O.i.D said:
Well,
Now that I have some free time I whipped up Version 1 of the device. Basically it converts the CAN bus codes from the Volvo XC90 steering wheel to SWC for the Android head unit.
I've also added 4 extra outputs to control reverse, brake, illumination and whatever else can be found on the CAN bus.
Now to work on getting my Mazda's original LCD to display at least display the fuel information again. Should be easier as I have access to my car!
Click to expand...
Click to collapse
Nice & professional job.
I was looking for IDs and only think i was found is the structure message between Canbus Box Converter and MCU
1rst byte: 2E ->start
2nd byte: XX -> request ID
3 byte: NN -> number of data bytes length
4 to NN+3 bytes: DD ... DD -> data of request
NN+4 byte: cheksum from second byte to NN+3 byte complement 2
I'm looking at android apk's but i don't know java and how Android packages structure works
t3l3m4k0 said:
Nice & professional job.
I was looking for IDs and only think i was found is the structure message between Canbus Box Converter and MCU
1rst byte: 2E ->start
2nd byte: XX -> request ID
3 byte: NN -> number of data bytes length
4 to NN+3 bytes: DD ... DD -> data of request
NN+4 byte: cheksum from second byte to NN+3 byte complement 2
I'm looking at android apk's but i don't know java and how Android packages structure works
Click to expand...
Click to collapse
Thanks, it still needs some hot glue to hold everything together from the vibrations but I hope the hardware doesn't need any revisions. Hopefully all upgrades can be run from a laptop.
Looks like the controller you have has a very similar protocol. There are lot's of makers and for different car models the communication protocol varies so I'm glad it's similar to what I found
Good luck with the Java, I need to look into it again soon... but so many things to do...
On the other hand, looks like the Mazda LCD is rather straight forwards! I'll Tidy up the info I have and post it later. Now to make another similar box for my car. :fingers-crossed:
Well, here are the codes needed to control the LCD.
Quite a few more ID's are needed to fill in the data from the car. I ended up using ID's;
0x433 (for Ambient temp),
0x2A0 (for HVAC),
0x285 (car key ignition),
0x400 (Trip computer for fuel consumption and speed).
Below are the the ID's for;
0x28F (LCD control A),
0x290 (LCD control B),
0x291 (LCD control C),
0x2A0 (HVAC control).
Code:
Mazda 3 ID DLC Example data Byte HEX BIN Description
LCD A 28F 8 80 00 00 22 20 00 00 00 B1 80 10000000 b8 must be 1 to enable
[INDENT][INDENT][INDENT] 81 10000001 AF
82 10000010 RDM
84 10000100 RPT
88 10001000 DOLBY
90 10010000 ST
A0 10100000 MD IN
C0 11000000 CD IN
B2 10 00010000 AUTO-M
20 00100000 TP
40 01000000 TA
80 10000000 PTY
B4 01 00000001 Disables ID 0x28F?
02 00000010 "." between character 10 and 11
04 00000100 "." between character 11 and 12
10 00010000 Minutes and seconds symbols
20 00100000 ":" between character 3 and 4
B5 02 00000010 Send 3 times to perform LCD selftest
08 00001000 INFO button, toggle with 0x20
10 00010000 CLOCK button, toggle with 0x20. Wait a few seconds to enter clock settings.
20 00100000 No button press. Must be sent after INFO or CLOCK to resend button press.[/INDENT][/INDENT][/INDENT]
LCD B 290 8 C0 31 32 33 34 35 00 00 B1 C0 11000000 Can be swapped with ID 0x291 0X85
[INDENT][INDENT][INDENT] B2 31 00110001 ASCII HEX character 1 "1"
B3 32 00110010 ASCII HEX character 2 "2"
B4 33 00110011 ASCII HEX character 3 "3"
B5 34 00110100 ASCII HEX character 4 "4"
B6 35 00110101 ASCII HEX character 5 "5"[/INDENT][/INDENT][/INDENT]
LCD C 291 8 85 61 62 63 64 65 66 67 B1 C0 11000000 Can be swapped with ID 0x290 0XC0
[INDENT][INDENT][INDENT] B2 61 01100001 ASCII HEX character 6 "a"
B3 62 01100010 ASCII HEX character 7 "b"
B4 63 01100011 ASCII HEX character 8 "c"
B5 64 01100100 ASCII HEX character 9 "d"
B6 65 01100101 ASCII HEX character 10 "e"
B7 66 01100110 ASCII HEX character 11 "f"
B8 67 01100111 ASCII HEX character 12 "g"[/INDENT][/INDENT][/INDENT]
HVAC 2A0 4 A1 22 83 B0 B1 b8 must be 1 to enable. b0 and b1 cannot be both 1.
[INDENT][INDENT][INDENT] 80 10000000 No temp displayed
81 10000001 HVAC Temp displayed
82 10000010 AMB Temp displayed
84 10000100 A/C+RECTANGLE
88 10001000 ECO
90 10010000 AUTO
A0 10100000 AIR RECIRCULATION
C0 11000000 EXTERIOR AIR CIRCULATION
B2 00-99 Treat as decimal temperature, no HEX allowed, only 0-9
B3 01 00000001 Air to face
02 00000010 Person icon
04 00000100 Air to windshield
08 00001000 1 LSB of decimal temp
10 00010000 2 bit of decimal temp
20 00100000 4 bit of decimal temp
40 01000000 8 MSB of decimal temp
80 10000000 Decimal point
B4 08 00001000 1 Fan icon lvl 0
10 00010000 2 Fan icon lvl 1
20 00100000 4 Fan icon lvl 3
40 01000000 8 Fan icon lvl 7
80 10000000 Air to feet[/INDENT][/INDENT][/INDENT]