I am using MPC5744P and have currently an issue about the ADC module.
One of our applications of ADC is measuring PT100 resistor values to determine the temperature. I have found out, if there is no PT100 sensor connected, the measured values are random. They can be any values:
If a sensor is connected, the values are stable and correct. Is this normal behavier of ADC?
Here is the schematic of connection:
Cause we take like 60 samples and calculate the average, then apply a formular to get the temperature value. If the values are really random, the average of them is most likely still beyond the maximum possible value for temperature calculation. However, we have detected, it happens twice per day, that the average of these random samples is possible for temperature calculation, which means we have measurement even there is no sensor connected. Every time it could last 60 minutes, then back to the situation that the average is again high enough to be filtered out. This sounds for me like a periodical influence from the evironment. Is there maybe any issue known familiar?
Thanks for any reply in advance.
I just replied to this post, and this new forum lost the lot.
Repeating what I just entered...
If you enable pullups or pulldowns it will affect the reading. Since those internal resistors aren't precise, you can't correct for them.
You could enable the resistors, but only to TEST to see if the PT100 is there. Then you'd have to disable them.
But you've already got R724 there anyway. If that input reads close to 3.3V then the PT100 isn't there. Problem solved.
If ADC input is not connected, it'll be Hi-Z - it means some random value coming from inducted noise will be converted.
To prevent this you should enable internal pull up/down resistor (PCRn.WPE and PCRn.WPS). Then you will read high/low value.
I could not write the PUE or PUS bit for these MSCR registers, for example B:
After configuration only the APC bit has changed.
I have configured like this:
if(l_ulchmask & CH0Smask)
SIUL2.MSCR[SIUL_PB7].R = SIUL_ANALOG | SIUL_PULL_DOWN | SIUL_HYS; // 0x00450000
Other MSCR register of digital input can be configured with pull up or pull down, e.g.: E:
Sorry, it seems analog pads does not have this option on this device.
I suppose you need to prevent incorrect measurements in case the pad is open
In this case you have several other options:
1) You can add external pull resistor
2) To implement ADC self test as depicted in the device's safety manual. Pay attention to section 220.127.116.11.2.1.4 ADC_SWTEST_TEST1 (open detection)