xboxscene.org forums

Author Topic: 1.6 Cpu Temp Sensor Found  (Read 76 times)

pablot

  • Archived User
  • Sr. Member
  • *
  • Posts: 499
1.6 Cpu Temp Sensor Found
« on: March 31, 2006, 05:13:00 AM »

Hi,

I think I have located the 1.6 temperature sensor (inside the xcalibur) and would like it if some one with a 1.6 xbox could try it out. I have tested it but the temperature read out is a bit "jumpy", it jumps with in 2C when idle. I just tested unplugging the fan and the temp whent up from 40C to 60C, I then plugged it in again and it whent back down again. Would like to see some more people testing it though.

Replace "void CFanController::GetCPUTempInternal()"  (xbmc/xbmc/utils/FanController.cpp) with this one:

CODE

void CFanController::GetCPUTempInternal()
{
 unsigned short cpu, cpudec;

  //HalReadSMBusValue(PIC_ADDRESS, CPU_TEMP, 0, (LPBYTE)&cpuTemp);
 if (!bIs16Box)
 {
    _outp(0xc004, (0x4c << 1) | 0x01);
    _outp(0xc008, 0x01);
    _outpw(0xc000, _inpw(0xc000));
    _outp(0xc002, (0) ? 0x0b : 0x0a);
    while ((_inp(0xc000) & 8));
    cpu = _inpw(0xc006);

    _outp(0xc004, (0x4c << 1) | 0x01);
    _outp(0xc008, 0x10);
    _outpw(0xc000, _inpw(0xc000));
    _outp(0xc002, (0) ? 0x0b : 0x0a);
    while ((_inp(0xc000) & 8));
    cpudec = _inpw(0xc006);

    cpuTemp = (float)cpu + (float)cpudec / 256.0f;
  }
  else
  {
    _outp(0xc004, (0x70 << 1) | 0x01);    // address
    _outp(0xc008, 0xC1);                // command
    _outpw(0xc000, _inpw(0xc000));        // clear possible old errors
    _outp(0xc002, 0x0d);                // start block transfer
    while ((_inp(0xc000) & 8));            // wait for response

    _inp(0xc004);                        // read out the data reg (no. bytes in block, will be 4)
    cpudec = _inp(0xc009);                // first byte
    cpu    = _inp(0xc009);                // second byte
    _inp(0xc009);                    
    _inp(0xc009);                        // read out the two last bytes, dont' think its neccesary
    
    cpuTemp = (float)cpu + (float)cpudec / 256.0f;
    cpuTemp *= 0.8f;                    // adjust the "too high" cpu temp
  }

}


I would be happy if someone could try it and report back.

regards
Pablot
Logged

JayDee

  • Archived User
  • Hero Member
  • *
  • Posts: 2311
1.6 Cpu Temp Sensor Found
« Reply #1 on: March 31, 2006, 08:26:00 AM »

Since my home pc went down earlier today i havent been able to radmin in and pass it on to any devs. Will make sure they get this info asap.
Logged

charlydoes

  • Archived User
  • Newbie
  • *
  • Posts: 2
1.6 Cpu Temp Sensor Found
« Reply #2 on: March 31, 2006, 08:52:00 AM »

First thing you should do is get rid of cpuTemp *= 0.8f;
It was added because someone thought the temperature on his 1.6 box was too high, took a wild guess at what it should be and multiplied by 0.8 to get it.
Logged

pablot

  • Archived User
  • Sr. Member
  • *
  • Posts: 499
1.6 Cpu Temp Sensor Found
« Reply #3 on: March 31, 2006, 09:24:00 AM »

QUOTE(JayDee @ Mar 31 2006, 05:26 PM) View Post

Since my home pc went down earlier today i havent been able to radmin in and pass it on to any devs. Will make sure they get this info asap.

okay, good.


QUOTE(charlydoes @ Mar 31 2006, 05:52 PM) View Post

First thing you should do is get rid of cpuTemp *= 0.8f;
It was added because someone thought the temperature on his 1.6 box was too high, took a wild guess at what it should be and multiplied by 0.8 to get it.

yeah, I know. But that wasn't the important thing. I still need to see this tested, the exact temperature isn't that important. By looking at the measurements I have I'd say that its constantly about 5-8C too high or something
Logged

pablot

  • Archived User
  • Sr. Member
  • *
  • Posts: 499
1.6 Cpu Temp Sensor Found
« Reply #4 on: April 01, 2006, 12:47:00 AM »

Okay, I have now figured out why the CPU temp _seems_ to be correct in a 1.6 xbox in current versions of XBMC. This is how it works:

Every thing is done over the SMBus/i2c:
1) GPU temp from reg 0x0A form the PIC
2) Read out the temp from the SMBus controller data reg
3) store it as gpuTemp
4) Request the CPU Temp high byte from the temperature sensor (@0x4C)
5) Read fails, but it isn't checked for so it reads out the SMBus controller data reg thinking its the CPU temp but it is the old GPU temp value.
6) Request the CPU Temp low byte from the temperature sensor (@0x4C)
7) same thing as in step 5 happens
8) calculate and store cpuTemp = CPUhigh + CPUlow/256, which in reality is cpuTemp = GPU + GPU/256

example, my temps are now at:
CPU: 49.79   GPU: 49.60

Remove the 0.8 factor that 1.6 temps get adjusted with:
GPU: 62

cpuTemp = GPU + GPU/256 = 62 + 62/256 = 62.2421875

add the 0.8 factor again

cpuTemp = 62.2421875*0.8 = 49.79375 ~ 49.79

and were back.. so, thats why it looks like your temp sensor is working in a 1.6!  ohmy.gif

Anyway, I hade pike test the sensor too and it works for him, but the temperature is jumpy for him too. So maybe calculate the displayed value by taking an average of 10 values or something? What do you think?
Logged

pablot

  • Archived User
  • Sr. Member
  • *
  • Posts: 499
1.6 Cpu Temp Sensor Found
« Reply #5 on: April 01, 2006, 10:20:00 AM »

Logged