Login Register

Vida CEM swapping

A mid-size luxury crossover SUV, the Volvo XC90 made its debut in 2002 at the Detroit Motor Show. Recognized for its safety, practicality, and comfort, the XC90 is a popular vehicle around the world. The XC90 proved to be very popular, and very good for Volvo's sales numbers, since its introduction in model year 2003 (North America). P2 platform.
Post Reply
andrewgabler
Posts: 19
Joined: 1 July 2019
Year and Model: 2007 S60R
Location: Minneapolis
Has thanked: 1 time

Re: Vida CEM swapping

Post by andrewgabler »

https://github.com/andrewgabler/VolvoDI ... Logger.ino

Works to log from my OBD2 port at both speeds just fine

Edit: I did just update this old repo with the file I have been using so this isn't the EXACT code I've been using to test with, but I will go make sure it still works with my car and isn't buggy

vtl
Posts: 4724
Joined: 16 August 2012
Year and Model: 2005 XC70
Location: Boston
Has thanked: 114 times
Been thanked: 604 times

Post by vtl »

CAN.begin(CAN_125KBPS, MCP_16MHz)

Are you sure your shield has a 16 MHz oscillator? All my MCP2515 shields had 8 MHz, I had to solder my own oscillator.

andrewgabler
Posts: 19
Joined: 1 July 2019
Year and Model: 2007 S60R
Location: Minneapolis
Has thanked: 1 time

Post by andrewgabler »

I'm honestly not sure... how important is that? I just tested the code I shared and was able to log my OBD2 port with it just fine.


Yes it does https://store-usa.arduino.cc/products/a ... edStore=us
Last edited by andrewgabler on 27 Apr 2023, 20:51, edited 1 time in total.

vtl
Posts: 4724
Joined: 16 August 2012
Year and Model: 2005 XC70
Location: Boston
Has thanked: 114 times
Been thanked: 604 times

Post by vtl »

andrewgabler wrote: 27 Apr 2023, 20:47 I'm honestly not sure... how important is that? I just tested the code I shared and was able to log my OBD2 port with it just fine.
This one is 8 MHz.
Untitled.png
Untitled.png (272.71 KiB) Viewed 575 times
You still can use it, at least for 125Kbps bus, but initialize it properly, with MCP_8MHz. For 500 Kbps IIRC 16 MHz is needed.

andrewgabler
Posts: 19
Joined: 1 July 2019
Year and Model: 2007 S60R
Location: Minneapolis
Has thanked: 1 time

Post by andrewgabler »

Just edited my post above with the link, yes my CAN Shield for the MKR has the 16mhz oscillator as does my arduino uno can shield
Logging working on obd2 port
Logging working on obd2 port
168A7693-DAC6-4BDE-BFEB-278925DA174B.jpeg (423.33 KiB) Viewed 561 times

vtl
Posts: 4724
Joined: 16 August 2012
Year and Model: 2005 XC70
Location: Boston
Has thanked: 114 times
Been thanked: 604 times

Post by vtl »

Do you have oscilloscope or logic analyzer? When nothing works, I get one or another, and quickly figure out I was stupid.

andrewgabler
Posts: 19
Joined: 1 July 2019
Year and Model: 2007 S60R
Location: Minneapolis
Has thanked: 1 time

Post by andrewgabler »

I wish I did... an oscilloscope is my next electronics purchase.

I have 1 hypothesis after hooking up a DIM to the CEM.

My Arduino mkr wifi canbus shield has a switch to enable 120 ohm termination. The DIM powers up when I have it connected, but it still wont log. My arduino uno does not have 120 ohm termination and that is the device i have been testing with in the car. When it is hooked up the DIM will not power on.

Hypothesis - The MKR Can Shield has some issue with my code or the board itself. (I fried an mkr with a short a year or two ago and got a replacement. It still SENDS Can messages fine, but I haven' logged with it.)
The UNO doesn't currently work because I do not have 120 ohm termination.

Resolution: I have a number of different cheaper CAN adapters coming in the mail to test with, along with a large array of resistors (including 120 ohm). I will try again with the UNO can shield and termination and report back.

THANK YOU for the patience and quick responses tonight, I am glad I was able to work through this with someone else's guidance

vtl
Posts: 4724
Joined: 16 August 2012
Year and Model: 2005 XC70
Location: Boston
Has thanked: 114 times
Been thanked: 604 times

Post by vtl »

andrewgabler wrote: 27 Apr 2023, 21:23 I wish I did... an oscilloscope is my next electronics purchase.
Get logic analyzer first. Chinese knock offs are as cheap as $10-15 on ebay. Of course, buying a real Saleae or DSLogic is better, both from morale and precision standpoints. I'm pretty happy with DSLogic Plus, but the cracker was initially debugged with a $9.99 knock off ;)

T5Luke
Posts: 142
Joined: 11 November 2020
Year and Model: S60 T5 2001
Location: DE
Has thanked: 11 times
Been thanked: 130 times

Post by T5Luke »

When you connect the CEM like in the sample i provided before, it won't fall asleep, it stays on and send all the time. It just falls asleep if you don't connect the wire for ignition lock. You should hear something clicking if you power the cem.

You have connected this both big pins where the big green connector comes in?

dikidera
Posts: 1304
Joined: 15 August 2022
Year and Model: S60 2005
Location: Galaxy far far away
Has thanked: 67 times
Been thanked: 175 times

Post by dikidera »

andrewgabler wrote: 27 Apr 2023, 21:23 I wish I did... an oscilloscope is my next electronics purchase.

I have 1 hypothesis after hooking up a DIM to the CEM.

My Arduino mkr wifi canbus shield has a switch to enable 120 ohm termination. The DIM powers up when I have it connected, but it still wont log. My arduino uno does not have 120 ohm termination and that is the device i have been testing with in the car. When it is hooked up the DIM will not power on.

Hypothesis - The MKR Can Shield has some issue with my code or the board itself. (I fried an mkr with a short a year or two ago and got a replacement. It still SENDS Can messages fine, but I haven' logged with it.)
The UNO doesn't currently work because I do not have 120 ohm termination.

Resolution: I have a number of different cheaper CAN adapters coming in the mail to test with, along with a large array of resistors (including 120 ohm). I will try again with the UNO can shield and termination and report back.

THANK YOU for the patience and quick responses tonight, I am glad I was able to work through this with someone else's guidance
Perhaps the bit timing code is wrong in your Arduino code? There are quite a lot of configuration options for the CAN bus. Bit sampling, synchronization etc.

Btw, when I tested that little Chinese CAN board with 8mhz crystal, it worked okay with 500kbps bus. Not saying it wouldn't have caused issues, but it worked for me.

Now, my advice is to use a dual can hat for RPI or arduino. It's versatile and offers better bang for buck, cause you will eventually need to communicate to both buses, and having two of those flimsy Chinese single CAN channel boards is messy.

I used this CAN hat for RPI https://www.waveshare.com/2-ch-can-hat.htm and it's better in almost every single way, in that it's wired internally to the correct pins, so it's plug n play and has no messy wires.

Post Reply
  • Similar Topics
    Replies
    Views
    Last post