Author Topic: Problems with internal temperature sensor - MCP3561  (Read 2107 times)

0 Members and 1 Guest are viewing this topic.

Offline Dave_PT

  • Frequent Contributor
  • **
  • Posts: 303
  • Country: pt
    • DavidMartinsEngineering
Problems with internal temperature sensor - MCP3561
« on: April 26, 2021, 10:17:09 am »
Hi.

I'm using a Microchip ADC (their forum is having problems, as I can't even register), MCP3561.
The problem should occur in the entire MCP346x and MCP356x family.

I need to read the internal temperature sensor. I know that the precision is nothing special, but it is just to get an idea.

Current status:
At this point I can write correctly and read all the registers.
I can get internal readings of "normal" and "inverted" Vref (via MUX) with saturation of the ADC FS as expected.
As recommended in the datasheet I have MUX[7:0] = 0xDE.
The OSR is high, so that the conversion frequency is low, OSR = 40960.
My Vref+ is a 2.5V reference and the Vref- is the AGND.

My circuit:


Problem:
When I read the ADCDATA register, the value changes a lot practically on all new readings (~ 146000 <-> ~150000), like some king of "step/jump".
Anyway, even if the value was stable, using the temperature conversion equation for a Vref of 2.5V, the value is wrong, as it would be around -119ºC (indoor temp ~25ºC).



temp[ºC] = 0.0013 * (2.5/3.3) * ADCDATA - 267.146 => 0.0013 * (2.5/3.3) * 150000 - 267.146 = -119.4ºC

Some help?
Is it normal the ADC value, with MUX=0xDE, fluctuating so much?
Is the temperature conversion equation really correct?


Thanks!
« Last Edit: April 26, 2021, 12:03:35 pm by Dave_PT »
 

Offline Dave_PT

  • Frequent Contributor
  • **
  • Posts: 303
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with internal temperature sensor - MCP3561
« Reply #1 on: April 26, 2021, 07:37:35 pm »
As expected, if I use the MUX to connect Vin+ and Vin- to the same point (for example the "Temp diode P"), the ADC converts the value to 0 (zero).

So far so good ... but I still have no explanation for the strange effect with Temp Diodes.


[EDIT]
If I invert the diode connections, the ADC conversion is approximately equal, but negative as expected.

So the conversion to IC Temperature continues to fail completely ....
« Last Edit: April 26, 2021, 07:54:25 pm by Dave_PT »
 

Offline MasterT

  • Frequent Contributor
  • **
  • Posts: 536
  • Country: ca
Re: Problems with internal temperature sensor - MCP3561
« Reply #2 on: April 26, 2021, 10:55:43 pm »
 Setup:    confg_reg: 6 :    1101 1110       (0xDE)
 Readings:
 
   0000 0000    0000 0101    0111 1110    1000 0001       (0x00057E81)
   0000 0000    0000 0101    0111 1110    1000 1001       (0x00057E89)
   0000 0000    0000 0101    0111 1110    1000 1011       (0x00057E8B)
   0000 0000    0000 0101    0111 1110    1000 1011       (0x00057E8B)
   0000 0000    0000 0101    0111 1110    1000 1000       (0x00057E88)
   0000 0000    0000 0101    0111 1110    1000 1001       (0x00057E89)
   0000 0000    0000 0101    0111 1110    0111 1010       (0x00057E7A)
   0000 0000    0000 0101    0111 1110    1001 0000       (0x00057E90)
   0000 0000    0000 0101    0111 1110    1000 0101       (0x00057E85)
   0000 0000    0000 0101    0111 1110    1000 1001       (0x00057E89)

 Formula math:
 TEMP (C) = 0.00133 * ADCDATA (LSb) – 267.146   
 TEMP (C) = 0.00133 * 360073 * (2.048/3.3) - 267.146   = 30.06 <- seems wrong.

 But if I use second formula from DS:   
 V(in.mV) = 0.2964 * TEMP (C) + 79.32
 rearranging:
 TEMP (C) = (V(in.mV) -79.32) / 0.2964 = (86.616 - 79.32) /0.2964 = 24.6
 I have correct value.
 
 What is going on, is that when I calculate V(IN.mV) I use slope & offset correction factors,

          double        off_mVolt       = -0.000242;
          double        slp_mVolt       =  0.981872;
         
 First formula uses  raw hex data w/o correction, and result is off.
 Ones more:
           
 ADCDATA-correct = ((360073 *0.981872) --0.000242);
           
 TEMP (C) = 0.00133 *ADCDATA * (2.048/3.3) - 267.146   = 24.67
 

Offline Dave_PT

  • Frequent Contributor
  • **
  • Posts: 303
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with internal temperature sensor - MCP3561
« Reply #3 on: April 27, 2021, 08:45:19 am »
Thanks for the answer.

The big difference between my setup and yours, basically is Vref. I use a 2.5V Vref and you use a 2.048V.

However my reading is practically half of yours in mV ...

Your setup:

raw_adc = 360073

mv = (360073*2.048)/2^23 = ~87.9mV

My setup:

raw_adc = 150000

mv = (150000*2.5)/2^23 = ~44.7mV

It's too perfect to be just a coincidence ...
You are using the gain at x1, right?

Thank you again!
 

Offline MasterT

  • Frequent Contributor
  • **
  • Posts: 536
  • Country: ca
Re: Problems with internal temperature sensor - MCP3561
« Reply #4 on: April 27, 2021, 12:18:49 pm »
 Here is confg_reg = 3;
    reg_bits = 0b10001011;

 boost = 10;  gain = 001, az-mux= 0
 

Offline Dave_PT

  • Frequent Contributor
  • **
  • Posts: 303
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with internal temperature sensor - MCP3561
« Reply #5 on: April 27, 2021, 01:43:41 pm »
So... you have all in default like me.

Very strange indeed.

Are you in "Continuous Conversion mode"?
 

Offline MasterT

  • Frequent Contributor
  • **
  • Posts: 536
  • Country: ca
Re: Problems with internal temperature sensor - MCP3561
« Reply #6 on: April 27, 2021, 04:18:33 pm »
No, one conversion at a time. Here is a list of config-data I'm setting at start-up, anything else is default.
    confg_reg = 1;
    reg_bits = 0b00000010;
    reciv_16 = transreceive_16(reg_bits, 1);

    confg_reg = 2;
    reg_bits = 0b00111000;
    reciv_16 = transreceive_16(reg_bits, 1);

    confg_reg = 3;
    reg_bits = 0b10001011;
    reciv_16 = transreceive_16(reg_bits, 1);

    confg_reg = 4;
    reg_bits = 0b10100000;
    reciv_16 = transreceive_16(reg_bits, 1);

    confg_reg = 5;
    reg_bits = 0b00000010;
    reciv_16 = transreceive_16(reg_bits, 1);

    confg_reg = 6;
    reg_bits = 0b00100011; // (+)CH2 Diff
    reciv_16 = transreceive_16(reg_bits, 1);

It's about right time to ask where did you get your adc from? I had evaluation board  with fake IC (Europe located maker, ADC-9). Than I get just adc IC.  Fake unit was not able to provide specification at 10MHz+ external clock, same time good IC could operate at 25MHz+, AFAIR 
 

Offline Dave_PT

  • Frequent Contributor
  • **
  • Posts: 303
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with internal temperature sensor - MCP3561
« Reply #7 on: April 27, 2021, 04:33:22 pm »
Thank you very much.

I will try to do the same registers setup and see if I get any difference in value.

I IC was purchased directly from Digikey and mounted on a PCB designed by me, with the circuit of the previous image.

The IRQ pin is generating pulses at the correct frequency, taking into account the OSR and the 20MHz MCLK.

Everything indicates that this is an original Microchip IC.
 

Offline Dave_PT

  • Frequent Contributor
  • **
  • Posts: 303
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with internal temperature sensor - MCP3561
« Reply #8 on: April 27, 2021, 11:02:03 pm »
I don't understand your config register 6 (MUX), but I suppose it is another application.

Everything seems to be OK with the registers, but in fact the converted value remains very low. By the conclusion of the previous post, the value had to be double this.

I just checket my Vref, using my Keysight U128, and the value is 2.501V... so there is no problem with the reference.

 :wtf:
 

Offline MasterT

  • Frequent Contributor
  • **
  • Posts: 536
  • Country: ca
Re: Problems with internal temperature sensor - MCP3561
« Reply #9 on: April 28, 2021, 12:09:14 am »
 My adc is mcp3562, reg-6 defines second diff input pair.

edit:
BTW, fake IC i find initially was UQFN packaged. Good ADC I get after that is in TSSOP-20
« Last Edit: April 28, 2021, 01:03:44 pm by MasterT »
 

Offline Dave_PT

  • Frequent Contributor
  • **
  • Posts: 303
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with internal temperature sensor - MCP3561
« Reply #10 on: May 05, 2021, 07:58:01 pm »
After a lot of debugging work, I activated the ADC's internal clock.
Everything started to work perfectly.

In other words, the original MCP3561 purchased from digikey, does not support the 20MHz clock that I was injecting.

PS: I can work with the ADC's internal prescaller and it seems to work ... keeping the external clock at 20MHz.
« Last Edit: May 05, 2021, 08:14:39 pm by Dave_PT »
 

Offline MasterT

  • Frequent Contributor
  • **
  • Posts: 536
  • Country: ca
Re: Problems with internal temperature sensor - MCP3561
« Reply #11 on: May 29, 2021, 03:46:35 pm »
 HI, have you any progress with 20MHz ?
I get 4 more adc's from mouser last month, marked as mcp561R - according to DS legitimate markings to save space not printing full name mcp3561R.
Have same issue initially, adc stops to update converted register results after pushing clock up, than I realized to reconfigure BOOST settings. It has to be 2,
Reg-3
  bit 7-6 BOOST[1:0]: ADC Bias Current Selection
          11 = ADC channel has current x 2
          10 = ADC channel has current x 1 (default)
          01 = ADC channel has current x 0.66
          00 = ADC channel has current x 0.5
Even it's working up to 23-25 MHz, I still not satisfied with noise level and (!) linearity. Especially INL, that's about 10x times worse than mcp3550 has. Sampling rate above 1ksps doesn't make any sense to me, since noise level rising above what I can get from internal 12-bits adc stm32G4
 

Offline Dave_PT

  • Frequent Contributor
  • **
  • Posts: 303
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with internal temperature sensor - MCP3561
« Reply #12 on: May 31, 2021, 01:36:17 pm »
I have already replicated all these tests and in fact I also fell far short of expectations.

I have a "pure" input signal, resulting from several previous filters, however I can't get the desired sampling rate (10KHz) with an acceptable noise level.
Currently, with 2.5V Vref respecting all indications and good practices, I am getting variations of + -25uV, after doing avg of 60values with ~ 1.2KHz sampling (auto conversion).

I have almost no advantage in using this ADC ...
 

Offline MasterT

  • Frequent Contributor
  • **
  • Posts: 536
  • Country: ca
Re: Problems with internal temperature sensor - MCP3561
« Reply #13 on: May 31, 2021, 01:52:58 pm »
I also tried to Lower frequency from 4.9152 MHz (default) to 1 /4 and even 1 / 8 using internal preselector. Linearity improves significantly, to +-1ppm - same as mcp3550, but since sample rate drops as well, have to lower OSR and consequently get very high noise level. Disappointed. 
 Thinking to get max11270 next month, they promised 130dB, 64kHz, and -122dB THD - well, not all this simultaneously.
Price biting, afraid to get fake again, will think over.
For today I want to play with ADS8691IPWR
 

Offline Dave_PT

  • Frequent Contributor
  • **
  • Posts: 303
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with internal temperature sensor - MCP3561
« Reply #14 on: May 31, 2021, 04:52:36 pm »
I didn't want to design and produce new PCBs  |O
This ADC is being a complete fail to my expectations ...

PS: using the ADC auto-zeroing algorithm, the result suffers little or no improvement ...
« Last Edit: May 31, 2021, 04:54:13 pm by Dave_PT »
 

Offline MasterT

  • Frequent Contributor
  • **
  • Posts: 536
  • Country: ca
Re: Problems with internal temperature sensor - MCP3561
« Reply #15 on: May 31, 2021, 05:44:00 pm »
I think microchip failed with MCP356X (& MCP3918 ).
What are you designing?
I
 

Offline Dave_PT

  • Frequent Contributor
  • **
  • Posts: 303
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with internal temperature sensor - MCP3561
« Reply #16 on: June 16, 2021, 06:43:11 pm »
Sorry for the delay mate.

I'm designing a nanoAmp meter... but now I've lost all desire to continue.
I will have to reproject using another ADC...
 

Offline MasterT

  • Frequent Contributor
  • **
  • Posts: 536
  • Country: ca
Re: Problems with internal temperature sensor - MCP3561
« Reply #17 on: June 18, 2021, 02:18:49 am »
 I was busy with TI ads8691 for a couple of weeks, had similar issue with noise.  I'm debugging everything on a breadboard and was using TSSOP-20 to DIP-20 adapter board.
Making 1 MSPS SAR adc to work is very tricky w/o 4-layers properly designed layout, and even worse - on a breadboard w/o good contacts.
But I made it. After I soldered 3x 10uF MLCC just right to the adapter - so contacts quality and 1 cm leads has no effect.  SINAD is only 2 dB off compare to DS, -90dB vs -92.
This makes me re-think again my strategy for mcp3561R (there is common part - tssop-20 to dip adapter). Today I did same thing - solder 10uF MLCC to AVDD & AGND, another to DVDD & DGND and third one to REF+ and REF-. Reference most important, cap should reside as close to IC as possible.
 And miracle happened - noise is flashed away.
Linearity is also fixed replacing 100 Ohms resistors at the inputs to 10 Ohms. Microchip erroneously recommends high R values, it's may works only below 10 MHz.
I have 2.2k in series with clock (17.2 MHz for now) and 470 Ohms in each SPI lines.   
 

Offline Dave_PT

  • Frequent Contributor
  • **
  • Posts: 303
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with internal temperature sensor - MCP3561
« Reply #18 on: June 23, 2021, 03:57:18 pm »
I'll try to apply some more filtering as a feature and see if there are any improvements in the conversion.

At this point neither speed nor noise level nor resolution seem to be consistent with the datasheet. Microchip support says there is nothing to do...

Perhaps these reasons explain why an ADC with similar characteristics costs twice or more than the MCP3561.
 

Offline MasterT

  • Frequent Contributor
  • **
  • Posts: 536
  • Country: ca
Re: Problems with internal temperature sensor - MCP3561
« Reply #19 on: June 26, 2021, 06:45:56 pm »
Can't agree on price vs quality comment.
I have tested 3 adc in almost the same conditions, microchip mcp3561R vs industry leaders AD & TI. It's not quite correct tests - since 3561R is SD adc, but 2 competitors SAR. It would make sense to compare mcp33131D-10 - just not have time for now.
Sampling rate for AD & TI about 500ksps - 1 MSPS. Microchip - 31.25ksps, OSR = 128, clock 14-16 MHz.
Approximate SINAD 90dB - means 15 noise-free bits.
 Linearity talks for itself.
 
The following users thanked this post: Dave_PT, thm_w

Offline MasterT

  • Frequent Contributor
  • **
  • Posts: 536
  • Country: ca
Re: Problems with internal temperature sensor - MCP3561
« Reply #20 on: July 05, 2021, 03:03:30 am »
I like mcp356x more and more. Check out this video, see how I installed capacitors and resistors for noise reduction.
https://youtu.be/K7W7U3Dg8vg
 

Offline Dave_PT

  • Frequent Contributor
  • **
  • Posts: 303
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with internal temperature sensor - MCP3561
« Reply #21 on: July 14, 2021, 06:55:42 pm »
Sorry I haven't said anything yet.
But now I'm going to take this more seriously.

Let's give it one more chance.

My current test conditions are as follows:

MCLK = 20MHz
Prescaler = 2
OSR = 40960 => ~61Hz sample frequency
Vref = 2.5V buffered
Gain = x1
MUX = CH0-CH0, input internaly shorted

Expected result: conversion value ideally equal to zero or very close to it.

Actual result: conversion value in the order of -1082 (average of 300 measurements), with a maximum variation of 39 ADC counts.
With MUX in CH1p-CH1n configuration the conversion result is the same.

Do you have a result similar to this one?

This is my PCB with the best possible layout.
With separate analog and digital power for better noise filtering (you can see the separation of the ground planes next to the refdes "C28" at the bottom.).
« Last Edit: July 14, 2021, 07:06:51 pm by Dave_PT »
 

Offline MasterT

  • Frequent Contributor
  • **
  • Posts: 536
  • Country: ca
Re: Problems with internal temperature sensor - MCP3561
« Reply #22 on: July 14, 2021, 08:26:36 pm »
Settings: OSR = 64, 16 MHz, prescaler = 1, data rate = 62.5 ksps, I can't validate for OSR = 40960, as my code runs on block structure, and filling 32768 samples at 60 sps would takes hours.
MUX = FF, both input jumped to Internal V CM.

This is what I have inside input buffer:

   *0   -5   -5   -5   -4   -5   -6   -6   -5   -4   -5   -5   -4   -5   -4   -5   -6
   16   -4   -5   -5   -5   -5   -4   -6   -3   -4   -3   -5   -4   -6   -4   -4   -4
   32   -5   -4   -4   -5   -5   -7   -5   -4   -5   -4   -5   -3   -5   -5   -4   -3
   48   -5   -5   -4   -5   -4   -6   -3   -4   -4   -3   -5   -4   -4   -6   -4   -4
   64   -7   -6   -5   -5   -4   -6   -5   -6   -3   -6   -5   -5   -5   -3   -7   -5
   80   -7   -5   -6   -4   -6   -3   -7   -5   -7   -5   -6   -5   -6   -6   -6   -5
   
Data "casting" to get AC:
Code: [Select]
          int32_t tempr = adc[0][i];
          tempr &= 0x00FFFFFF;         
          if(tempr & (1L<<23))
            tempr |= 0xFF000000;
          tempf = tempr;
          tempf /= 64.0;
          fft_r[i] = tempf;//tempr;

As you can see there is a division /64 to scale everything down to 18-bits (compatibility with AD & TI tests).
So, -5 x 64 = -   320, -> average DC offset (adc was not calibrated);
    +-1 x 64 -> 64 "counts" - essentially noise, +-2 x 64 -> 128 peak-to-peak noise;

What I see from the picture, your hardware design is missing antialising filter at the inputs of the ADC.  I have 10nF in between inputs, and 4.7nF each to ground. [attach=1]
The name "antialising" is actually misleading, better to call "OPA protector against ADC charge kickback". Microchip's adc's are not so aggressive like TI, but still there is switching capacitor load present.
Another possible issue - reference driver mcp6002 may oscillate.
 

Online uer166

  • Frequent Contributor
  • **
  • Posts: 327
  • Country: us
Re: Problems with internal temperature sensor - MCP3561
« Reply #23 on: July 14, 2021, 08:44:31 pm »
Expected result: conversion value ideally equal to zero or very close to it.

Actual result: conversion value in the order of -1082 (average of 300 measurements), with a maximum variation of 39 ADC counts.
With MUX in CH1p-CH1n configuration the conversion result is the same.

Why would you expect the offset to be 0? Did you calibrate the ADC? While the drift spec for offset on these Microchip parts is great, the initial offset is something like +- a few thousand counts. If I did the math right, the datasheet claims +- 900uV offset, which would be +-12500 counts or so at 24 bits. I don't see a problem with your measurement given that, and the 39 count variation seems very good also. I've used MCP3914 before and the analog specs are impressive, although the amount of silicon bugs and various garbage requiring ugly workarounds is less than ideal.
 

Online uer166

  • Frequent Contributor
  • **
  • Posts: 327
  • Country: us
Re: Problems with internal temperature sensor - MCP3561
« Reply #24 on: July 14, 2021, 08:47:17 pm »
(you can see the separation of the ground planes next to the refdes "C28" at the bottom.).

This is generally a really bad idea, keep one and only solid ground plane, and low-pass filter the AVDD for the chip if you want to improve PSRR (which honestly might not be needed, you already get good PSRR as-is, so if your 3V3 is quiet enough as-is you might be better without).
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf