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
T5Luke
Posts: 142
Joined: 11 November 2020
Year and Model: S60 T5 2001
Location: DE
Has thanked: 11 times
Been thanked: 130 times

Re: Vida CEM swapping

Post by T5Luke »

oscilloscope wrote: 21 Aug 2022, 15:24 How is one ment to over write the entry if its already been converted to machine language. ?
No, this is stored as normal text string, machine won't interpret it...
Just search and replace...
Attachments
screenshot.3.jpg
screenshot.3.jpg (72.06 KiB) Viewed 1003 times

duzi
Posts: 21
Joined: 16 September 2021
Year and Model: S60
Location: Lithuania
Has thanked: 18 times
Been thanked: 5 times

Post by duzi »

it seems that the "SMOK UHDS" gentleman also reads this branch. L (H) cem pin reading added in new update,True, with the year 2002 he was mistaken :) ..Guys you make the world a better place t.y
Attachments
3.PNG
3.PNG (26.44 KiB) Viewed 973 times

Bryt
Posts: 7
Joined: 18 August 2022
Year and Model: V70 2000 V70 2004
Location: Bengtsfors
Has thanked: 13 times

Post by Bryt »

T5Luke wrote: 21 Aug 2022, 03:29 Here have fun with it:

Code: Select all

#define BKPT 4
#define RESET 5
#define FREEZE 6
#define DSI 7
#define DSO 8

static word CMD_READ = 0x1940;
static word CMD_GO = 0x0C00;
static word CMD_WRITEM = 0x1840;

char command;
int n_line;

void setup() {
  // put your setup code here, to run once:
  pinMode(BKPT, OUTPUT);
  digitalWrite(BKPT, HIGH);
  pinMode(RESET, OUTPUT);
  digitalWrite(RESET, LOW);
  pinMode(FREEZE, INPUT);
  pinMode(DSI, OUTPUT);
  digitalWrite(DSI, LOW);
  pinMode(DSO, INPUT);
  Serial.begin(57600);
  while(!Serial){
  }
  Serial.println(F("Arduino CEM Reader, press:"));
  Serial.println();
  Serial.println(F("e: enter BDM Mode"));
  Serial.println(F("l: leave BDM (experimental)"));
  Serial.println(F("r: read complete memory"));
  Serial.println(F("b: read Boot 0-3FFF"));
  Serial.println(F("s: read security block 4000-7FFF"));
  Serial.println(F("d: read car data 8000-1FFFF"));
  Serial.println(F("f: read firmware 20000-7FFFF"));
  Serial.println(F("c: BD32 Command Mode")); 
  
  

}

void loop() {
  // put your main code here, to run repeatedly:
    if (Serial.available()) {
      command = Serial.read();
      switch (command)
      {
        case 'e':
        Serial.println("Enter BDM");
        digitalWrite(BKPT, LOW);
        delay(10);
        digitalWrite(RESET, HIGH);
        delay(100);
        Serial.println(digitalRead(FREEZE));
        break;

        case 'l':
        Serial.println("leave BDM");
        shift_BKPT_up();
        digitalWrite(RESET, LOW);
        delay(10);
        digitalWrite(RESET, HIGH);
        wait_openchannel();
        bdm_command(CMD_GO);
        digitalWrite(DSO, LOW);
        shift_BKPT_up();

        
        Serial.println(digitalRead(FREEZE));
        break;

        case 'r':
        Serial.println("Read FLASH");
       
        for (unsigned long offset = 0x0000; offset<=0x7FFFF; offset = offset + 0x02)
        {
           shiftRWord(offset);
        }
        break;

        case 'b':
        Serial.println(F("Read bootblock"));
       
        for (unsigned long offset = 0x0000; offset<=0x3FFF; offset = offset + 0x02)
        {
           shiftRWord(offset);
        }
        break;

        case 's':
        Serial.println(F("Read securityblock"));
       
        for (unsigned long offset = 0x4000; offset<=0x7FFF; offset = offset + 0x02)
        {
           shiftRWord(offset);
        }
        break;

        case 'd':
        Serial.println(F("Read cardata"));
       
        for (unsigned long offset = 0x8000; offset<=0x1FFFF; offset = offset + 0x02)
        {
           shiftRWord(offset);
        }
        break;

        case 'f':
        Serial.println(F("Read firmware"));
       
        for (unsigned long offset = 0x10000; offset<=0x7FFFF; offset = offset + 0x02)
        {
           shiftRWord(offset);
        }
        break;

        case 'c':
        Serial.println(F("BD32 Command Mode"));

        serialFlush();
        while(!Serial.available());
        {
        }
        break;

        default:
        break;

        case 'i':
        Serial.println("wipe");
        for (int i=0; i<=250; i++)
        {
          digitalWrite(BKPT, LOW);
          delay(1);
          digitalWrite(BKPT, HIGH);
          delay(1);
        }
        break;
      }
    }

}


void shiftRWord(unsigned long val)
{
    word i;
    word lowbyte = val;
    word hibyte = val >> 16;

    //Wait for DSO to get 0 => gets ready
   wait_openchannel();

    bdm_command(CMD_READ);
    shift_BKPT_up();
    shift_BKPT_up();
    


     for (i = 0; i < 16; i++)  {  //HighByte


        digitalWrite(DSI, !!(hibyte & (1 << (15 - i))));
        shift_BKPT_up();
    }
        digitalWrite(DSI, LOW);
        delayMicroseconds(1);
        shift_BKPT_up();



     for (i = 0; i < 16; i++)  {  //LowByte


        digitalWrite(DSI, !!(lowbyte & (1 << (15 - i))));
        shift_BKPT_up();
    }
    digitalWrite(DSI, LOW);
    delayMicroseconds(1);


    word W_Read;

    for (i= 0; i < 1; i++)   //Read Status Byte
    {
      //digitalWrite(BKPT, HIGH);
      //delayMicroseconds(1);
      digitalWrite(BKPT, LOW);
      delayMicroseconds(1);
      //Serial.print(digitalRead(DSO));
    }

    for (i= 0; i < 16; i++) //Read back
    {
      digitalWrite(BKPT, HIGH);
      delayMicroseconds(1);
      digitalWrite(BKPT, LOW);
      delayMicroseconds(1);
      //Serial.print(digitalRead(DSO));
       bitWrite(W_Read,(15-i),digitalRead(DSO));
    }

    check_lzero(W_Read);

    if (n_line <=6)
    {        
       Serial.print(W_Read,HEX);
       Serial. print(" ");
       n_line++;
    }else{
      Serial.println(W_Read,HEX);
      n_line = 0;
    }

   
    //return W_Read;
}


 void write_Register(word cmd, unsigned long addr)
 {
    word lowbyte = addr;
    word hibyte = addr >> 16;

    wait_openchannel(); //Wait for DSO to get 0 => gets ready
    bdm_command2(cmd);
    shift_BKPT_up();

    for (int i = 0; i < 16; i++)  {  //HighByte OFFSET
        digitalWrite(DSI, !!(hibyte & (1 << (15 - i))));
        shift_BKPT_up();
    }
    digitalWrite(DSI, LOW);
    delayMicroseconds(1);
    shift_BKPT_up();

    for (int i = 0; i < 16; i++)  {  //LowByte OFFSET
        digitalWrite(DSI, !!(lowbyte & (1 << (15 - i))));
        shift_BKPT_up();
    }
    digitalWrite(DSI, LOW);
    delayMicroseconds(1);
 }
 

 void check_lzero(word W_Read){
      if (W_Read < 0x10)
      {
        Serial.print("000");
        return;
      }
        
      if (W_Read < 0x100)
      {
        Serial.print("00");
        return;
      }
      if (W_Read < 0x1000)
      {
        Serial.print("0");
        return;
      }
     }

 void shift_BKPT_up()
 {
      digitalWrite(BKPT, LOW);
      delayMicroseconds(1);
      digitalWrite(BKPT, HIGH);
      delayMicroseconds(1);
 }

 void wait_openchannel()
 {
      while(digitalRead(DSO)!=0)
    {
      shift_BKPT_up();
    }
     while(digitalRead(DSO)!=1)
    {
      shift_BKPT_up();
    }
 }

 void bdm_command(word command)
 {
  for (int i = 0; i < 15; i++)  {  
        digitalWrite(DSI, !!(command & (1 << (15 - i))));
        shift_BKPT_up();
    }
  digitalWrite(DSI, LOW);
 }

  void bdm_command2(word command)
 {
  for (int i = 0; i < 16; i++)  {  
        digitalWrite(DSI, !!(command & (1 << (15 - i))));
        shift_BKPT_up();
    }
  digitalWrite(DSI, LOW);
 }

 void serialFlush(){
  while(Serial.available() > 0) {
    char t = Serial.read();
  }
}   
Does anyone have schematic for the pins?

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 »

Here...

2 options, connect the 5V line at the capacitor, or connect the 12V at the CEMs main connector. Both connections 5V and +12V are not needed together...

Masse means GND
If you use 12V power supply connect GND from it also to arduios GND, so they should have common GND.
Attachments
cem_b.jpg
cem_b.jpg (154.84 KiB) Viewed 910 times
CEMCON.jpg
CEMCON.jpg (302.93 KiB) Viewed 910 times

Bryt
Posts: 7
Joined: 18 August 2022
Year and Model: V70 2000 V70 2004
Location: Bengtsfors
Has thanked: 13 times

Post by Bryt »

Thanks T5Luke! 👍

urosm
Posts: 29
Joined: 24 May 2012
Year and Model: 2015 Volvo XC70 D5
Location: Montenegro
Has thanked: 10 times

Post by urosm »

duzi wrote: 21 Aug 2022, 23:46 it seems that the "SMOK UHDS" gentleman also reads this branch. L (H) cem pin reading added in new update,True, with the year 2002 he was mistaken :) ..Guys you make the world a better place t.y
SMOK UHDS works easily.
I tried last night to read the PIN from some CEM I have at service.

2 of 3 are read without problem on the bench. 1st is read in 10 minutes, the second one in 5 minutes.
The second one has a flash from 2012/2013 XC90.
From 3rd won't read PIN, but I think some corrupted flash written into it.
And the last one I tried in my 2008 XC90 thru OBD. In 5 minutes PIN was found.
Volvo 744 TDIC SOLD, 1989. ; 1997. - 2000.
Volvo 855 GLT + LPG Estate SOLD, 1996. ; 1998. - 2020.
Volvo V70 D5 SOLD, 2004. ; 2013. - 2021.
Volvo XC70 D5 SOLD, 2007. ; 2017. - 2021.
Nissan Pathfinder DRIVING, 2007. ; 2019. -
Volvo XC70 D5 DRIVING, 2015. ; 2021. -
Volvo XC90 D5 DRIVING, 2008. ; 2022. -

oscilloscope
Posts: 285
Joined: 20 May 2022
Year and Model: 2005
Location: uk
Has thanked: 27 times
Been thanked: 11 times

Post by oscilloscope »

urosm wrote: 24 Aug 2022, 01:30
duzi wrote: 21 Aug 2022, 23:46 it seems that the "SMOK UHDS" gentleman also reads this branch. L (H) cem pin reading added in new update,True, with the year 2002 he was mistaken :) ..Guys you make the world a better place t.y
SMOK UHDS works easily.
I tried last night to read the PIN from some CEM I have at service.

2 of 3 are read without problem on the bench. 1st is read in 10 minutes, the second one in 5 minutes.
The second one has a flash from 2012/2013 XC90.
From 3rd won't read PIN, but I think some corrupted flash written into it.
And the last one I tried in my 2008 XC90 thru OBD. In 5 minutes PIN was found.
I was talking to the dev at SMOK and I wanted to know if the 0012 add on works on bench. As it can read all sorts of ecus. Sid807evo , Edc16c34 , newer cems to copy the info for cloning , which might be handy for pin reading.

duzi
Posts: 21
Joined: 16 September 2021
Year and Model: S60
Location: Lithuania
Has thanked: 18 times
Been thanked: 5 times

Post by duzi »

what's the point, of reading a pin if it doesn't read the flash or config...without ioterminal, still have to remove the module

oscilloscope
Posts: 285
Joined: 20 May 2022
Year and Model: 2005
Location: uk
Has thanked: 27 times
Been thanked: 11 times

Post by oscilloscope »

duzi wrote: 25 Aug 2022, 08:46 what's the point, of reading a pin if it doesn't read the flash or config...without ioterminal, still have to remove the module
Eh ? You don't need iot , you can use xprog , carprog , orange5 (not all mcu is covered) , etl iprog , vvdi things like that. , but if you mean for convince its not always easy. To just plug in and it makes it all happen. Is that what you mean?

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

Post by vtl »

duzi wrote: 25 Aug 2022, 08:46 what's the point, of reading a pin if it doesn't read the flash or config...without ioterminal, still have to remove the module
The main point was I needed something to fight my boring job a few years ago, to do something fun and brain-involved.

Post Reply
  • Similar Topics
    Replies
    Views
    Last post