This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSPM0L1306: ADC12_0 values not consistence

Part Number: MSPM0L1306

I am working on ADC12_0 and here is details of it:

ADC Clock Source: SYSOSC
ADC Clock Frequency 31.00MHz
Sample Clock Divider: Divide by 8
Calculated Sample Clock Frequency: 4.00 MHz

Conversion Mode: Single
Repeat Mode Enabled

Input Channel: Channel_0 (PA27)
Reference Voltage: VDDA 3.3Volt
Desired Sample Time 0 : 250uSec

Enable Interrupts: MEM0 result loaded interrupt

Kindly check the following code on which i am monitoring ADC values.

The fluctuation of values you can see clearly on attached pictures.

(for same VDDA values are completely different u can check that on attached excel sheet on column B and C) Column C values are expected output and column B is incorrect one.

Sr. No. gAdcResult for VDDA(3.3V) INCORECT gAdcResult for VDDA(3.3V)- Expected and correct
1 3124 2442
2 3124 2442
3 3124 2442
4 3124 2442
5 3124 2442
6 3124 2442
7 3124 2442
8 3124 2440
9 3124 2440
10 3124 2440
11 3124 2440
12 3124 2440
13 3124 2440
14 3124 2440
15 3124 2440
16 3124 2440
17 3124 2440
18 3124 2440
19 3124 2440
20 3124 2440
21 3124 2440
22 3124 2440
23 3124 2440
24 3124 2440
25 3124 2440
26 3124 2440
27 3124 2440
28 3124 2440
29 3124 2440
30 3124 2440
31 3124 2440
32 3124 2440
33 3124 2440
34 3124 2440
35 3124 2440
36 3124 2440
37 3124 2440
38 3124 2440
39 3124 2440
40 3124 2440
41 3124 2440
42 3124 2440
43 3124 2440
44 3124 2440
45 3124 2440
46 3124 2440
47 3124 2440
48 3124 2440
49 3124 2440
50 3124 2440
51 3124 2440
52 3124 2440
53 3124 2440
54 3124 2440
55 3124 2440
56 3124 2440
57 3124 2440
58 3124 2440
59 3124 2440
60 3124 2440
61 3124 2440
62 3150 2440
63 3150 2440
64 3150 2440
65 3150 2440
66 3150 2440
67 3150 2440
68 3150 2440
69 3150 2440
70 3150 2440
71 3150 2440
72 3150 2440
73 3150 2440
74 3150 2440
75 3150 2440
76 3150 2440
77 3150 2440
78 3150 2440
79 3150 2440
80 3150 2440
81 3150 2440
82 3150 2440
83 3150 2440
84 3150 2440
85 3150 2440
86 3150 2440
87 3150 2440
88 3150 2440
89 3150 2440
90 3150 2440
91 3150 2440
92 3150 2440
93 3150 2440
94 3150 2440
95 3150 2440
96 3150 2440
97 3150 2440
98 3150 2440
99 3150 2440
100 3150 2440
101 3150 2440
102 3150 2440
103 3150 2440
104 3150 2440
105 3150 2440
106 3150 2440
107 3150 2440
108 3150 2440
109 3150 2440
110 3150 2440
111 3150 2440
112 3150 2440
113 3150 2440
114 3150 2440
115 3150 2440
116 3150 2440
117 3150 2440
118 3150 2440
119 3150 2440
120 3150 2440
121 3150 2440
122 3150 2453
123 3150 2453
124 3150 2453
125 3150 2453
126 3150 2453
127 3150 2453
128 3150 2453
129 3150 2453
130 3150 2453
131 3150 2453
132 3150 2453
133 3150 2453
134 3150 2453
135 3150 2453
136 3150 2453
137 3150 2453
138 3150 2453
139 3150 2453
140 3150 2453
141 3150 2453
142 3150 2453
143 3150 2453
144 3150 2453
145 3150 2453
146 3150 2453
147 3150 2453
148 3150 2453
149 3150 2453
150 3150 2453
151 3150 2453
152 3150 2453
153 3150 2453
154 3150 2453
155 3150 2453
156 3150 2453
157 3150 2453
158 3150 2453
159 3150 2453
160 3150 2453
161 3150 2453
162 3150 2453
163 3150 2453
164 3150 2453
165 3150 2453
166 3150 2453
167 3150 2453
168 3150 2453
169 3150 2453
170 3150 2453
171 3150 2453
172 3150 2453
173 3150 2453
174 3150 2453
175 3150 2453
176 3150 2453
177 3150 2453
178 3143 2453
179 3143 2453
180 3143 2453
181 3143 2453
182 3143 2453
183 3143 2453
184 3143 2453
185 3143 2453
186 3143 2453
187 3143 2453
188 3143 2453
189 3143 2453
190 3143 2453
191 3143 2453
192 3143 2453
193 3143 2453
194 3143 2453
195 3143 2453
196 3143 2453
197 3143 2453
198 3143 2453
199 3143 2453
200 3143 2453
201 3143 2453
202 3143 2453
203 3143 2453
204 3143 2453
205 3143 2453
206 3143 2453
207 3143 2453
208 3143 2453
209 3143 2453
210 3143 2453
211 3143 2453
212 3143 2453
213 3143 2453
214 3143 2453
215 3143 2453
216 3143 2453
217 3143 2453
218 3143 2453
219 3143 2453
220 3143 2453
221 3143 2453
222 3143 2453
223 3143 2453
224 3143 2453
225 3143 2453
226 3143 2453
227 3143 2453
228 3143 2453
229 3143 2453
230 3143 2453
231 3143 2453
232 3143 2453
233 3143 2453
234 3143 2453
235 3143 2453
236 3143 2453
237 3143 2453
238 3143 2455
239 3143 2455
240 3143 2455
241 3143 2455
242 3143 2455
243 3143 2455
244 3143 2455
245 3143 2455
246 3143 2455
247 3143 2455
248 3143 2455
249 3143 2455
250 3143 2455
251 3143 2455
252 3143 2455
253 3143 2455
254 3143 2455
255 3143 2455
256 3143 2455
257 3143 2455
258 3143 2455
259 3143 2455
260 3143 2455
261 3143 2455
262 3143 2455
263 3143 2455
264 3143 2455
265 3143 2455
266 3143 2455
267 3143 2455
268 3143 2455
269 3143 2455
270 3143 2455
271 3143 2455
272 3143 2455
273 3143 2455
274 3143 2455
275 3143 2455
276 3143 2455
277 3143 2455
278 3143 2455
279 3143 2455
280 3143 2455
281 3143 2455
282 3143 2455
283 3143 2455
284 3143 2455
285 3143 2455
286 3143 2455
287 3143 2455
288 3143 2455
289 3143 2455
290 3143 2455
291 3143 2455
292 3143 2455
293 3172 2455
294 3172 2455
295 3172 2455
296 3172 2455
297 3172 2455
298 3172 2455
299 3172 2455
300 3172 2455
301 3172 2455
302 3172 2455
303 3172 2455
304 3172 2455
305 3172 2455
306 3172 2455
307 3172 2455
308 3172 2455
309 3172 2455
310 3172 2455
311 3172 2455
312 3172 2455
313 3172 2455
314 3172 2455
315 3172 2455
316 3172 2455
317 3172 2455
318 3172 2455
319 3172 2455
320 3172 2455
321 3172 2455
322 3172 2455
323 3172 2455
324 3172 2455
325 3172 2455
326 3172 2455
327 3172 2455
328 3172 2455
329 3172 2455
330 3172 2455
331 3172 2455
332 3172 2455
333 3172 2455
334 3172 2455
335 3172 2455
336 3172 2455
337 3172 2455
338 3172 2455
339 3172 2455
340 3172 2455
341 3172 2455
342 3172 2455
343 3172 2455
344 3172 2455
345 3172 2455
346 3172 2455
347 3172 2455
348 3172 2455
349 3172 2455
350 3172 2455
351 3172 2433
352 3172 2433
353 3172 2433
354 3172 2433
355 3172 2433
356 3172 2433
357 3172 2433
358 3172 2433
359 3172 2433
360 3172 2433
361 3172 2433
362 3172 2433
363 3172 2433
364 3172 2433
365 3172 2433
366 3172 2433
367 3172 2433
368 3172 2433
369 3172 2433
370 3172 2433
371 3172 2433
372 3172 2433
373 3172 2433
374 3172 2433
375 3172 2433
376 3172 2433
377 3172 2433
378 3172 2433
379 3172 2433
380 3172 2433
381 3172 2433
382 3172 2433
383 3172 2433
384 3172 2433
385 3172 2433
386 3172 2433
387 3172 2433
388 3172 2433
389 3172 2433
390 3172 2433
391 3172 2433
392 3172 2433
393 3172 2433
394 3172 2433
395 3172 2433
396 3172 2433
397 3172 2433
398 3172 2433
399 3172 2433
400 3172 2433
401 3172 2433
402 3172 2433
403 3172 2433
404 3172 2433
405 3172 2433
406 3172 2433
407 3172 2433
408 3172 2433
409 3142 2433
410 3142 2433
411 3142 2433
412 3142 2433
413 3142 2433
414 3142 2433
415 3142 2433
416 3142 2433
417 3142 2433
418 3142 2433
419 3142 2433
420 3142 2433
421 3142 2433
422 3142 2433
423 3142 2433
424 3142 2433
425 3142 2433
426 3142 2433
427 3142 2433
428 3142 2433
429 3142 2433
430 3142 2433
431 3142 2433
432 3142 2433
433 3142 2433
434 3142 2433
435 3142 2433
436 3142 2433
437 3142 2433
438 3142 2433
439 3142 2433
440 3142 2433
441 3142 2433
442 3142 2433
443 3142 2433
444 3142 2433
445 3142 2433
446 3142 2433
447 3142 2433
448 3142 2433
449 3142 2433
450 3142 2433
451 3142 2433
452 3142 2433
453 3142 2433
454 3142 2433
455 3142 2433
456 3142 2433
457 3142 2433
458 3142 2433
459 3142 2433
460 3142 2433
461 3142 2433
462 3142 2433
463 3142 2433
464 3142 2433
465 3142 2433
466 3142 2433
467 3142 2433
468 3142 2434
469 3142 2434
470 3142 2434
471 3142 2434
472 3142 2434
473 3142 2434
474 3142 2434
475 3142 2434
476 3142 2434
477 3142 2434
478 3142 2434
479 3142 2434
480 3142 2434
481 3142 2434
482 3142 2434
483 3142 2434
484 3142 2434
485 3142 2434
486 3142 2434
487 3142 2434
488 3142 2434
489 3142 2434
490 3142 2434
491 3142 2434
492 3142 2434
493 3142 2434
494 3142 2434
495 3142 2434
496 3142 2434
497 3142 2434
498 3142 2434
499 3145 2443
500 3145 2443
501 3145 2443
502 3145 2443
503 3145 2443
504 3145 2443
505 3145 2443
506 3145 2443
507 3145 2443
508 3145 2443
509 3145 2443
510 3145 2443
511 3145 2443
512 3145 2443
513 3145 2443
514 3145 2443
515 3145 2443
516 3145 2443
517 3145 2443
518 3145 2443
519 3145 2443
520 3145 2443
521 3145 2443
522 3145 2443
523 3145 2443
524 3145 2443
525 3145 2443
526 3145 2443
527 3145 2443
528 3145 2443
529 3145 2443
530 3145 2443
531 3145 2443
532 3145 2443
533 3145 2443
534 3145 2443
535 3145 2443
536 3145 2443
537 3145 2443
538 3145 2443
539 3145 2443
540 3145 2443
541 3145 2443
542 3145 2443
543 3145 2443
544 3145 2443
545 3145 2443
546 3145 2443
547 3145 2443
548 3145 2443
549 3145 2443
550 3145 2443
551 3145 2443
552 3145 2443
553 3145 2443
554 3145 2443
555 3145 2443
556 3145 2443
557 3145 2443
558 3145 2443
559 3145 2443
560 3145 2443
561 3145 2443
562 3145 2443
563 3145 2443
564 3145 2443
565 3145 2443
566 3145 2443
567 3160 2443
568 3160 2443
569 3160 2443
570 3160 2443
571 3160 2443
572 3160 2443
573 3160 2443
574 3160 2443
575 3160 2443
576 3160 2443
577 3160 2443
578 3160 2443
579 3160 2443
580 3160 2443
581 3160 2443
582 3160 2443
583 3160 2443
584 3160 2443
585 3160 2443
586 3160 2443
587 3160 2443
588 3160 2443
589 3160 2443
590 3160 2443
591 3160 2443
592 3160 2443
593 3160 2443
594 3160 2443
595 3160 2443
596 3160 2443
597 3160 2443
598 3160 2443
599 3160 2443
600 3160 2443
601 3160 2443
602 3160 2443
603 3160 2460
604 3160 2460
605 3160 2460
606 3160 2460
607 3160 2460
608 3160 2460
609 3160 2460
610 3160 2460
611 3160 2460
612 3160 2460
613 3160 2460
614 3160 2460
615 3160 2460
616 3160 2460
617 3160 2460
618 3160 2460
619 3160 2460
620 3160 2460
621 3160 2460
622 3160 2460
623 3160 2460
624 3160 2460
625 3160 2460
626 3160 2460
627 3160 2460
628 3160 2460
629 3160 2460
630 3160 2460
631 3160 2460
632 3160 2460
633 3160 2460
634 3160 2460
635 3160 2460
636 3160 2460
637 3160 2460
638 3160 2460
639 3160 2460
640 3160 2460
641 3160 2460
642 3160 2460
643 3160 2460
644 3160 2460
645 3160 2460
646 3160 2460
647 3160 2460
648 3160 2460
649 3160 2460
650 3160 2460
651 3160 2460
652 3160 2460
653 3160 2460
654 3160 2460
655 3160 2460
656 3160 2460
657 3160 2460
658 3160 2460
659 3160 2460
660 3160 2460
661 3160 2460
662 3160 2460
663 3160 2460
664 3160 2460
665 3160 2460
666 3160 2460
667 3160 2460
668 3160 2460
669 3160 2460
670 3160 2460
671 3160 2460
672 3160 2460
673 3160 2460
674 3160 2460
675 3160 2460
676 3160 2460
677 3160 2460
678 3160 2460
679 3160 2460
680 3158 2460
681 3158 2460
682 3158 2460
683 3158 2460
684 3158 2460
685 3158 2460
686 3158 2460
687 3158 2460
688 3158 2460
689 3158 2460
690 3158 2460
691 3158 2460
692 3158 2460
693 3158 2460
694 3158 2460
695 3158 2460
696 3158 2460
697 3158 2460
698 3158 2460
699 3158 2460
700 3158 2460
701 3158 2460
702 3158 2460
703 3158 2460
704 3158 2460
705 3158 2460
706 3158 2460
707 3158 2460
708 3158 2460
709 3158 2460
710 3158 2460
711 3158 2460
712 3158 2460
713 3158 2460
714 3158 2460
715 3158 2460
716 3158 2460
717 3158 2460
718 3158 2491
719 3158 2491
720 3158 2491
721 3158 2491
722 3158 2491
723 3158 2491
724 3158 2491
725 3158 2491
726 3158 2491
727 3158 2491
728 3158 2491
729 3158 2491
730 3158 2491
731 3158 2491
732 3158 2491
733 3158 2491
734 3158 2491
735 3158 2491
736 3158 2491
737 3158 2491
738 3158 2491
739 3158 2491
740 3158 2491
741 3158 2491
742 3158 2491
743 3158 2491
744 3158 2491
745 3158 2491
746 3158 2491
747 3158 2491
748 3158 2491
749 3158 2491
750 3158 2491
751 3158 2491
752 3158 2491
753 3158 2491
754 3158 2491
755 3158 2491
756 3158 2491
757 3158 2491
758 3158 2491
759 3158 2491
760 3158 2491
761 3158 2491
762 3158 2491
763 3158 2491
764 3158 2491
765 3158 2491
766 3158 2491
767 3158 2491
768 3158 2491
769 3158 2491
770 3158 2491
771 3158 2491
772 3158 2491
773 3158 2491
774 3158 2491
775 3158 2491
776 3158 2491
777 3158 2491
778 3158 2491
779 3158 2491
780 3158 2491
781 3158 2491
782 3158 2491
783 3158 2491
784 3158 2491
785 3158 2491
786 3158 2491
787 3158 2491
788 3158 2491
789 3158 2491
790 3158 2491
791 3158 2491
792 3158 2491
793 3158 2491
794 3158 2491
795 3158 2491
796 3158 2491
797 3163 2491
798 3163 2491
799 3163 2491
800 3163 2491
801 3163 2491
802 3163 2491
803 3163 2491
804 3163 2491
805 3163 2491
806 3163 2491
807 3163 2491
808 3163 2491
809 3163 2491
810 3163 2491
811 3163 2491
812 3163 2491
813 3163 2491
814 3163 2491
815 3163 2491
816 3163 2491
817 3163 2491
818 3163 2491
819 3163 2491
820 3163 2491
821 3163 2491
822 3163 2491
823 3163 2491
824 3163 2491
825 3163 2491
826 3163 2491
827 3163 2491
828 3163 2491
829 3163 2491
830 3163 2491
831 3163 2491
832 3163 2491
833 3163 2465
834 3163 2465
835 3163 2465
836 3163 2465
837 3163 2465
838 3163 2465
839 3163 2465
840 3163 2465
841 3163 2465
842 3163 2465
843 3163 2465
844 3163 2465
845 3163 2465
846 3163 2465
847 3163 2465
848 3163 2465
849 3163 2465
850 3163 2465
851 3163 2465
852 3163 2465
853 3163 2465
854 3163 2465
855 3163 2465
856 3163 2465
857 3163 2465
858 3163 2465
859 3163 2465
860 3163 2465
861 3163 2465
862 3163 2465
863 3163 2465
864 3163 2465
865 3163 2465
866 3163 2465
867 3163 2465
868 3163 2465
869 3163 2465
870 3163 2465
871 3163 2465
872 3163 2465
873 3163 2465
874 3163 2465
875 3163 2465
876 3163 2465
877 3163 2465
878 3163 2465
879 3163 2465
880 3163 2465
881 3163 2465
882 3163 2465
883 3163 2465
884 3163 2465
885 3163 2465
886 3163 2465
887 3163 2465
888 3163 2465
889 3163 2465
890 3163 2465
891 3163 2465
892 3163 2465
893 3163 2465
894 3163 2465
895 3163 2465
896 3163 2465
897 3163 2465
898 3163 2465
899 3163 2465
900 3163 2465
901 3163 2465
902 3163 2465
903 3163 2465
904 3163 2465
905 3163 2465
906 3163 2465
907 3163 2465
908 3163 2465
909 3163 2465
910 3163 2465
911 3163 2465
912 3163 2465
913 3154 2465
914 3154 2465
915 3154 2465
916 3154 2465
917 3154 2465
918 3154 2465
919 3154 2465
920 3154 2465
921 3154 2465
922 3154 2465
923 3154 2465
924 3154 2465
925 3154 2465
926 3154 2465
927 3154 2465
928 3154 2465
929 3154 2465
930 3154 2465
931 3154 2465
932 3154 2465
933 3154 2465
934 3154 2465
935 3154 2465
936 3154 2465
937 3154 2465
938 3154 2465
939 3154 2465
940 3154 2465
941 3154 2465
942 3154 2465
943 3154 2465
944 3154 2465
945 3154 2465
946 3154 2465
947 3154 2465
948 3154 2465
949 3154 2447
950 3154 2447
951 3154 2447
952 3154 2447
953 3154 2447
954 3154 2447
955 3154 2447
956 3154 2447
957 3154 2447
958 3154 2447
959 3154 2447
960 3154 2447
961 3154 2447
962 3154 2447
963 3154 2447
964 3154 2447
965 3154 2447
966 3154 2447
967 3154 2447
968 3154 2447
969 3154 2447
970 3154 2447
971 3154 2447
972 3154 2447
973 3154 2447
974 3154 2447
975 3154 2447
976 3154 2447
977 3154 2447
978 3154 2447
979 3154 2447
980 3154 2447
981 3154 2447
982 3154 2447
983 3154 2447
984 3154 2447
985 3154 2447
986 3154 2447
987 3154 2447
988 3154 2447
989 3154 2447
990 3154 2447
991 3154 2447
992 3154 2447
993 3154 2447
994 3154 2447
995 3154 2447
996 3154 2447
997 3154 2447
998 3154 2447
999 3154 2447
1000 3154 2447

and sometimes values What I am getting for same code same input voltage is as below



Hope this data to explain my problem is sufficient from my side.

Hoping proper answer from your side.

  • Hi, Seema

    That a long data table~

    After you start ADC conversion, you need to wait for ADC conversion done.

    In your code, you didn't wait and read adc result mem immediately.

    Check this code example in SDK, will help you how to handle ADC mem read sequence.

    C:\ti\mspm0_sdk_2_00_00_03\examples\nortos\LP_MSPM0L1306\driverlib\adc12_single_conversion

    Regards,

    Helic

  • Hi Helic,

    Thank you for the reply but I already done that by using 10 mSec counter  and then start taking ADC conversion.
    I already gone through the code which you have mention and getting these value variation. Expecting expert reply from your side as I think there is something which I am missing to do and due to which I am getting this fluctuation in ADC values. 

    The answer I am getting from your side is very basic and logical things which I already tried and after my query not getting resolved I came here on forum.

    I have checked number of similar questions on forum too but I have not get any answer. So expecting your expert answer.

    Thank you in advance.

  • Hi, 

    Please check this part firstly:

    After you start ADC conversion, you need to wait for ADC conversion done.

    In your code, you didn't wait and read adc result mem immediately.

    In the demo code, MCU need to wait for ADC result ready by running [while (false == gCheckADC);], when result is done, gCheckADC = true in ADC interrupt, and MCU can read ADC result from ADC result MEM.

    int main(void)
    {
        SYSCFG_DL_init();
    
        NVIC_EnableIRQ(ADC12_0_INST_INT_IRQN);
        gCheckADC = false;
    
        while (1) {
            DL_ADC12_startConversion(ADC12_0_INST);
    
            while (false == gCheckADC) {
                __WFE();
            }
    
            gAdcResult = DL_ADC12_getMemResult(ADC12_0_INST, DL_ADC12_MEM_IDX_0);
    
            if (gAdcResult > 0x7ff) {
                DL_GPIO_clearPins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN);
            } else {
                DL_GPIO_setPins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN);
            }
            gCheckADC = false;
            DL_ADC12_enableConversions(ADC12_0_INST);
        }
    }
    
    void ADC12_0_INST_IRQHandler(void)
    {
        switch (DL_ADC12_getPendingInterrupt(ADC12_0_INST)) {
            case DL_ADC12_IIDX_MEM0_RESULT_LOADED:
                gCheckADC = true;
                break;
            default:
                break;
        }
    }

    For your code shown below, you didn't jam the CPU after ADC start. The CPU reads the results directly after the ADC is turned on, which will result in reading unknown results.

    Please add more functions based on the SDK demo.

    Regards,

    Helic