Hi,
We are using MIMXRT1172AVM8A processor in our board. We want to use ADC feature of the processor. The VREFH pin is connected to 1.8V.
In our device our ADC input signal is 0 to 3.3V range. Can we give this pin directly to the processor ADC channel pin.
If yes, than what modification we need to do in the processor configuration registers for detecting this
0 to 3.3V range at the ADC channel input pin. Please suggest.
Regards,
Vihang Waze
Solved! Go to Solution.
I have test your code today.
I do not found any ADC result issue.When I give a 2V voltage signal, the ADC result is about 2133 as below picture.
When I give 1.2V voltage signal, the ADC result is about 1280 as below picture.
The test condition :
Note:Due to use SDK version: 2.12.0, I change "triggerPrioirtyPolicy" to "triggerPriorityPolicy" in line 140 of peripherals.c
Hi Lucas,
Thank you for your reply and details
For initilal verification we tested the ADC on the iMRT1176 Eval kit as per the details you shared.
The iMRT1176 Eval kit has the VREFH connected to 1.8V
We configured the CSALE bit to '0' for the particular ADC channel pin and applied varoius signal levels 0V, 1.2V, 1.8V, 2V, 2.5V, and 3.3V.
For levels between 0V to 2.0V, we could read the ADC values as 0 to 3111 (12-bit ADC) but,
For all the voltage levels above 2V upto 3.3V we observed that the ADC is reading 4095 for all the levels 2.1V, 2.5V, 3V, 3.3V.
Can you help and let us know, if we are missing any more configurations to be change in the processor code
Thanks for your kind support
Regards
Vihang Waze
Firstly, double check if he CMDLx[CSCAL] register is set to “0” rightly in IDE and this CMDLx is right associate ADC channel corretly.
Secondly, please make sure your supply signal ground connect to the board ground.
Thirdly, you can set CMDL[CSCAL] to “1”,and then check that give 0V, 1.2V, 1.8V,the ADC values is right or not.
Signal | ADC value(12 bits) |
0 | 0 |
1.2 | 2730 |
1.8 | 4095 |
Hi Leon_Li1,
As you said we checked by setting CMDL[CSCAL] to “1” we are getting correct values as mentioned in the table.
But we want to measure ADC voltage from 0 to 3.3. Hence after setting CMDL[CSCAL] to "0" the input range is extended till 0 to 2V only i.e.
Input | ADC value
0V | 0
2V | 4095
Is this right in case of Vref = 1.8? or should we set the Vref = 1.54?
Thanks for your support
Regards
Vihang Waze
It is right when Vref = 1.8.
When set CMDL[CSCAL] to "0", the ADC result should be
Signal | ADC value(12 bits) |
0v | 0 |
1.2v | 1280 |
1.8v | 1920 |
2v | 2133 |
Please double check ADC value of 1.2v and 1.8V. Make sure the CMDL[CSCAL] to "0" rightly and work.
There are some demos in SDK. Such as "lpadc_polling", you can use this demo switch CMDL[CSCAL] to test.
I am work from home, so the resource is limited.
Also you can provide your code, I will test it ASAP.
Hi Leon,
As you said we checked with 1.8V Vref and setting CSCAL bit to '0'.
At 2V we are getting 4095 only
I have shared you the code . . Please check from your side if we are missing any configuration
Please find the attachment
Thank you for your help and support.
Also we would like your opinion if we are receiving the input signal is 0 to3.3V range on the ADC pin then should we connect the vref to 1.54V to sample the complete signal? Please give your suggestions on this
Regards,
Vihang
I have test your code today.
I do not found any ADC result issue.When I give a 2V voltage signal, the ADC result is about 2133 as below picture.
When I give 1.2V voltage signal, the ADC result is about 1280 as below picture.
The test condition :
Note:Due to use SDK version: 2.12.0, I change "triggerPrioirtyPolicy" to "triggerPriorityPolicy" in line 140 of peripherals.c
Hi Leon_Li1,
We tested with the code you shared and we were able to read 2133 at 2V, and 1280 at 1.2V and can go up till 3.3V.
Can you please share in detail what changes you made in the code to get the above values. This will help us to correct our approach for other ADC pins configuration
Thank you for your valuable support and help.
Regards,
Vihang
Due to use SDK version: 2.12.0, I only changed "triggerPrioirtyPolicy" to "triggerPriorityPolicy" in line 140 of peripherals.c. Please make sure your SDK version No..
I did not change any others.
I think there were some issues in your test process before.