LM7002M Temperature Calculation


#1

I am trying to understand what is going on in this code, since the returned values do not seem accurate, and the logic here does not match what I understand from the Programming and Calibration Guide.

Modify_SPI_Reg_bits(LMS7_MUX_BIAS_OUT, 2);
This should route Vptat_600mV and vr_cal_ref=600mV to bias_top_adcin, but then the datasheet says The ratio between the two will be proportional to absolute temp. In the Measurement block Control Diagram we can see the loop that generates:
MEASR_TREF_VAL<7:0> (0x0606[15:8])
MEASR_TPTAT_VAL<7:0> (0x0606[7:0])

Why are these values scaled and then subtracted instead of generating the ratio. I also see nothing that documents this offset of 50.7C.

I feel like I must be missing something critical to how this works.

{
    CalibrateInternalADC(32);
    Modify_SPI_Reg_bits(LMS7_RSSI_PD, 0);
    Modify_SPI_Reg_bits(LMS7_RSSI_RSSIMODE, 0);
    uint16_t biasMux = Get_SPI_Reg_bits(LMS7_MUX_BIAS_OUT);
    Modify_SPI_Reg_bits(LMS7_MUX_BIAS_OUT, 2);

    this_thread::sleep_for(chrono::microseconds(250));
    const uint16_t reg606 = SPI_read(0x0606, true);
    float Vtemp = (reg606 >> 8) & 0xFF;
    Vtemp *= 1.84;
    float Vptat = reg606 & 0xFF;
    Vptat *= 1.84;
    float Vdiff = Vptat-Vtemp;
    Vdiff /= 3.9;
    float temperature = 50.7+Vdiff;
    Modify_SPI_Reg_bits(LMS7_MUX_BIAS_OUT, biasMux);
    lime::debug("Vtemp 0x%04X, Vptat 0x%04X, Vdiff = %.2f, temp= %.3f", (reg606 >> 8) & 0xFF, reg606 & 0xFF, Vdiff, temperature);
    return temperature;
}```

#2

Looks like temperature related issue has already been reported on Github, but has not been fixed yet.


#3

Yes, I was asking here for more information about this part of the hardware so that I can throw a patch together since I think the documentation does not have all the needed information.


#4

@andrewback is there anyone from the Lime team that could answer how this hardware block works?


#5

@Zack would be the best person to ask.


#6

Hello,
same problem here: the temperature sensor shows readings between 48 and 51 degree, irrespective of the real temperature.
Please, someone from the Lime team step in and get this resolved.
Many thanks in advance.
Kind regards
Matthias


#7

Temperature is derived from a separate device, places on the board, between the FPGA & LMS chip. a reading from any of the working chips.
It is NOT readinginternal working temps of either main chip onboard.
IC 16
LM75
This is the temp sensor. It is on page 12 of the V1.4 schematics in .pdf.
“PCB note: Place between FPGA and LMS”.

Whatever it’s circuitry, it does NOT return any usable temperature.
47*-53* is the max I have seen. 47* was only because I had it in the refridgerator for 1/2 hour & plugged it right in & checked with LimeSuite.
Also, if powering a fan from the board, it is designed to turn on at 55*, of which I have never seen as a reading.
Maybe I shouls throw it in the oven for a bit?

Ed


#8

Temperature needs to be read from the LMS & FPGA for safety.

Ed


#9

The value of board temperature sensor that is located between FPGA and LMS7 on LimeSDR-USB can be checked form LimeSuiteGUI “modules->board controls->Board Temperature”. From my experience it returns correct values.


#10

This weekend, I will use a temp probe & refridgerate the board. I think you will see that with a range of 47*-54* must be wrong.

Ed


#11

My understanding is that there are two temperature sensors on each board.

LimeSDR-USB

LimeSDR-Mini

I do not think that this thread would exist if there was some public information on the LMS7002M registers:
0x0600(RSSI_PD/RSSI_RSSIMODE) and register
0x0606(RSSI_TREF_VAL/RSSI_TVPTAT_VAL)

The little information I could find was in LimeSuite/src/lime/LMS7002M_parameters.h and it is just their address, MSB, LSB, default value, name and tooltip. Not the details required to use the registers, which should be in some public documentation.

LMS7_DAC_CLKDIV = { 0x0600, 15, 8, 15, "DAC_CLKDIV", "Clock division ratio for measurement loop" };
LMS7_RSSI_RSSIMODE = { 0x0600, 1, 1, 0, "RSSI_RSSIMODE", ""};
LMS7_RSSI_PD = { 0x0600, 0, 0, 0, "RSSI_PD", ""};
LMS7_RSSI_TREF_VAL = { 0x0606, 15, 8, 0, "RSSI_TREF_VAL", "Stores the temperature reference value"};
LMS7_RSSI_TVPTAT_VAL = { 0x0606, 7, 0, 0, "RSSI_TVPTAT_VAL", "Stores the voltage proportional to absolute temperature value"};

#12

Ed,

I agree with you. The reading makes little sense, your feedback will be very interesting.


#13

The Lime is in the freezer, now. Can’t find the temp probe for the meter, but, assume below 0C.
Should take about 30 seconds to get it hooked up & test temp with LimeSuite.
Also, figuring out RF Explorer Spectrum analyzer & sig gen, hooked to the laptop, while the Udoo X86 Ultra is running the LimeSRD USB.
Oh, Simon, 4 instances of BFM at the 3.072 setting, with just a hair of popping. I would say that’s pretty darn good !!!
So, after 45 minutes in the freezer, I got a reading of 43.5
C from LimeSuite & 44C from SDR-Console.
Something is obviously wrong with the temp. system.
Now, the fan is controlled by this faulty system (Turns fan on at 55
C from documentation) With the readings skewed this far, Lime Microsystems should send out notice to NOT use the 3VDC FAN header from the LimeSDR USB !!!

This needs to be fixed.

Ed
AA7QQ


#14

@Zack could you respond to my question in the original post on this thread? It would be great to just get some clarification on the hardware block, specifically around the TREF and TPTAT values. The document seems to not be complete about how they are proportional to the absolute temperature


#15

The line that applies from the LMS7002M register map document on page 45 is “2 - Vptat_600 mV and vr_cal_ref=600 mV is passed to the ADC input MUX. The ratio between the two will be proportional to the absolute temp.”

That test is selected by this line of code: Modify_SPI_Reg_bits(LMS7_MUX_BIAS_OUT, 2);

So the setup sounds like it could be something very similar to this: https://en.wikipedia.org/wiki/Silicon_bandgap_temperature_sensor

There is a temperature-independent bandgap reference (vr_cal_ref=600 mV) where the the circuit maintains an internal voltage source that has a positive temperature coefficient and another internal voltage source that has a negative temperature coefficient. The two are summed together, and the temperature dependence is cancelled thus providing a fixed voltage reference that is independent of temperature (In this particular case 600 mV).
By comparing that constant reference voltage to the internal voltage source with a positive temperature coefficient (Vptat_600 mV) the temperature inside the device can be calculated.

  • vr_cal_ref (AKA “RSSI_TREF_VAL” - bits 15 to 8 of register 0x0606 ) is a temperature-independent bandgap reference voltage of exactly 0.6 volts.
  • Vptat_600 (AKA “RSSI_TVPTAT_VAL” - bits 7 to 0 of register 0x0606 ) is a temperature-dependent bandgap voltage of around ~0.6 volts.

If the above is the case then the current code could possibly be replaced by something much simpler like the below:
(if you assume that 300K (26.85°C) is room temperature (25°C) and that at exactly 300K the negative temperature coefficient is zero, which may be not be perfectly true, but it probably should be close enough):

....
    const uint16_t reg606 = SPI_read(0x0606, true);
    float Vref = (reg606 >> 8) & 0xFF;
    float Vptat = reg606 & 0xFF;
    temperature=(Vptat/Vref)*300 - 273.15 // temperature in degrees centigrade converted from kelvin
...

P.S. vptat stands for Voltage Proportional to Absolute Temperature, the second value the reference voltage “should” be a static number at all temperatures (unless the voltage sits between two levels of the ADC and random noise toggles it between two numbers).

And if this gives dire results, there is always the other test on the register map document on page 45(*). Using the External 10k referance resistor on the PCB (“R11” on both the LimeSDR-USB and LimeSDR-mini) that could be used. But it is a 1% tolerance resistor which has an extremely low TCR (Temperature Coefficient of Resistance) of ±100ppm℃. So over it’s entire operating temperature range (-55℃ to 155℃) its resistance changes by less than 3%, and over the operating temperature range of the LMS7002M (-40℃ to 85℃) less than 1.25%.

Maybe a higher temperature range could be possible with that external 10 kOhm reference resistor. Or maybe a much lower temperature range with a higher resolution, there is not really enough information to tell.

(*) “1 - vr_ext_bak and vr_cal_ref=600mV is passed to the ADC input MUX. Vr_ext_bak is the voltage read on the off-chip 10 kohm reference resistor. Ip60f is connected to r_ext=10 kohm and RP_CALIB_BIAS is changed until vr_ext becomes 600 mV.”
RP_CALIB_BIAS is only 5-bits and has a default value of 16, so it is in the middle of the range but only has a total of 32 discrete states or 32 possible temperatures steps. I’m not sure if the really low TCR of the external resistor is a good thing or bad thing, without knowing what Ip60f is in the circuitry inside the chip, it is difficult to know. There really needs to be more documentation available publicly.


#16

What I am seeing on the schematic is that the temp. sensor chip LM75 is connected to the FX3 via SPI. Another lead is LM75 OS, which leads to “NF” R65 (Not Filled)., which if filled, would control the fan directly.
Then, the “Fan Control” signal is coming from the FPGA Bank 1 pin E4.
All that code stuff is for the more knowledgable. Same with the math…
So, the temp sensor sends to the FX3 SPI bus, gets to the FPGA & controls the fan.
That is my understanding of the system.
Now, the FX3 could have a temp sense in it, but I have not looked into it.
Whatever is happening to the conversion is definitely wrong, somewhere.
I hope this makes it a bit easier for the Techies to correct.

Ed
AA7QQ


#17

Hi AA7QQ,

You keep bringing up on-board temperature sensor (LM75) but this topic is about incorrect LMS7002M temperature sensor values. So just to clarify, are you also getting wrong values from LMS75 ( LimeSuiteGUI “modules->board controls->Board Temperature")? If that is correct, then it is a different issue. Personally, I have never noticed issue with LMS75 values.


#18

This is with the temperature reading from LimeSuite (Board connected to LimeSuite & reading the temp on the main page) & SDR-Console. I see no way that 45 minutes in the freezer can give a 43.5 & 44 degrees, respectively. First reading was within 30 seconds. second reading was about 45 seconds.

I mention the LM75, because it is on the schematic as a “Temp Sensor”.

I am not one who understands code & the such. I am just going by what I see on the schematics & thought giving the paths between it & fan control may help.

If the temp is derived from the LMS chip, it surely should not heat up that fast.

I also see that the fan control looks like it was to be controlled by the LM75, but R65(?) was not populated, as per schematics to allow fan control from it.

How I see it, is that the Temp sensor feeds into the FX3 chip. Then, the Fan Control comes from the FPGA.

Ed


#19

Please, please, please look at this issue and either explain why we see the values we do or maybe fix the problem? There is no way the temperature is unchanged with/without a heat sink, fans, cooling.

It must be wrong!


#20

Tagging @IgnasJ.