lpcware

ADC Debug on LPC1114 erratic readings

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by Jakub16 on Sat Sep 21 10:16:58 MST 2013
Hello,

I am having erratic ADC readings in Console while in Debug mode. Sample readings:
 0 2.81V |##########################################       |
0 2.21V |################################                 |
                 |
0 1.39V |####################                             |
1.08V |###############                                  |
0 0.96V |#############                                    |
0.78V |##########                                       |
0 0.64V |########                                         |
0.67V |########                                         |
0 0.60V |#######                                          |
             |
0 0.65V |########                                         |
4V |######                                           |
0 0.63V |########                                         |
0.55V |#######                                          |
0 0.60V |#######                                          |
0.53V |######                                           |
0 0.53V |######                                           |
         |
0 0.64V |########                                         |
######                                           |
0 0.58V |#######                                          |
0.63V |########                                         |
0 0.55V |#######                                          |
0.61V |#######                                          |
0 0.57V |#######                                          |
     |
0 0.59V |#######                                          |
##                                           |
0 0.54V |######                                           |
0.61V |########                                         |
0 0.59V |#######                                          |
0.59V |#######                                          |
0 0.59V |#######                                          |
|
0 0.53V |######                                           |
                                         |
0 0.56V |#######                                          |
0.53V |######                                           |
0 0.61V |#######                                          |
0.50V |######                                           |
0 0.62V |########                                         |

0 0.60V |#######                                          |
                                     |
0 0.54V |######                                           |
0.62V |########                                         | 
0.0.50V |######                                           |
0.61V |#######                                          |
0 0.61V |########                                         |

0 0.59V |#######                                          |
                                 |
0 0.56V |#######                                          |
0.53V |######                                           | 
0 0.60V |#######                                          |
0.59V |#######                                          |
0 0.53V |######                                           |

0 0.50V |######                                           |
                             |
0 0.63V |########                                         |
0.56V |#######                                          | 
0 0.58V |#######                                          |
0.61V |########                                         |
0 0.53V |######                                           |

0 0.50V |######                                           |
                         |
0 0.60V |#######                                          |
0.62V |########                                         | 
0 0.50V |######                                           |
0.58V |#######                                          |
0 0.61V |#######                                          |

0 0.56V |#######                                          |
                     |
0 0.58V |#######                                          |
0.63V |########                                         | 
0 0.50V |######                                           |
0.62V |########                                         |
0 0.56V |#######                                          |
0 0.60V |#######                                          |
0 0.61V |########                                         |
                 |
0 0.53V |######                                           |
0.60V |#######                                          |
0 0.51V |######                                           |
0.59V |#######                                          |
0 0.62V |########                                         |
0.52V |######                                           |
0 0.60V |#######                                          |
             |
0 0.58V |#######                                          |
5V |#######                                          |
0 0.60V |#######                                          |
0.61V |########                                         |
0 0.52V |######                                           |
0.60V |#######                                          |
0 0.52V |######                                           |
         |
0 0.62V |########                                         |
######                                           |
0 0.55V |#######                                          |
0.63V |########                                         |
0 0.59V |#######                                          |
0.58V |#######                                          |
0 0.60V |#######                                          |
     |
0 0.60V |#######                                          |
##                                           |
0 0.60V |#######                                          |
0.54V |######                                           |
0 0.57V |#######                                          |
0.51V |######                                           |
0 0.56V |#######                                          |
|
0 0.49V |######                                           |
                                         |
0 0.51V |######                                           |
0.50V |######                                           |
0 0.63V |########                                         |
0.54V |######                                           |
0 0.57V |#######                                          |

0 0.56V |#######                                          |
                                     |
0 0.57V |#######                                          |
0.56V |#######                                          | 
0.0.56V |#######                                          |
0.54V |######                                           |
0 0.59V |#######                                          |

0 0.57V |#######                                          |
                                 |
0 0.55V |#######                                          |
0.59V |#######                                          | 
0 0.52V |######                                           |
0.56V |#######                                          |
0 0.59V |#######                                          |

0 0.57V |#######                                          |
                             |
0 0.56V |#######                                          |
0.59V |#######                                          | 
0 0.57V |#######                                          |
0.56V |#######                                          |
0 0.60V |#######                                          |

0 0.55V |#######                                          |
                         |
0 0.60V |#######                                          |
0.63V |########                                         | 
0 0.62V |########                                         |
0.69V |#########                                        |
0 0.67V |########                                         |

0 0.46V |#####                                            |
                     |
0 0.60V |#######                                          |
0.63V |########                                         | 
0 0.59V |#######                                          |
0.59V |#######                                          |
0 0.58V |#######                                          |
0 0.55V |#######                                          |
0 0.57V |#######                                          |
                 |
0 0.59V |#######                                          |
0.56V |#######                                          |
0 0.58V |#######                                          |
0.59V |#######                                          |
0 0.59V |#######                                          |
0.55V |#######                                          |
0 0.58V |#######                                          |
             |
0 0.60V |#######                                          |
6V |#######                                          |
0 0.59V |#######                                          |
0.56V |#######                                          |
0 0.56V |#######                                          |
0.57V |#######                                          |
0 0.58V |#######                                          |
         |
0 0.56V |#######                                          |
#######                                          |
0 0.56V |#######                                          |
0.56V |#######                                          |
0 0.57V |#######                                          |
0.56V |#######                                          |
0 0.57V |#######                                          |
     |
0 0.56V |#######                                          |
###                                          |
0 0.57V |#######                                          |
0.60V |#######                                          |
0 0.60V |#######                                          |
0.53V |######                                           |
0 0.55V |#######                                          |
|
0 0.57V |#######                                          |
                                         |
0 0.55V |#######                                          |
0.58V |#######                                          |
0 0.53V |######                                           |
0.55V |#######                                          |
0 0.57V |#######                                          |

0 0.50V |######                                           |
                                     |
0 0.73V |#########                                        |
0.41V |####                                             | 
0.0.41V |####                                             |
0.66V |########                                         |
0 0.00V |#################################################|

0 3.29V |#################################################|
###############                  |
0 0.00V |#################################################|
0.89V |############                                     |##
0 0.00V |#################################################|
0.00V |#################################################|
0 2.46V |####################################             |

0 0.00V |#################################################|
#############################|
0 3.29V |#################################################|
3.29V |#################################################|##
0 0.10V |                                                 |
3.29V |#################################################|
0 3.29V |#################################################|

0 0.00V |#################################################|
#########################|
0 1.51V |#####################                            |
3.29V |#################################################| 
0 0.02V |#################################################|
0.05V |                                                  |
0.93V |############                                     |
0 3.29V |#################################################|
0.00V |#################################################|
0 0.00V |#################################################|
|
0 3.29V |#################################################|
#########################################|
0 1.92V |############################                     |
3.29V |#################################################|
0 1.84V |##########################                       |
1.26V |##################                               |
0 1.46V |#####################                            |

0 0.89V |############                                     |
                                     |
0 0.75V |##########                                       |
0.81V |###########                                      | 
0.0.52V |######                                           |
0.60V |#######                                          |
0 2.55V |######################################           |

0 3.01V |#############################################    |
###############################  |
0 3.29V |#################################################|
3.29V |#################################################|##
0 2.99V |############################################     |
3.29V |#################################################|
0 3.29V |#################################################|

0 0.00V |#################################################|
#############################|
0 3.29V |#################################################|
3.29V |#################################################|##
0 3.29V |#################################################|
3.29V |#################################################|
0 3.29V |#################################################|

0 3.29V |#################################################|
#########################|
0 3.29V |#################################################|
3.21V |################################################ |##
0 3.29V |#################################################|
3.29V |#################################################|
0 3.29V |#################################################|

0 2.79V |#########################################        |
                     |
0 1.41V |####################                             |
1.05V |##############                                   | 
0 0.80V |###########                                      |
0.70V |#########                                        |
0 0.64V |########                                         |
0 0.63V |########                                         |
0 0.57V |#######                                          |
                 |
0 0.60V |#######                                          |
0.51V |######                                           |
0 0.55V |#######                                          |
0.54V |######                                           |
0 0.54V |######                                           |
0.61V |########                                         |
0 0.62V |########                                         |
             |
0 0.54V |######                                           |
0V |#######                                          |
0 0.56V |#######                                          |
0.54V |######                                           |
0 0.55V |#######                                          |
0.60V |#######                                          |
0 0.62V |########                                         |
         |
0 0.62V |########                                         |
######                                           |
0 0.59V |#######                                          |
0.62V |########                                         |
0 0.63V |########                                         |
0.50V |######                                           |
0 0.53V |######                                           |
     |
0 0.60V |#######                                          |
##                                           |
0 0.53V |######                                           |
0.54V |######                                           |
0 0.54V |######                                           |
0.59V |#######                                          |
0 0.57V |#######                                          |
|
0 0.59V |#######                                          |
                                         |
0 0.61V |########                                         |
0.62V |########                                         |
0 0.54V |######                                           |
0.54V |######                                           |
0 0.57V |#######                                          |

I am receiving the output in few lines per reading, one reading per second to two seconds. Some lines don't start from their beginning.
The situation is identical on both Linux and Windows on my "external" PC (not laptop). And on my laptop readings are worse - less frequent and more cropped/choppy. When I touch pins with a finger I always get maximum readings (maybe gain is turned on, but shouldn't be on default).
I tried different clock settings but that didn't change anything:
/*adc.h */
#define ADC_CLK  2400000  /* default set to 2.4Mhz */

/* adc.c */
void ADCInit( uint32_t ADC_Clk )
{
...
LPC_ADC->CR = ((SystemCoreClock/LPC_SYSCON->SYSAHBCLKDIV)/[color=#00f]ADC_Clk[/color]-1)<<8;
...
}


I use debug mode because I am new in electronics. I know few things in theory and have very little practice.

Summary:
1. Why readings are soooooo slow (infrequent)? Is it because of the debug mode?
2. Why readings are cropped?

Can You help?
Thank You
Jakub

Outcomes