Possible reason for poor battery life - HTC One X

interesting news about improving battery life:
Lee!!!!
Ive found out where the missing power management options has gone wrong
For some reason HTC misplaced the .apk and put it in /system/bin instead of system/app
You will find it /system/bin/NvCPLSvc.apk and it needs moving to system/app.
For users who already have LeeDroiD installed, use a file manager with root access and move NvCPLSvc.apk from/system/bin to system/app and reboot.
Click to expand...
Click to collapse
LeeDroid said:
No fekkin way! I was just looking into the contents of that apk whilst decompiling a ton of others... I did wonder.. lmao! :-D
@HTC Epic Fail!
Certainly some interesting caps/config
Code:
# static fields
.field private static final TAG:Ljava/lang/String; = "NvPowerMgr"
.field private static final fpsLimitName:Ljava/lang/String; = "NV_FPSLIMIT"
.field private static final mAggressiveness:Ljava/lang/String; = "/sys/devices/tegradc.0/smartdimmer/aggressiveness"
.field private static final mAggressiveness_Balanced:I = 0x1d
.field private static final mAggressiveness_FullPerf:I = 0x18
.field private static final mCPU_User_Cap:Ljava/lang/String; = "/sys/module/cpu_tegra/parameters/cpu_user_cap"
.field private static final mCapLevel_Balanced:I = 0x4b0
.field private static final mCapLevel_FullPerf:I = 0x514
.field private static final mCapState_Balanced:I = 0x1
.field private static final mCapState_FullPerf:I = 0x0
.field private static final mCore_Cap_Level:Ljava/lang/String; = "/sys/kernel/tegra_cap/core_cap_level"
.field private static final mCore_Cap_State:Ljava/lang/String; = "/sys/kernel/tegra_cap/core_cap_state"
.field private static final mEnable_3D_Scaling:Ljava/lang/String; = "/sys/devices/host1x.0/gr3d/enable_3d_scaling"
.field private static final mMaxBoost:Ljava/lang/String; = "/sys/devices/system/cpu/cpufreq/interactive/max_boost"
.field private static final mMaxBoost_Balanced:I = 0x3d090
.field private static final mMaxBoost_FullPerf:I = 0x0
.field private static final mMaxSpeedLoad:Ljava/lang/String; = "/sys/devices/system/cpu/cpufreq/interactive/go_maxspeed_load"
.field private static final mMaxSpeedLoad_Balanced:I = 0x5f
.field private static final mMaxSpeedLoad_FullPerf:I = 0x55
.field private static final mScaling_Balanced:I = 0x1
.field private static final mScaling_FullPerf:I = 0x0
.field private static final mUserCap_Balanced:I = 0x124f80
.field private static final mUserCap_FullPerf:I = 0x0
.field private static final sysfsFileName:Ljava/lang/String; = "NV_SYSFSFN"
.field private static final sysfsName:Ljava/lang/String; = "NV_SYSFSWRITE"
.field private static final sysfsValueName:Ljava/lang/String; = "NV_SYSFSVALUE"
Click to expand...
Click to collapse

Nice! Can we just install that apk?
Sent from my HTC One X using XDA

na u need root access

Gold stuff man. We should messagge htc and tell them to change it
Sent From My HTC sensation (desire with rcmix s )

Related

Need java help

I have to make the program to where it outputs "You were born on (DD-MM-YYYY, these are the user inputs).
I have everything besides that..can anyone help?
Code:
import java.util.Scanner;
//This program does math
public class Final
{
public static void main(String []args)
{
Scanner in=new Scanner(System.in);
System.out.println("One last test");
System.out.print("Enter your birthday (mm/dd/yyyy): ");
String roar=in.nextLine();
int n1=Integer.parseInt(roar);
String date;
String month, day, year;
String ox=in.nextLine();
String[] s = ox.split("/");
for( String str : s);
System.out.println("You were born on"+day+month+year);
}
}
That is what i have so far, but i need to declare the day, month and year..can anyone help me?
Bump..need help please.
backdown said:
I have to make the program to where it outputs "You were born on (DD-MM-YYYY, these are the user inputs).
I have everything besides that..can anyone help?
Code:
import java.util.Scanner;
//This program does math
public class Final
{
public static void main(String []args)
{
Scanner in=new Scanner(System.in);
System.out.println("One last test");
System.out.print("Enter your birthday (mm/dd/yyyy): ");
String roar=in.nextLine();
int n1=Integer.parseInt(roar);
String date;
String month, day, year;
String ox=in.nextLine();
String[] s = ox.split("/");
for( String str : s);
System.out.println("You were born on"+day+month+year);
}
}
That is what i have so far, but i need to declare the day, month and year..can anyone help me?
Click to expand...
Click to collapse
On running your program it shows that you're Strings date, month, day, and year are not initialized. I'm not 100% as I never got far into java, but you should initialize them
Code:
String string = null;
String string = 0;)
once they are initialized it gives another error, basically that you're birthday input of mm/dd/yyyy isn't in the proper format to be an integer. I do not know how to fix that one. My knowledge of java is very basic but I have a feeling that should help you out somewhat.
An easier alternative to what you are trying to accomplish would be to ask the month day and year in separate prompts and assign them to plain integers.
I have a feeling you are doing this for a college class perhaps? I had to do one similar to this thats why I ask.
On another note, you might have better luck finding the help you need on a site that is more geared towards java programming (maybe stack overflow?)
I hope this helps.
Yes, it is my college class.
so far i got this :
Code:
import java.util.Scanner;
//This program does math
public class Final
{
public static void main(String []args)
{
Scanner in=new Scanner(System.in);
System.out.println("One last test");
System.out.print("Enter your birthday (mm/dd/yyyy): ");
String roar=in.nextLine();
int n1= roar;
String date;
String month, day, year;
String ox=in.nextLine();
String[] s = ox.split("/");
System.out.println("You were born on"+s[0]+s[1]+s[2]);
String str;
}
}

[Q] ListBox Binding Error with Observable Collection

Hi all!
Since days I have a problem now. I have an app that manage Entries in a list A. If one of these entries End-Date is today I whant that entry to be shown in a second list B. This is checked when I return from the "addNewItem" Window so I use onNavigatedTo.
Code:
// Static Variables
public static ObservableCollection<Item> lstToday = new ObservableCollection<Item>();
public static ObservableCollection<Item> lstWeek = new ObservableCollection<Item>();
public static ObservableCollection<Item> lstAll = new ObservableCollection<Item>();
// Constructor
public MainPage()
{
InitializeComponent();
MessageBox.Show("Initialize Component");
lbToday.ItemsSource = lstToday;
lbWeek.ItemsSource = lstWeek;
lbAll.ItemsSource = lstAll;
}
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
DateTime currentDate = DateTime.Now;
foreach (Item item in lstAll)
{
if (item.endDate.ToString("yyyy'-'MM'-'dd").Equals(currentDate.ToString("yyyy'-'MM'-'dd")))
{
lstToday.Add(item);
MessageBox.Show("Item '" + item.name + "' added to Todaylist");
}
}
}
private void appBarNew_Click(object sender, EventArgs e)
{
NavigationService.Navigate(new Uri(string.Format("/EditAddItem.xaml"), UriKind.Relative));
}
After that I get an "System.Diagnostics.Debugger.Break();" error that doesn't occur when I delete "lbToday.ItemsSource = lstToday;" to avoid the ListBox Binding.
With lbAll ist runs without any problems!
Can I bind the Listbox direct to the ObservableCollection in XAML=
I really don't know, whats to do. So do you?
It would make my day!
Thanks!
What is the exception message and stack trace when the exception is thrown? (you can browse the properties of the exception using visual studio).
Your code actually works for me (although I had to make some assumptions about what is in lstAll as you don't mention that, and you may have an error in the DataTemplate for the listbox for binding your Item class)
Things to try:
Have you tried it with non static observable collections?
Use binding assignments in the xaml rather than setting the itemssource directly (e.g. using a viewmodel). Then you can let the phone engine worry about when to do the assigments. If you do that don't forget to set the page's datacontext property.
Try it with simple collections of strings first (rather than binding an 'item' class) so you can check it's working without a datatemplate.
Hope you fix it.
Ian

[Q] FLAC

Since we have the ICS source can anyone think of the least invasive way to add a mod for it for the stock rom.
(Strange that flac files are associated with the stock media player).
Thinking about just taking the flac patch (or perhaps there is two) putting it into AOSP 2.3.4 and then trying replacing the whole stagefright. Is there a better way to do it. (Its certainly possible now but there may be all sorts of reasons why this may be a bad idea.)
I want to change as little as possible.
(Any proof that its impossible also accepted).
** Edit
Works in Simulator
The diff is attached - need to take external/flac from an ICS checkout.
Think all that is necessary now is to just increment 2 numbers in the framework.
(Maybe another 2 if we want it to work with mtp (And Windows Media Player sync).
Code:
--- a/media/java/android/media/MediaFile.java
+++ b/media/java/android/media/MediaFile.java
@@ -46,8 +46,9 @@ public class MediaFile {
public static final int FILE_TYPE_OGG = 7;
public static final int FILE_TYPE_AAC = 8;
public static final int FILE_TYPE_MKA = 9;
+ public static final int FILE_TYPE_FLAC = 10;
private static final int FIRST_AUDIO_FILE_TYPE = FILE_TYPE_MP3;
- private static final int LAST_AUDIO_FILE_TYPE = FILE_TYPE_MKA;
+ private static final int LAST_AUDIO_FILE_TYPE = FILE_TYPE_FLAC;
// MIDI file types
public static final int FILE_TYPE_MID = 11;
@@ -99,8 +100,7 @@ public class MediaFile {
public static final int FILE_TYPE_MS_WORD = 104;
public static final int FILE_TYPE_MS_EXCEL = 105;
public static final int FILE_TYPE_MS_POWERPOINT = 106;
- public static final int FILE_TYPE_FLAC = 107;
- public static final int FILE_TYPE_ZIP = 108;
+ public static final int FILE_TYPE_ZIP = 107;
static class MediaFileType {
diff --git a/media/java/android/mtp/MtpDatabase.java b/media/java/android/mtp/MtpDatabase.java
index a595562..98de2f7 100644
--- a/media/java/android/mtp/MtpDatabase.java
+++ b/media/java/android/mtp/MtpDatabase.java
@@ -309,6 +309,7 @@ public class MtpDatabase {
MtpConstants.FORMAT_M3U_PLAYLIST,
MtpConstants.FORMAT_PLS_PLAYLIST,
MtpConstants.FORMAT_XML_DOCUMENT,
+ MtpConstants.FORMAT_FLAC,
};
}
Seems to work with the simulator. (Haven't done the MTP part as I am not that bothered about it).
Anyone can help patch the framework for the 62 rom I would be grateful.
(Even better explain how to do it).
This is just a stop gap measure until we get ICS.
(I would have thought anyone who uses baksmali for framework modding etc could do this really easily.)
You have posted this in the wrong section :-\
Sent from my R800x using Tapatalk
f9f223edb408cdc9fd946dc099a86857079a639f commit to frameworks base
I don't understand why flac is associated with the media player though at all. (Poor backport for the MTP support ?)
(I will start tomorrow unless someone can explain why what I intend is going to break a feature).
re wrong forum doesn't make sense its blatantly a development question
sonicfreak360 said:
You have posted this in the wrong section :-\
Sent from my R800x using Tapatalk
Click to expand...
Click to collapse
He's talking about a way to dev ICS to work on our phones...how is this in the wrong section?
Sent from my R800i using Tapatalk
Clienterror said:
He's talking about a way to dev ICS to work on our phones...how is this in the wrong section?
Sent from my R800i using Tapatalk
Click to expand...
Click to collapse
Because it is a question, regardless.
Sent from my R800x using Tapatalk
Given that there are no 2.3.4 AOSP builds working, wouldn't it be easier to patch the CM7 builds? That way you won't have to create and run the whole build yourself.

How to correctly add additional Camcorder profiles in sources?

Hi all. There is a one question to developers and for those, who know Android at well. I'm need to add some additional camcorder profile for Mediatek based devices in CamcorderProfile class (frameworks/base/media/java/android/media/CamcorderProfile.java). Something like this:
Code:
public static final int QUALITY_LOW = 108;
public static final int QUALITY_MEDIUM = 109;
public static final int QUALITY_HIGH = 110;
public static final int QUALITY_FINE = 111;
public static final int QUALITY_NIGHT_LOW = 112;
public static final int QUALITY_NIGHT_MEDIUM = 113;
public static final int QUALITY_NIGHT_HIGH = 114;
public static final int QUALITY_NIGHT_FINE = 115;
public static final int QUALITY_LIVE_EFFECT = 116;
public static final int QUALITY_H264_HIGH = 117;
public static final int QUALITY_FINE_4K2K = 123;
public static final int SLOW_MOTION_VGA_120FPS = 2231;
public static final int SLOW_MOTION_HD_60FPS = 2240;
public static final int SLOW_MOTION_HD_120FPS = 2241;
public static final int SLOW_MOTION_HD_180FPS = 2242;
public static final int SLOW_MOTION_HD_240FPS = 2243;
public static final int SLOW_MOTION_FHD_60FPS = 2250;
public static final int SLOW_MOTION_FHD_120FPS = 2251;
public static final int SLOW_MOTION_FHD_240FPS = 2252;
But this is an API modification And when I try to build firmware i get message about inadmissibility of API editing. Does anybody knows how to add this profiles to Camcorder class correctly and build the ROM?

CANBOX , CAN decoder reverse engineering

Hi All,
I have a PX5 radio that was supplied with fittings for 2006 Toyota RAV4 , sadly it didnt come with a CANBOX and supplier was not able to provide one that matched, I managed to get my hands on a Canbox for VW unit and decided to reverse engineer the unit.
Here are my findings.
Code:
Pinouts
1--2--3--4--5--6--7--8
9--10-11-12-13-14-15-16
1 GND 9 B+
2 CANH 10 CANL
3 EMPTY 11 ACC
4 EMPTY 12 EMPTY
5 EMPTY 13 EMPTY
6 EMPTY 14 EMPTY
7 MCU_RXD_CAN 15 EMPTY
8 EMPTY 16 MCU_TXD_CAN
On power up the device sends a hex packet to TX Uart of the board (RX of the head unit) at 38400 baud,
the packet is as follows
Code:
0x0,
0x2E,0x21,0x5,0x0,0x10,0x0,0x0,0x0,0xC9
0x2E,0x21,0x5,0x0,0x10,0x0,0x0,0x0,0xC9,
0x2E0x21,0x5,0x0,0x10,0x0,0x0,0x0,0xC9,
0x2E,0x21,0x5,0x0,0x10,0x0,0x0,0x0,0xC9,
0x2E,0x22,0x4,0x1,0x1,0x1,0x1,0xD5,
0x2E,0x22,0x4,0x1,0x10x1,0x1,0xD5,
0x2E,0x22,0x4,0x1,0x1,0x1,0x1,0xD5,
0x2E,0x22,0x4,0xFE,0x2,0x1,0x1,0xD5,
0x2E,0x23,0x4,0x1,0x1,0x1,0x1,0xD4,
0x2E,0x23,0x4,0x1,0x1,0x1,0x1,0xD4,
0x2E,0x23,0x4,0x1,0x1,0x1,0x1,0xD4,
0x2E,0x23,0x4,0x1,0x1,0x1,0x1,0xFF,0xFF
Raw Packet
Code:
02E215010000C92E215010000C92E215010000C92E215010000C92E2241111D52E2241111D52E2241111D52E2241111D52E2341111D42E2341111D42E2341111D42E2341111D4FF
packet burst start with 0x0 then each packet start with 0x2e
My Assumption is the box acts as a translator converting each car specific CANBUS/KKL/KLINE/IR-bus protocol into a
pre-defined packet of information that it transmits to the headunit.
if this is confirmed then creating a open source version of the box should be easy within the ease of the cars can system ,
it may also open cars that dont have can bus to still use the canbus system of headunit, eg reading speed to adjust volume , monitor door open to display on screen using arduino.
If anyone has seen a lookup chart or information on the CANBOX/Decoders protocol to/from the headunit I would love the link.
next i will hookup to the headunit itself and send the same codes to see what effect they have.
darkspr1te
p.s if anyone knows of a firmware bin for canbus box then please let me know.
*EDIT 30/01/2023*
This is the raise/hiworld/simple soft 20 pin pin-out I am seeing now.
Below is a toyota model that has AVC LAN
confirm against Simplesoft RP5-TY-001
Code:
1: Batt 2: GND
3: AVC - 4: AVC LAN +
5: REVERSE OUT To HeadUnit 6: ILL-OUT to HeadtUnit
7: REV CAM Power 8: Park Signal IN
9: IGN In 10: ACC in
11: CAN-L to Car 12: CAN-H to Car
13: NC (model feature) 14: H/Unit RX Can data (3.3v)
15: H/Unit TX Can data (3.3v) 16:NC (model Feature)
17:Amp In Signal 18: SWC1
19: SWC2 20: SWC3
darkspr1te
Some reference information
Kia CANBOX pinouts
canbox scematic and versions XDA-post
canbus protocol headunit
darkspr1te
Found on another page, posted here for info ,
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 46 32 2 6 1 214 2E 20 02 06 01 D6
Home 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 ? 46 34 1 0 0 220 2E 22 01 00 00 DC
Code:
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
Thanks. That is very interesting. I subscribed the topic. In my case I have a problem with my can decoder regarding the panel lights. It is correctly switch on if I manually switch on the headlights, but it doesn't come on if the headlights are in "Automatic" mode. Probably the CAN message in this case is different and is not correctly decoded by the box.
Inviato dal mio SM-N960F utilizzando Tapatalk
darkspr1te said:
Found on another page, posted here for info ,
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 46 32 2 6 1 214 2E 20 02 06 01 D6
Home 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 ? 46 34 1 0 0 220 2E 22 01 00 00 DC
Code:
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
Click to expand...
Click to collapse
probably this post could help you... it gives some usefull codes, including a sort of CAN Bus monitoring:
https://forum.xda-developers.com/showpost.php?p=71455277&postcount=11
royalhawk2002 said:
Thanks. That is very interesting. I subscribed the topic. In my case I have a problem with my can decoder regarding the panel lights. It is correctly switch on if I manually switch on the headlights, but it doesn't come on if the headlights are in "Automatic" mode. Probably the CAN message in this case is different and is not correctly decoded by the box.
Inviato dal mio SM-N960F utilizzando Tapatalk
Click to expand...
Click to collapse
Yes, the can ID or $ID in short hand is different for light, auto lights on and dial light turned on. i have fallen pray to this with my RAV4 auto lights, like why my display is dim "oh i put a book on top of the sensor on the dash" , but I chased other bugs before that one became more obvious.
royalhawk2002 said:
probably this post could help you... it gives some usefull codes, including a sort of CAN Bus monitoring:
https://forum.xda-developers.com/showpost.php?p=71455277&postcount=11
Click to expand...
Click to collapse
Thanks, I had come across that one and apart from the logcan function most of the other stuff is not valid in this application.
I intend to aim primarily at the protocol between Head unit and CANBOX, not CANBOX to car (as i'am sort of covering that elsewhere) , the CANBOX to car part is one hell of a rabbit hole to go down , not only are varied high level terms thrown around incorrectly or misunderstood in a lot of articles but as soon as the document gets to a level of understanding the information drains off as the commercial applications come forward, imagine cartoon authors eye's turn to ($) ($).
Thats why you dont see much in the way of good open source OBD stuff thats not tied into a specific hardware circle or device type.
J2435 is sort of opening that up but in a poor way, they hiding the CAR part behind a device again so again we dont know what the device is saying to the car.
This is why i wont be really covering much on the car side but more in how we can replicate the canbox functions first of all.
I already have a POC that talks to a ELM327 device via wifi or BT, only the programming the esp2866 lacks full understanding of the car as i have JDM cars, not only is JDM protocols different from euro/US counterparts but the also have sub -divided protocols where a euro/us function will work on 2006-2007 model but not 2008-current, who knows why but that is the way of it.
I also do have some additional information on the protocol that i've have to digest, the last bytes are CRC8 EDIT:twos compliment crc see below, i've confirmed that, so we can calc on fly or use look up table for speed, I also have seen this protocol in my research before into another subject but i cannot place it yet, the $2e start byte is the giveaway and followed by function High byte and low bytes and then data and finally crc, Maybe i'll remember it before someone else does, but we have the base part of the protocol and i already have a POC code that is usable on many devices due to being arduino in nature(just not arduino ide but thats a coders choice),
Now as we already have a schematic floating around with full BOM we could in theory make our own canbox but when checking I found it's based on STM8 which is a older chip and I'am personally more familiar with STM32F series and atmega, sam4c etc so i may re-produce the board using that. Also all of my current in stock hardware that has canbus is all stm32f.
Now some of you might have spotted my glaring mistake, I want the code the to work on anything but i'am building it using stm, well thats only due to the fact i have a quite a few stm's to sacrifice , once i know the code works (HU to canbox & canbox to car) then i can introduce other brands of MCU once i have a validated test bench. What will vary device to device is how you Initiate the CAN, with stm32 chips they have bXcan drivers in f103 chips, for atmega we can use spi based canbus driver chips. Supporting those two functions will be enough to pull in esp/atmega/LT and many other chip makers should someone want to port to their fav brand of chip.
I would also like to support non-obd cars , sensing door open is not that hard and a simple arduino+level converter you can sense doors, speed and more. there's also a few after market steering wheels that have vol dials as wheel as custom car builder wanting to use a wheel from brand A on brand B , who am i to judge where you got your real Lotus F1 wheel from.
Now we do have to cover one subject thats often missed in these discussions, OBD and all it's cousins was ment as Diagnostic first, which means not all cars are happy having a dongle full time on the OBD port, I've seen cummings based vehicles refuse to start unless the OBD is unplugged first, that means the dongle is introducing noise on to the bus, be it in the form of legit data request, eronus data or real electrical noise from not having the BUS resistor .
edit: while trying to solve this "ive seen this before" problem I did find this, very similar,
https://www.peak-system.com/produktcd/Pdf/English/PCAN-LIN_ProtDef_eng.pdf
darkspr1te
My head unit isudar h53 also has can box. The car can H and can L connect directly to the box. Between the box and radio there are can rx and can tx. If I go to car choise menu to select car type, after that the unit update the mcu firmware. When this update is done whether the can box is also updated via can rx and can tx lines?
Normally the can rx and can tx signal translated via can chip eg.: tja1050 to can H and can L. If nothing else is in the can box it is not need to update. But the box include ignition ac signal and fix voltage. Because this reason maybe there are much more component in the box than a single can chip.
So my question is if I want to modify one of the can message, enough the head unit update or need to the can box also?
CRC sorted
Ok, so i've sorted the crc out, I can now calc the crc correctly based on this :-
Code:
uint8_t data_packet[] ={0x41,0x2,0x01,0x80};
uint8_t crc_mod(uint8_t car_array[],int datasize)
{
int checksum=0;
for (int i = 0; i < datasize; i++)
{
checksum = (checksum + car_array[i]) & 0xFF;
}
return (256 - checksum & 0xFF)-1;
}
void main()
{
uint8_t data_crc=crc_mod(data_packet,sizeof(data_packet));
Serial.print(data_crc,HEX);
}
and of course the final packet array will be :-
0x2E,0x41,0x02,0x01,0x80,0x3B
or
START_BYTE,PKT_BODY,sizeof(MIN_DATA_SIZE),FILLER_BYTE,SEAT_BELT,crc_mod(PKT_BODY,sizeof(MIN_DATA_SIZE),FILLER_BYTE,SEAT_BELT)
would make up a full packet,
As for the actual data packet i've broken it down to :-
Code:
#define START_BYTE 0x2e
#define MIN_DATA_SIZE 0x2
#define FILLER_BYTE
//buttons
#define PKT_BUTTON 0x20
#define HU_VOLUME_UP 0x1
#define HU_VOLUME_DOWN 0x2
#define HU_NEXT 0x3
#define HU_BACK 0x4
#define HU_BT_ON 0x5
#define HU_MUTE 0x6
#define HU_HOME 0x7
//body functions -
#define PKT_BODY 0x41
#define FL_DOOR 0x1
#define FR_DOOR 0x2
#define RL_DOOR 0x4
#define RR_DOOR 0x8
#define BOOT_DOOR 0x10
#define PARK_BRAKE 0x20
#define WIPER_FLUID 0x40
#define SEAT_BELT 0x80
I'am going to assume there are different packet ID's other than 0x20 and 0x41 out there eg AC, windows , lights see next post, Also i've not optimized the packet structure or definitions and i've not pasted all the body definitions i've found, some are unconfirmed or contradicting.
I'am going to tidy up the code so i can share it and hope it will make more sense once i've removed all my test rubbish but I initially have the arduino acting on packets from the device (CANBOX) and I can now build a packet with crc being calculated runtime, have not tested what happens when i send to the box yet as my setup is very , ahem, primitive due to desk space limitations and my current setup includes :-
1x canbox
3xstm32 blackpills (one is acting as HU, one is acting as CAR CAN and one ties uarts together)
1x rigol ds1054z scope
anyway, more to come.
darkspr1te
Ok,so in the prior post we spoke about the basic packet so far,
but in my first post I pasted some data from my box
Code:
0x2E,0x21,0x5,0x0,0x10,0x0,0x0,0x0,0xC9
0x2E,0x21,0x5,0x0,0x10,0x0,0x0,0x0,0xC9,
0x2E,0x22,0x4,0x1,0x1,0x1,0x1,0xD5,
0x2E,0x22,0x4,0xFE,0x2,0x1,0x1,0xD5,
0x2E,0x23,0x4,0x1,0x1,0x1,0x1,0xD4,
0x2E,0x23,0x4,0x1,0x1,0x1,0x1,0xFF,0xFF
So we also know that packet size can change , maybe this is the difference between brands (RAISE is a common one i see and mine has that written on PCB) , I dont have the box for my unit but I have seen a image of it around, i'll try to post it on the CANBOX Types post and then refer here.
I also see a lot of duplicate transmissions too so next step is to listen to the device while connected to a real HU to sniff for packet OK response, again that is a assumption on my side.
darkspr1te
MCTCoreServices
So I've found the sources that document the protocol between CANBOX and HeadUnit for some CANBOX models,
Code:
public class CanBoxProtocol
{
private final static String TAG = "CanBoxProtocol";
private boolean mIsValidProtocol = false;
private int mLengthFlag = 0x1;//0 = 长度在前,1 = 长度在后
private int mHeadLength = 0x00;//Head长度
private int[] mHeadTag = new int[]{0xFF,0xFF,0xFF};//协议头,不够补0xFF
private int[] mBaudRate = new int[]{0x00,0x00,0x00,0x00};//波特率
private int mChecksumAddLength = 0x1;//0 checksum计算不需要包含length;1 需要包含length
private int mChecksumAddCmd = 0x1;//0 checksum计算不需要包含cmd;1 需要包含cmd
private int mChecksumMode = 0x1;//0 &0xFF; 1 ^0xFF
private int mChecksumExtern = 0x0;//0 checksum不需要-1;1 不需要
private int mNeedAck = 0x1;//是否需要ACK
private int mOkAck = 0xFF;//成功ACK
private int mFailedAck = 0xF0;//失败ACK
private int mCheckSumLength = 0x01;//CheckSum长度
private int mDataLengthMode = 0x00;//0 Data部分的长度;1 除协议头以外所有的数据长度
public CanBoxProtocol(int canBoxType,int carModel)
{
updateCanBoxType(canBoxType,carModel);
}
public void updateCanBoxType(int canBoxType,int carModel)
{
Log.i(TAG, "updateCanBoxType:"+canBoxType+",carModel:"+carModel);
switch(canBoxType)
{
case CarModelDefine.CAN_BOX_RZC:
{
//睿智诚标志雪铁龙车系协议格式要单独处理
if(carModel >= 250 && carModel <= 299)
{
mLengthFlag = 0x00;
mHeadTag[0] = 0xFD;
mHeadTag[1] = 0xFF;
mHeadTag[2] = 0xFF;
mHeadLength = 0x01;
mBaudRate[0] = 0x00;
mBaudRate[1] = 0x00;
mBaudRate[2] = 0x4B;
mBaudRate[3] = 0x00;
mChecksumAddLength = 0x01;
mChecksumAddCmd = 0x01;
mChecksumMode = 0x00;
mChecksumExtern = 0x00;
mNeedAck = 0x00;
mOkAck = 0xFF;
mFailedAck = 0xFF;
mIsValidProtocol = true;
mCheckSumLength = 0x01;
mDataLengthMode = 0x01;
}
else if(carModel >= 300 && carModel <= 349)
{
mLengthFlag = 0x00;
mHeadTag[0] = 0xFD;
mHeadTag[1] = 0xFF;
mHeadTag[2] = 0xFF;
mHeadLength = 0x01;
mBaudRate[0] = 0x00;
mBaudRate[1] = 0x00;
mBaudRate[2] = 0x4B;
mBaudRate[3] = 0x00;
mChecksumAddLength = 0x01;
mChecksumAddCmd = 0x01;
mChecksumMode = 0x00;
mChecksumExtern = 0x00;
mNeedAck = 0x00;
mOkAck = 0xFF;
mFailedAck = 0xFF;
mIsValidProtocol = true;
mCheckSumLength = 0x02;
mDataLengthMode = 0x01;
}
else
{
mLengthFlag = 0x01;
mHeadTag[0] = 0x2E;
mHeadTag[1] = 0xFF;
mHeadTag[2] = 0xFF;
mHeadLength = 0x01;
mBaudRate[0] = 0x00;
mBaudRate[1] = 0x00;
mBaudRate[2] = 0x96;
mBaudRate[3] = 0x00;
mChecksumAddLength = 0x01;
mChecksumAddCmd = 0x01;
mChecksumMode = 0x01;
mChecksumExtern = 0x00;
mNeedAck = 0x01;
mOkAck = 0xFF;
mFailedAck = 0xF0;
mIsValidProtocol = true;
mCheckSumLength = 0x01;
mDataLengthMode = 0x00;
}
}
break;
case CarModelDefine.CAN_BOX_SS:
mLengthFlag = 0x00;
mHeadTag[0] = 0xAA;
mHeadTag[1] = 0x55;
mHeadTag[2] = 0xFF;
mHeadLength = 0x02;
mBaudRate[0] = 0x00;
mBaudRate[1] = 0x00;
mBaudRate[2] = 0x96;
mBaudRate[3] = 0x00;
mChecksumAddLength = 0x01;
mChecksumAddCmd = 0x01;
mChecksumMode = 0x00;
mChecksumExtern = 0x01;
mNeedAck = 0x00;
mOkAck = 0xFF;
mFailedAck = 0xFF;
mIsValidProtocol = true;
mCheckSumLength = 0x01;
mDataLengthMode = 0x00;
break;
case CarModelDefine.CAN_BOX_XP:
mLengthFlag = 0x01;
mHeadTag[0] = 0x2E;
mHeadTag[1] = 0xFF;
mHeadTag[2] = 0xFF;
mHeadLength = 0x01;
mBaudRate[0] = 0x00;
mBaudRate[1] = 0x00;
mBaudRate[2] = 0x96;
mBaudRate[3] = 0x00;
mChecksumAddLength = 0x01;
mChecksumAddCmd = 0x01;
mChecksumMode = 0x01;
mChecksumExtern = 0x00;
mNeedAck = 0x01;
mOkAck = 0xFF;
mFailedAck = 0xF0;
mIsValidProtocol = true;
mCheckSumLength = 0x01;
mDataLengthMode = 0x00;
break;
default:
Log.e(TAG, "not support this can box type");
break;
}
}
and then theres the commands
Code:
//CanBox->HU
public static final int CH_CMD_STEERING_WHEEL_KEY = 0x20;
public static final int CH_CMD_TRIP_PER_MINUTE_INFO = 0x21;//每分钟油耗
public static final int CH_CMD_INSTANT_TRIP_INFO = 0x22;//瞬时油耗
public static final int CH_CMD_HISTORY_TRIP_INFO = 0x23;//历史油耗
public static final int CH_CMD_BASE_INFO = 0x24;
public static final int CH_CMD_TPMS_INFO = 0x25;
public static final int CH_CMD_VEHICLE_SETTING = 0x26;
public static final int CH_CMD_TRIP_BEFORE_15_MINUTE = 0x27;//过去15分钟每分钟油耗
public static final int CH_CMD_AIR_CONDITION_INFO = 0x28;//空调信息
public static final int CH_CMD_STEERING_WHEEL_ANGLE = 0x29;//方向盘转角信息
public static final int CH_CMD_PROTOCOL_VERSION_INFO = 0x30;//协议版本信息
public static final int CH_CMD_AMPLIFIER_STATUS_INFO = 0x31;//攻放信息
public static final int CH_CMD_SYSTEM_INFO = 0x32;//系统信息
public static final int CH_CMD_OIL_ELEC_MIXED_INFO = 0x1F;//油电混合指示
public static final int CH_CMD_REAR_RADAR_INFO = 0x1E;//后雷达
public static final int CH_CMD_FRONT_RADAR_INFO = 0x1D;//前雷达
public static final int CH_CMD_VEHICLE_SET_STATUS_INFO = 0x50;//车辆设置状态
public static final int CH_CMD_AC_PANEL_KEY_INFO = 0x51;//空调面板设置信息(皇冠)
public static final int CH_CMD_VECHILE_SET_RETURN_INFO= 0x52;//车辆设置返回信息(皇冠、汉兰达)
public static final int CH_CMD_AIR_CONDITION_INFO2 = 0x58;//车型空调信息(皇冠)
//HU->CanBox
public static final int HC_CMD_SWITCH = 0x81;
public static final int HC_CMD_VEHICLE_SET = 0x83;//车身中控设定命令
public static final int HC_CMD_COMMON_SET = 0x84;//设定命令
public static final int HC_CMD_REQ_CONTROL_INFO = 0x90;//请求控制信息
public static final int SWC_KEY_NONE = 0x00;//无按键或者按键释放
public static final int SWC_KEY_VOLUME_UP = 0x01;//音量加
public static final int SWC_KEY_VOLUME_DOWN = 0x02;//音量键
public static final int SWC_KEY_MENU_RIGHT = 0x03;//方向键-右
public static final int SWC_KEY_MENU_LEFT = 0x04;//方向键-左
public static final int SWC_KEY_SRC = 0x07;//源切换
public static final int SWC_KEY_SPEECH = 0x08;//语音
public static final int SWC_KEY_PICK_UP = 0x09;//接听
public static final int SWC_KEY_HANG_UP = 0x0A;//挂断
public static final int SWC_KEY_BOX = 0x0B;//方框键
public static final int SWC_KEY_MENU_UP = 0x13;//方向键-上
public static final int SWC_KEY_MENU_DOWN = 0x14;//方向键-下
public static final int SWC_KEY_BACK = 0x15;//back
public static final int SWC_KEY_ENTER = 0x16;//enter
public static final int SCROLL_KEY_VOLUME_UP = 0x81;//音量旋钮-
public static final int SCROLL_KEY_VOLUME_DOWN = 0x82;//音量旋钮+
public static final int SCROLL_KEY_CH_FLD_UP = 0x83;//enter
public static final int SCROLL_KEY_CH_FLD_DOWN = 0x84;//enter
public static final int SCROLL_KEY_TUNE_TRACK_UP = 0x85;//收音调台-
public static final int SCROLL_KEY_TUNE_TRACK_DOWN = 0x86;//收音调台+
public static final int SWC_KEY_POWER = 0x87;//PWR
public static final int SWC_KEY_MODE = 0x88;//MODE
and the models are
Code:
public static final short CAR_MODEL_VOLKSWAGEN_MAGOTAN = 0;//大众迈腾
public static final short CAR_MODEL_VOLKSWAGEN_SAGITAR = 1;//大众速腾
public static final short CAR_MODEL_VOLKSWAGEN_GOLF7 = 2;//大众高尔夫7
public static final short CAR_MODEL_VOLKSWAGEN_POLO = 3;//大众波罗
public static final short CAR_MODEL_VOLKSWAGEN_OCTAVIA = 4;//大众明锐
public static final short CAR_MODEL_VOLKSWAGEN_17MAGOTAN= 5;//17款迈腾
//本田系列(50-99)
public static final short CAR_MODEL_HONDA_15CRV_L = 50;//15CRV低配
public static final short CAR_MODEL_HONDA_15CRV_H = 51;//15CRV高配
public static final short CAR_MODEL_HONDA_CROSSTOUR = 52;//歌诗图
public static final short CAR_MODEL_HONDA_ACCORD_9L = 53;//雅阁9代低配
public static final short CAR_MODEL_HONDA_ACCORD_9H = 54;//雅阁9代高配
public static final short CAR_MODEL_HONDA_CRIDER = 55;//凌派2016
public static final short CAR_MODEL_HONDA_JADE = 56;//杰德
public static final short CAR_MODEL_HONDA_ODYSSEY = 57;//奥德赛
public static final short CAR_MODEL_HONDA_FIDO = 58;//飞度
public static final short CAR_MODEL_HONDA_WISDOM = 59;//缤智
public static final short CAR_MODEL_HONDA_CITY = 60;//锋范旗舰版2015
public static final short CAR_MODEL_HONDA_12CRV = 61;//12CRV
//日产系列(100-149)
public static final short CAR_MODEL_NISSAN_X_TRAIL = 100;//奇骏
public static final short CAR_MODEL_NISSAN_QASHQAI = 101;//逍客
public static final short CAR_MODEL_NISSAN_NEW_TEANA = 102;//新天籁
public static final short CAR_MODEL_NISSAN_TEANA = 103;//天籁
public static final short CAR_MODEL_NISSAN_TIIDA = 104;//骐达
public static final short CAR_MODEL_NISSAN_SUN = 105;//阳光
public static final short CAR_MODEL_NISSAN_LI_WEI = 106;//骊威
public static final short CAR_MODEL_NISSAN_BLUEBIRD = 107;//蓝鸟
public static final short CAR_MODEL_NISSAN_INIFINITI_QX50_L = 108;//英菲尼迪QX50低配
public static final short CAR_MODEL_NISSAN_INIFINITI_QX50_H= 109;//英菲尼迪QX50高配
public static final short CAR_MODEL_NISSAN_MORNAO = 110;//楼兰
public static final short CAR_MODEL_NISSAN_CIMA_L = 111;//西玛低配
public static final short CAR_MODEL_NISSAN_CIMA_H = 112;//西玛高配
public static final short CAR_MODEL_NISSAN_VENUCIA_T70 = 113;//启辰T70
public static final short CAR_MODEL_NISSAN_VENUCIA_T90 = 114;//启辰T90
//丰田系列(150-199)
public static final short CAR_MODEL_TOYOTA_RAV4 = 150;//RAV4
public static final short CAR_MODEL_TOYOTA_VIOS = 151;//威驰
public static final short CAR_MODEL_TOYOTA_REIZ = 152;//锐志
public static final short CAR_MODEL_TOYOTA_OVERBEARING = 153;//霸道
public static final short CAR_MODEL_TOYOTA_COROLLA = 154;//卡罗拉
public static final short CAR_MODEL_TOYOTA_HIGHLANDER = 155;//汉兰达
public static final short CAR_MODEL_TOYOTA_CAMRY = 156;//凯美瑞
public static final short CAR_MODEL_TOYOTA_CROWN = 157;//皇冠
//通用系列(200-249)
public static final short CAR_MODEL_GM_HIDEN = 200;//英朗
public static final short CAR_MODEL_GM_CRUZE = 201;//科鲁兹
public static final short CAR_MODEL_GM_MALIBU = 202;//迈锐宝
public static final short CAR_MODEL_GM_16MALIBU_XL = 203;//2016迈锐宝XL
public static final short CAR_MODEL_GM_GL8 = 204;//GL8
public static final short CAR_MODEL_GM_AVEO = 205;//爱唯欧
public static final short CAR_MODEL_GM_REGAL = 206;//君威
public static final short CAR_MODEL_GM_ENCORE = 207;//昂科拉
//标志雪铁龙系列(250-299)
public static final short CAR_MODEL_PEUGEOT_16_308 = 250;//16款308
public static final short CAR_MODEL_PEUGEOT_14_408 = 251;//14款408
public static final short CAR_MODEL_PEUGEOT_ELYSEE = 252;//爱丽舍
public static final short CAR_MODEL_PEUGEOT_301 = 253;//301
public static final short CAR_MODEL_PEUGEOT_2008 = 254;//2008
public static final short CAR_MODEL_PEUGEOT_3008 = 255;//3008
public static final short CAR_MODEL_PEUGEOT_C4L = 256;//C4L
public static final short CAR_MODEL_PEUGEOT_DS5LS = 257;//DS5LS
public static final short CAR_MODEL_PEUGEOT_C3XL = 258;//C3XL
public static final short CAR_MODEL_PEUGEOT_SEGA = 259;//世嘉
public static final short CAR_MODEL_PEUGEOT_4008 = 260;//4008
//韩系(300-349)
public static final short CAR_MODEL_KOREA_IX35 = 300;//IX35
public static final short CAR_MODEL_KOREA_IX45 = 301;//IX45
public static final short CAR_MODEL_KOREA_SONATA8 = 302;//索纳塔8
public static final short CAR_MODEL_KOREA_SONATA9 = 303;//索纳塔9
public static final short CAR_MODEL_KOREA_SORRENTO = 304;//索兰托
public static final short CAR_MODEL_KOREA_KIA_K5 = 305;//起亚K5
public static final short CAR_MODEL_KOREA_KIA_KX5 = 306;//起亚KX5
public static final short CAR_MODEL_KOREA_16MISTRA = 307;//16名图
public static final short CAR_MODEL_KOREA_KIA_16ELANTRA = 308;//16领动
public static final short CAR_MODEL_KOREA_KIA_16K3 = 309;//16K3
//福特车系系列(350-399)
public static final short CAR_MODEL_FORD_12_FUCOS = 350;//2012款福克斯
public static final short CAR_MODEL_FORD_13_KUGA = 351;//2013款翼虎
public static final short CAR_MODEL_FORD_13_ECO_SPORT = 352;//2013款翼博
public static final short CAR_MODEL_FORD_13_FIESTA = 353;//2013款嘉年华
public static final short CAR_MODEL_FORD_15_FUCOS = 354;//2015款福克斯
public static final short CAR_MODEL_FORD_17_KUGA = 355;//2017款翼虎
//奔腾车系
public static final short CAR_MODEL_BESTURN_16_B50 = 400;//2016款奔腾B50
public static final short CAR_MODEL_BESTURN_X80 = 405;//奔腾X80
//广汽传祺车系
public static final short CAR_MODEL_TRUMPCH_GA3 = 450;
public static final short CAR_MODEL_TRUMPCH_GA3S = 451;
public static final short CAR_MODEL_TRUMPCH_GA6 = 452;
public static final short CAR_MODEL_TRUMPCH_GS4 = 453;
public static final short CAR_MODEL_TRUMPCH_GS5 = 454;
public static final short CAR_MODEL_TRUMPCH_XINGLANG = 455;//广汽吉奥星朗
//吉利车系
public static final short CAR_MODEL_GEELY_EMGRAND = 500;//吉利帝豪
public static final short CAR_MODEL_GEELY_EMGRAND_GS = 501;//吉利帝豪GS
public static final short CAR_MODEL_GEELY_NL_3 = 502;//吉利博越
//中华车系
public static final short CAR_MODEL_CHINA_MOTOR_V3 = 550;//中华V3
public static final short CAR_MODEL_CHINA_MOTOR_H3 = 551;//中华H3
//宝骏车系
public static final short CAR_MODEL_BAO_JUN_560_2015 = 600;//2015宝骏560
public static final short CAR_MODEL_BAO_JUN_730_2014 = 601;//2014宝骏730
public static final short CAR_MODEL_BAO_JUN_730_2017 = 602;//2017宝骏730
//吉普车系
public static final short CAR_MODEL_JEEP_FREELIGHT_2015 = 650;//2015吉普自由光
public static final short CAR_MODEL_JEEP_LIBERTY_2016 = 651;//2016吉普自由侠
public static final short CAR_MODEL_JEEP_COMPASS_2017 = 652;//2017吉普指南者
//长城车系
public static final short CAR_MODEL_GREAT_WALL_H2 = 700;//长城H2
More to come once i've studied the java and .so sources
darkspr1te
darkspr1te said:
So I've found the sources that document the protocol between CANBOX and HeadUnit for some CANBOX models,
Code:
public class CanBoxProtocol
{
private final static String TAG = "CanBoxProtocol";
private boolean mIsValidProtocol = false;
private int mLengthFlag = 0x1;//0 = 长度在前,1 = 长度在后
private int mHeadLength = 0x00;//Head长度
private int[] mHeadTag = new int[]{0xFF,0xFF,0xFF};//协议头,不够补0xFF
private int[] mBaudRate = new int[]{0x00,0x00,0x00,0x00};//波特率
private int mChecksumAddLength = 0x1;//0 checksum计算不需要包含length;1 需要包含length
private int mChecksumAddCmd = 0x1;//0 checksum计算不需要包含cmd;1 需要包含cmd
private int mChecksumMode = 0x1;//0 &0xFF; 1 ^0xFF
private int mChecksumExtern = 0x0;//0 checksum不需要-1;1 不需要
private int mNeedAck = 0x1;//是否需要ACK
private int mOkAck = 0xFF;//成功ACK
private int mFailedAck = 0xF0;//失败ACK
private int mCheckSumLength= 0x01;//CheckSum长度
private int mDataLengthMode= 0x00;//0 Data部分的长度;1 除协议头以外所有的数据长度
public CanBoxProtocol(int canBoxType,int carModel)
{
updateCanBoxType(canBoxType,carModel);
}
public void updateCanBoxType(int canBoxType,int carModel)
{
Log.i(TAG, "updateCanBoxType:"+canBoxType+",carModel:"+carModel);
switch(canBoxType)
{
case CarModelDefine.CAN_BOX_RZC:
{
//睿智诚标志雪铁龙车系协议格式要单独处理
if(carModel >= 250 && carModel = 300 && carModel HU
public static final int CH_CMD_STEERING_WHEEL_KEY = 0x20;
public static final int CH_CMD_TRIP_PER_MINUTE_INFO = 0x21;//每分钟油耗
public static final int CH_CMD_INSTANT_TRIP_INFO = 0x22;//瞬时油耗
public static final int CH_CMD_HISTORY_TRIP_INFO = 0x23;//历史油耗
public static final int CH_CMD_BASE_INFO = 0x24;
public static final int CH_CMD_TPMS_INFO = 0x25;
public static final int CH_CMD_VEHICLE_SETTING = 0x26;
public static final int CH_CMD_TRIP_BEFORE_15_MINUTE= 0x27;//过去15分钟每分钟油耗
public static final int CH_CMD_AIR_CONDITION_INFO = 0x28;//空调信息
public static final int CH_CMD_STEERING_WHEEL_ANGLE = 0x29;//方向盘转角信息
public static final int CH_CMD_PROTOCOL_VERSION_INFO = 0x30;//协议版本信息
public static final int CH_CMD_AMPLIFIER_STATUS_INFO = 0x31;//攻放信息
public static final int CH_CMD_SYSTEM_INFO = 0x32;//系统信息
public static final int CH_CMD_OIL_ELEC_MIXED_INFO = 0x1F;//油电混合指示
public static final int CH_CMD_REAR_RADAR_INFO= 0x1E;//后雷达
public static final int CH_CMD_FRONT_RADAR_INFO= 0x1D;//前雷达
public static final int CH_CMD_VEHICLE_SET_STATUS_INFO= 0x50;//车辆设置状态
public static final int CH_CMD_AC_PANEL_KEY_INFO= 0x51;//空调面板设置信息(皇冠)
public static final int CH_CMD_VECHILE_SET_RETURN_INFO= 0x52;//车辆设置返回信息(皇冠、汉兰达)
public static final int CH_CMD_AIR_CONDITION_INFO2= 0x58;//车型空调信息(皇冠)
//HU->CanBox
public static final int HC_CMD_SWITCH = 0x81;
public static final int HC_CMD_VEHICLE_SET= 0x83;//车身中控设定命令
public static final int HC_CMD_COMMON_SET= 0x84;//设定命令
public static final int HC_CMD_REQ_CONTROL_INFO= 0x90;//请求控制信息
public static final int SWC_KEY_NONE= 0x00;//无按键或者按键释放
public static final int SWC_KEY_VOLUME_UP= 0x01;//音量加
public static final int SWC_KEY_VOLUME_DOWN= 0x02;//音量键
public static final int SWC_KEY_MENU_RIGHT= 0x03;//方向键-右
public static final int SWC_KEY_MENU_LEFT= 0x04;//方向键-左
public static final int SWC_KEY_SRC= 0x07;//源切换
public static final int SWC_KEY_SPEECH= 0x08;//语音
public static final int SWC_KEY_PICK_UP= 0x09;//接听
public static final int SWC_KEY_HANG_UP= 0x0A;//挂断
public static final int SWC_KEY_BOX= 0x0B;//方框键
public static final int SWC_KEY_MENU_UP= 0x13;//方向键-上
public static final int SWC_KEY_MENU_DOWN= 0x14;//方向键-下
public static final int SWC_KEY_BACK= 0x15;//back
public static final int SWC_KEY_ENTER= 0x16;//enter
public static final int SCROLL_KEY_VOLUME_UP= 0x81;//音量旋钮-
public static final int SCROLL_KEY_VOLUME_DOWN= 0x82;//音量旋钮+
public static final int SCROLL_KEY_CH_FLD_UP= 0x83;//enter
public static final int SCROLL_KEY_CH_FLD_DOWN= 0x84;//enter
public static final int SCROLL_KEY_TUNE_TRACK_UP= 0x85;//收音调台-
public static final int SCROLL_KEY_TUNE_TRACK_DOWN= 0x86;//收音调台+
public static final int SWC_KEY_POWER= 0x87;//PWR
public static final int SWC_KEY_MODE= 0x88;//MODE
and the models are
Code:
public static final short CAR_MODEL_VOLKSWAGEN_MAGOTAN = 0;//大众迈腾
public static final short CAR_MODEL_VOLKSWAGEN_SAGITAR = 1;//大众速腾
public static final short CAR_MODEL_VOLKSWAGEN_GOLF7 = 2;//大众高尔夫7
public static final short CAR_MODEL_VOLKSWAGEN_POLO = 3;//大众波罗
public static final short CAR_MODEL_VOLKSWAGEN_OCTAVIA = 4;//大众明锐
public static final short CAR_MODEL_VOLKSWAGEN_17MAGOTAN= 5;//17款迈腾
//本田系列(50-99)
public static final short CAR_MODEL_HONDA_15CRV_L= 50;//15CRV低配
public static final short CAR_MODEL_HONDA_15CRV_H= 51;//15CRV高配
public static final short CAR_MODEL_HONDA_CROSSTOUR= 52;//歌诗图
public static final short CAR_MODEL_HONDA_ACCORD_9L= 53;//雅阁9代低配
public static final short CAR_MODEL_HONDA_ACCORD_9H= 54;//雅阁9代高配
public static final short CAR_MODEL_HONDA_CRIDER= 55;//凌派2016
public static final short CAR_MODEL_HONDA_JADE= 56;//杰德
public static final short CAR_MODEL_HONDA_ODYSSEY= 57;//奥德赛
public static final short CAR_MODEL_HONDA_FIDO= 58;//飞度
public static final short CAR_MODEL_HONDA_WISDOM= 59;//缤智
public static final short CAR_MODEL_HONDA_CITY= 60;//锋范旗舰版2015
public static final short CAR_MODEL_HONDA_12CRV= 61;//12CRV
//日产系列(100-149)
public static final short CAR_MODEL_NISSAN_X_TRAIL=100;//奇骏
public static final short CAR_MODEL_NISSAN_QASHQAI=101;//逍客
public static final short CAR_MODEL_NISSAN_NEW_TEANA=102;//新天籁
public static final short CAR_MODEL_NISSAN_TEANA=103;//天籁
public static final short CAR_MODEL_NISSAN_TIIDA=104;//骐达
public static final short CAR_MODEL_NISSAN_SUN=105;//阳光
public static final short CAR_MODEL_NISSAN_LI_WEI=106;//骊威
public static final short CAR_MODEL_NISSAN_BLUEBIRD=107;//蓝鸟
public static final short CAR_MODEL_NISSAN_INIFINITI_QX50_L=108;//英菲尼迪QX50低配
public static final short CAR_MODEL_NISSAN_INIFINITI_QX50_H=109;//英菲尼迪QX50高配
public static final short CAR_MODEL_NISSAN_MORNAO=110;//楼兰
public static final short CAR_MODEL_NISSAN_CIMA_L=111;//西玛低配
public static final short CAR_MODEL_NISSAN_CIMA_H=112;//西玛高配
public static final short CAR_MODEL_NISSAN_VENUCIA_T70= 113;//启辰T70
public static final short CAR_MODEL_NISSAN_VENUCIA_T90= 114;//启辰T90
//丰田系列(150-199)
public static final short CAR_MODEL_TOYOTA_RAV4= 150;//RAV4
public static final short CAR_MODEL_TOYOTA_VIOS= 151;//威驰
public static final short CAR_MODEL_TOYOTA_REIZ= 152;//锐志
public static final short CAR_MODEL_TOYOTA_OVERBEARING= 153;//霸道
public static final short CAR_MODEL_TOYOTA_COROLLA= 154;//卡罗拉
public static final short CAR_MODEL_TOYOTA_HIGHLANDER= 155;//汉兰达
public static final short CAR_MODEL_TOYOTA_CAMRY= 156;//凯美瑞
public static final short CAR_MODEL_TOYOTA_CROWN= 157;//皇冠
//通用系列(200-249)
public static final short CAR_MODEL_GM_HIDEN= 200;//英朗
public static final short CAR_MODEL_GM_CRUZE= 201;//科鲁兹
public static final short CAR_MODEL_GM_MALIBU= 202;//迈锐宝
public static final short CAR_MODEL_GM_16MALIBU_XL= 203;//2016迈锐宝XL
public static final short CAR_MODEL_GM_GL8= 204;//GL8
public static final short CAR_MODEL_GM_AVEO= 205;//爱唯欧
public static final short CAR_MODEL_GM_REGAL= 206;//君威
public static final short CAR_MODEL_GM_ENCORE= 207;//昂科拉
//标志雪铁龙系列(250-299)
public static final short CAR_MODEL_PEUGEOT_16_308= 250;//16款308
public static final short CAR_MODEL_PEUGEOT_14_408= 251;//14款408
public static final short CAR_MODEL_PEUGEOT_ELYSEE= 252;//爱丽舍
public static final short CAR_MODEL_PEUGEOT_301= 253;//301
public static final short CAR_MODEL_PEUGEOT_2008= 254;//2008
public static final short CAR_MODEL_PEUGEOT_3008= 255;//3008
public static final short CAR_MODEL_PEUGEOT_C4L= 256;//C4L
public static final short CAR_MODEL_PEUGEOT_DS5LS= 257;//DS5LS
public static final short CAR_MODEL_PEUGEOT_C3XL= 258;//C3XL
public static final short CAR_MODEL_PEUGEOT_SEGA= 259;//世嘉
public static final short CAR_MODEL_PEUGEOT_4008= 260;//4008
//韩系(300-349)
public static final short CAR_MODEL_KOREA_IX35= 300;//IX35
public static final short CAR_MODEL_KOREA_IX45= 301;//IX45
public static final short CAR_MODEL_KOREA_SONATA8= 302;//索纳塔8
public static final short CAR_MODEL_KOREA_SONATA9= 303;//索纳塔9
public static final short CAR_MODEL_KOREA_SORRENTO= 304;//索兰托
public static final short CAR_MODEL_KOREA_KIA_K5= 305;//起亚K5
public static final short CAR_MODEL_KOREA_KIA_KX5= 306;//起亚KX5
public static final short CAR_MODEL_KOREA_16MISTRA= 307;//16名图
public static final short CAR_MODEL_KOREA_KIA_16ELANTRA= 308;//16领动
public static final short CAR_MODEL_KOREA_KIA_16K3= 309;//16K3
//福特车系系列(350-399)
public static final short CAR_MODEL_FORD_12_FUCOS= 350;//2012款福克斯
public static final short CAR_MODEL_FORD_13_KUGA= 351;//2013款翼虎
public static final short CAR_MODEL_FORD_13_ECO_SPORT= 352;//2013款翼博
public static final short CAR_MODEL_FORD_13_FIESTA= 353;//2013款嘉年华
public static final short CAR_MODEL_FORD_15_FUCOS= 354;//2015款福克斯
public static final short CAR_MODEL_FORD_17_KUGA= 355;//2017款翼虎
//奔腾车系
public static final short CAR_MODEL_BESTURN_16_B50= 400;//2016款奔腾B50
public static final short CAR_MODEL_BESTURN_X80= 405;//奔腾X80
//广汽传祺车系
public static final short CAR_MODEL_TRUMPCH_GA3= 450;
public static final short CAR_MODEL_TRUMPCH_GA3S= 451;
public static final short CAR_MODEL_TRUMPCH_GA6= 452;
public static final short CAR_MODEL_TRUMPCH_GS4= 453;
public static final short CAR_MODEL_TRUMPCH_GS5= 454;
public static final short CAR_MODEL_TRUMPCH_XINGLANG= 455;//广汽吉奥星朗
//吉利车系
public static final short CAR_MODEL_GEELY_EMGRAND= 500;//吉利帝豪
public static final short CAR_MODEL_GEELY_EMGRAND_GS= 501;//吉利帝豪GS
public static final short CAR_MODEL_GEELY_NL_3= 502;//吉利博越
//中华车系
public static final short CAR_MODEL_CHINA_MOTOR_V3= 550;//中华V3
public static final short CAR_MODEL_CHINA_MOTOR_H3= 551;//中华H3
//宝骏车系
public static final short CAR_MODEL_BAO_JUN_560_2015= 600;//2015宝骏560
public static final short CAR_MODEL_BAO_JUN_730_2014= 601;//2014宝骏730
public static final short CAR_MODEL_BAO_JUN_730_2017= 602;//2017宝骏730
//吉普车系
public static final short CAR_MODEL_JEEP_FREELIGHT_2015= 650;//2015吉普自由光
public static final short CAR_MODEL_JEEP_LIBERTY_2016= 651;//2016吉普自由侠
public static final short CAR_MODEL_JEEP_COMPASS_2017= 652;//2017吉普指南者
//长城车系
public static final short CAR_MODEL_GREAT_WALL_H2= 700;//长城H2
More to come once i've studied the java and .so sources
darkspr1te
Click to expand...
Click to collapse
Excellent work. I have a lot of functionality on my 2010 jeep grand Cherokee (tpms, front and rear radar, etc.) That aren't displayed by the head unit....I hope you will find a way to customize it and I finally can use it for my car
Inviato dal mio SM-N960F utilizzando Tapatalk
royalhawk2002 said:
Excellent work. I have a lot of functionality on my 2010 jeep grand Cherokee (tpms, front and rear radar, etc.) That aren't displayed by the head unit....I hope you will find a way to customize it and I finally can use it for my car
Inviato dal mio SM-N960F utilizzando Tapatalk
Click to expand...
Click to collapse
Thanks, Yes extended functions will be available even in cars where they may not directly exist. Door open could be emulated by just sensing the door pin, but the electronics for a general car board that could be re-purposed for this I'am not sure exist in a good package.
maybe later on i'll look for a open source obd board that has additional input other than just OBD CAN and can isolate itself from the H/U.
Jeeps are known to me, I grazed my first knuckles on a 4L High output from the willies jeep body & early Cherokee, fun cars if they are not your daily driver.
darkspr1te
darkspr1te said:
Thanks, Yes extended functions will be available even in cars where they may not directly exist. Door open could be emulated by just sensing the door pin, but the electronics for a general car board that could be re-purposed for this I'am not sure exist in a good package.
maybe later on i'll look for a open source obd board that has additional input other than just OBD CAN and can isolate itself from the H/U.
Jeeps are known to me, I grazed my first knuckles on a 4L High output from the willies jeep body & early Cherokee, fun cars if they are not your daily driver.
darkspr1te
Click to expand...
Click to collapse
Door status display, manual headlight switch on, steering wheel commands and Steering angle sensor (dynamic lines in rear view cam) are the unique "CAN" implemented function on my Jeep Grand Cherokee WK head unit CanBus BOX. There are a lot info on the Can Bus that could be displayed on the HU, i.e. external temperature, TPMS, Parking Sensors, Compass, etc.
Any update?
Inviato dal mio SM-N960F utilizzando Tapatalk
Is this wonderful work abandoned ?
I've not abandoned the project, due to IRL commits and other projects to complete I just had not had the time to return to this, the project is still under development internally but writing the public document side is time consuming and i've not had that kinda time of late.
darkspr1te
Canbus firmware file
I don't know if this is still useful for you, but here is a link for a firmware update for a VW-SS-07 VW canbus unit:
https://mega.nz/#!zXJBnQxZ!EOEbuxoIjO3Otyv9hxUuDBzLDuuNRbiMEo9-g2hBfAI
Here are the instructions for using it:
1. Confirm the model of your canbus decoder is VW-SS-07.
2. Download the software onto the root content of your sd card and insert it to the unit.
3. Enter Factory Settings and input the code "canupdates" instead of password.
Here's the page I found it on:
http://forum.autopumpkin.com/viewtopic.php?t=13120
-Karl.
darkspr1te said:
Hi All,
I have a PX5 radio that was supplied with fittings for 2006 Toyota RAV4 , sadly it didnt come with a CANBOX and supplier was not able to provide one that matched, I managed to get my hands on a Canbox for VW unit and decided to reverse engineer the unit.
Here are my findings.
Code:
Pinouts
1--2--3--4--5--6--7--8
9--10-11-12-13-14-15-16
1 GND 9 B+
2 CANH 10 CANL
3 EMPTY 11 ACC
4 EMPTY 12 EMPTY
5 EMPTY 13 EMPTY
6 EMPTY 14 EMPTY
7 MCU_RXD_CAN 15 EMPTY
8 EMPTY 16 MCU_TXD_CAN
On power up the device sends a hex packet to TX Uart of the board (RX of the head unit) at 38400 baud,
the packet is as follows
Code:
0x0,
0x2E,0x21,0x5,0x0,0x10,0x0,0x0,0x0,0xC9
0x2E,0x21,0x5,0x0,0x10,0x0,0x0,0x0,0xC9,
0x2E0x21,0x5,0x0,0x10,0x0,0x0,0x0,0xC9,
0x2E,0x21,0x5,0x0,0x10,0x0,0x0,0x0,0xC9,
0x2E,0x22,0x4,0x1,0x1,0x1,0x1,0xD5,
0x2E,0x22,0x4,0x1,0x10x1,0x1,0xD5,
0x2E,0x22,0x4,0x1,0x1,0x1,0x1,0xD5,
0x2E,0x22,0x4,0xFE,0x2,0x1,0x1,0xD5,
0x2E,0x23,0x4,0x1,0x1,0x1,0x1,0xD4,
0x2E,0x23,0x4,0x1,0x1,0x1,0x1,0xD4,
0x2E,0x23,0x4,0x1,0x1,0x1,0x1,0xD4,
0x2E,0x23,0x4,0x1,0x1,0x1,0x1,0xFF,0xFF
Raw Packet
Code:
02E215010000C92E215010000C92E215010000C92E215010000C92E2241111D52E2241111D52E2241111D52E2241111D52E2341111D42E2341111D42E2341111D42E2341111D4FF
packet burst start with 0x0 then each packet start with 0x2e
My Assumption is the box acts as a translator converting each car specific CANBUS/KKL/KLINE/IR-bus protocol into a
pre-defined packet of information that it transmits to the headunit.
if this is confirmed then creating a open source version of the box should be easy within the ease of the cars can system ,
it may also open cars that dont have can bus to still use the canbus system of headunit, eg reading speed to adjust volume , monitor door open to display on screen using arduino.
If anyone has seen a lookup chart or information on the CANBOX/Decoders protocol to/from the headunit I would love the link.
next i will hookup to the headunit itself and send the same codes to see what effect they have.
darkspr1te
p.s if anyone knows of a firmware bin for canbus box then please let me know.
Click to expand...
Click to collapse
karlnorth said:
I don't know if this is still useful for you, but here is a link for a firmware update for a VW-SS-07 VW canbus unit:
https://mega.nz/#!zXJBnQxZ!EOEbuxoIjO3Otyv9hxUuDBzLDuuNRbiMEo9-g2hBfAI
Here are the instructions for using it:
1. Confirm the model of your canbus decoder is VW-SS-07.
2. Download the software onto the root content of your sd card and insert it to the unit.
3. Enter Factory Settings and input the code "canupdates" instead of password.
Here's the page I found it on:
http://forum.autopumpkin.com/viewtopic.php?t=13120
-Karl.
Click to expand...
Click to collapse
Thanks, I've pulled the files but not yet looked at them, time has been a strange partner of late
darkspr1te
Hi darkspr1te ,
Useful topic. Congrats!
So, i had a DIY project and got some information about serial protocol between CANbox decoder and China head unit from your topic.
I have a Volvo XC90 and buy from aliexpress head unit for my Volvo, but when it arrives... There is surprise - CAN decoder did not recognize CAN bus. I asked the seller, but he told me "you need to learn yourself how the CANbus integration works".... Тypical China seller....
After that i open this CANbus decoder and found inside STM32L072, great news, because i'm hardware engineer and my primary job is to design PCBs and write firmware.
Since today i have working CAN bus decoder(i wrote my own FW) with following features:
1. Recognize CAN communication between modules in XC90 and parse messages.
2. Send commands via UART to china head unit. Most of functionality works now - steering wheel buttons, gearbox state(P,R,N,D) this is for rear camera, day - night backlight mode, doors and lids state(open-close).
Today spended two hours to play with CAN analyzer in my car and found message that shown steering wheel angle. Do you know how to send this information via UART to head unit?
I found in your topic following - public static final int CH_CMD_STEERING_WHEEL_ANGLE = 0x29;//方向盘转角信息, but i don't know how to transmit the data in the message.

Categories

Resources