ADC values don't follow the inputs?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
JoGr_3357391
Level 4
Level 4
10 likes given 5 likes given First like received

My project has a couple of thermistors along with a few other analog values that need monitoring. All associated pins are high-Z Analog inputs with high initial drive (tried both), fed into a ADC_SAR_SEQ_P4_v2_50.
Now, I thought this would be a slam-dunk. I followed a number of examples - most of them agreed, so I made my project look like those.

But after starting a conversion and waiting for completion, I don't see any meaningful change in the data. I can measure voltage where the thermister comes into the board, and it is indeed changing.

I thought perhaps I needed external terminal for the pins, but it didn't seem to matter, and other examples don't typically use it. I'm not using a hardware trigger - documentation for ADC_Start() indicates it's a substitute ( ADC_FW_TRIGGER), and ADC_IsEndConversion() seems entirely happy.

I've uploaded an archive of the case where there are no external terminals for the pins, though that doesn't seem to matter.

I am in a quandary - can anyone tell me what bit I have messed up?

Thanks,
John

0 Likes
1 Solution

In a completely unanticipated turn of events, I _wasn't_ to blame. I tested one of the thermisters, and measured different voltages at different temperatures. It turned out that was the thermister behind the opamp, so that input was not valid. And the hardware engineer determined that the other thermister was not wired correctly. Now I get changing values when I vary the temperature at the thermisters.
Problem solved. John absolved.

Thanks to all for reading, and thanks to Rajiv for replying. I do appreciate it.
John

View solution in original post

0 Likes
7 Replies
JoGr_3357391
Level 4
Level 4
10 likes given 5 likes given First like received

I have since realized that the "external terminal" is a cosmetic feature that allows the schematic to illustrate external components such as voltage dividers and such. That point has eluded me for the month or so that I've been dealing with this platform.

0 Likes
Anonymous
Not applicable

John,

1. Opamp doesn't seem to be enabled. Please use the API Opamp_Start().

2. ADC is configured with hardware trigger. So, StartConvert() API executes one conversion. But, in the function read_adc() multiple conversion is being expected with a single StartConvert() function call. Is the code getting stuck in line 64 of adc.c file (observed in debugging mode)?

- Rajiv 

0 Likes

Ooops - I'll enable the opamp, but that explains perhaps one of five channels.
If I understand the documentation and code properly,  I anticipate one conversion, on all five channels, with one call to StartConvert(). The subsequent call to IsEndConversion() returns as expected, perhaps a bit too quickly, but that's speculation.
Thank you.

0 Likes
Anonymous
Not applicable

You are right on conversion of all channels with single call to the function StartConvert(). However, IsEndConversion() function will clear EOS_INTR bit in INTR register, once the result is available. So, in the next call to this function, it loops forever checking for EOS_INTR, as the conversion is not initiated again.

-Rajiv

0 Likes

"loops forever" implies that control never returns to the calling function, which is not the case.  IsEndConversion() does not hang.
Thanks,
John

0 Likes
Anonymous
Not applicable

My bad. In the while loop in line 71 of adc.c file, the condition check is !status. Do while loop will run only once as the argument is TEC_ADC_WAIT_FOR_RESULT to the function IsEndConversion(). In that case, "attempts" variable will not have any impact.

-Rajiv

In a completely unanticipated turn of events, I _wasn't_ to blame. I tested one of the thermisters, and measured different voltages at different temperatures. It turned out that was the thermister behind the opamp, so that input was not valid. And the hardware engineer determined that the other thermister was not wired correctly. Now I get changing values when I vary the temperature at the thermisters.
Problem solved. John absolved.

Thanks to all for reading, and thanks to Rajiv for replying. I do appreciate it.
John

0 Likes