smartgauges / canbox

Firmware for canbus boxes
59 stars 25 forks source link

Building firmware for XC90 #1

Open liamstears opened 1 year ago

liamstears commented 1 year ago

I am new to this so I apologize in advance

I would like to build the firmware for a volvo_od2 for use in an XC90

I assume to function I only need to update addresses of my modules at the end of canbox/cars/xc90_2007my.c?

What confuses me the most is how do I find all the addresses of my modules to be able to do this?

I really hope you can...

Edit: Also link to Virtual machine (https://drive.google.com/file/d/1XCHW03gKX6WUB6tFS7kKD0kZkctj8inW/view?usp=sharing) is down I cannot download...

liamstears commented 4 months ago

Supposedly there are multiple lin bus networks, and this attach to a "master" ECU and is the master ECU the one that sends the can data to the can bus. This is something that happens for example with SWC. As i said , if the data is there, and the radio expects it we can code it. My car does not "have" those buttons, it does physically (it didn't in the past), but it does not for the ECU, that is why i think they do not work (i wish they did haha), the main problem is that we do not know what to expect from the android hu when we send 0x09 or 0x0a. it should work i don't know why it doesn't.

  • Parking brake, i tried to see if it made any change on canbus, couldn't see anything.
  • Wiper fluid level, who knows, does the car even know the wipers fluid level?
  • Seat belt, probably on canbus HS, we are tapping into can bus LS.

Where did you get those can bus codes? i cannot find those addresses on my sniffing's.

I have got the phone buttons working!

canbox.c uint8_t buf[] = { 0x05, 0x01 }

This works, when not in call it opens phone/bluetooth app, when in call it hangs up, when someone is calling it answers the phone

So simply set this to both buttons, I think maybe the head unit or canbus box is not setup to have separate answer/hangup buttons?

Also I found: uint8_t buf[] = { 0x07, 0x01 }

This operates the Change Mode/Players Quick Button on the unit. I temporarily set this to all sat nav direction buttons

I haven't found anything else yet, maybe that's all?

jesusvallejo commented 4 months ago

It makes sort of sense, im happy for you as you wanted the telf so much. Also i dont understand what 0x07 does. For the record, those CAN addresses are from the HS can bus. not available from the connectors the Chinese sell, as those tap into the LS radio cables.

liamstears commented 4 months ago

It makes sort of sense, im happy for you as you wanted the telf so much. Also i dont understand what 0x07 does. For the record, those CAN addresses are from the HS can bus. not available from the connectors the Chinese sell, as those tap into the LS radio cables.

I am not familiar with the canbus or how it is interfaced so I can't really help much more at this point without help and guidance

0x07 - On my head unit there is what's called a "Mode" button. This button basically is used to switch between certain apps. I can choose apps I want in a list so for example Maps/Music/Radio, when I press button it shows icons for these 1 at a time and changes each button press, I just press button until for example "Maps" is shown on screen and wait and it brings up maps

Hope this helps and look forward to your next findings

P.s I have sent you an email

liamstears commented 4 months ago

It makes sort of sense, im happy for you as you wanted the telf so much. Also i dont understand what 0x07 does. For the record, those CAN addresses are from the HS can bus. not available from the connectors the Chinese sell, as those tap into the LS radio cables.

Prev and next buttons are wrong way round so in canbox.c I changed 0x04 to 0x03 on lines 459 and 471 and 0x03 to 0x04 on lines 451 and 479

Front left and right door are the wrong way round, this can be fixed in xc90_2007my.c on line 90/91 with this: carstate.fl_door = (msg[5] & 0x04) ? 1 : 0; carstate.fr_door = (msg[5] & 0x02) ? 1 : 0;

Reverse trajectory also moves the wrong way as your aware, I know this can be fixed but I don't understand the scale method it uses to know the fix but I would guess the fix is in line 13 of xc90_2007my.c somewhere with this: uint8_t wheel = scale(angle, 0, 0x3f, 0, 100);

I wouldn't know what to change though, I could experiment but I don't have the time right now (EDIT: I have done some testing with no results)

Then optionally because most XC90 does not have front parking sensors I decided to remove them but this is optional, I didn't want them to be on the display so I removed all lines from xc90_2007my.c and canbox.c relating to front sensors

liamstears commented 3 months ago

It makes sort of sense, im happy for you as you wanted the telf so much. Also i dont understand what 0x07 does. For the record, those CAN addresses are from the HS can bus. not available from the connectors the Chinese sell, as those tap into the LS radio cables.

Haven't heard from you in a while, I hope all is well and very interested to see if you have made any progress 😁

jesusvallejo commented 3 months ago

Hi, everything is ok, just very busy at work. As soon as I make any progress I'll update.

jesusvallejo commented 3 months ago

It makes sort of sense, im happy for you as you wanted the telf so much. Also i dont understand what 0x07 does. For the record, those CAN addresses are from the HS can bus. not available from the connectors the Chinese sell, as those tap into the LS radio cables.

Prev and next buttons are wrong way round so in canbox.c I changed 0x04 to 0x03 on lines 459 and 471 and 0x03 to 0x04 on lines 451 and 479

Front left and right door are the wrong way round, this can be fixed in xc90_2007my.c on line 90/91 with this: carstate.fl_door = (msg[5] & 0x04) ? 1 : 0; carstate.fr_door = (msg[5] & 0x02) ? 1 : 0;

Reverse trajectory also moves the wrong way as your aware, I know this can be fixed but I don't understand the scale method it uses to know the fix but I would guess the fix is in line 13 of xc90_2007my.c somewhere with this: uint8_t wheel = scale(angle, 0, 0x3f, 0, 100);

I wouldn't know what to change though, I could experiment but I don't have the time right now (EDIT: I have done some testing with no results)

Then optionally because most XC90 does not have front parking sensors I decided to remove them but this is optional, I didn't want them to be on the display so I removed all lines from xc90_2007my.c and canbox.c relating to front sensors

No need to change the code, those can be easilly be adjusted in the settings of the HU, both the trajectory and the prev and next buttons, as well as the information of the opened doors.