Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 19 of 19

Thread: "Blind spots" when sampling analog signal with Teensy 4.0

  1. #1
    Junior Member
    Join Date
    May 2020
    Posts
    12

    "Blind spots" when sampling analog signal with Teensy 4.0

    While working on my oscilloscope project, which involved using Teensy 4.0 for sampling and displaying random noise signal at a very high speed, I noticed that certain analog values were not displayed at all on my screen, leaving gaps where the data should have been. Initially I suspected some bug in my code, but found none. Then I thought there was a problem with my particular Teensy board, found that was not the case either, as my second Teensy 4.0 behaved just like the first. I investigated the problem a little further, and would like to share my findings.

    When using ADC library continuous 12-bit reading mode, certain ranges of analog values are missing altogether, and there are also other ranges where data distribution seems irregular. Although it is much easier to see these patterns when sampling and displaying large amounts of data at high speed, I wrote a simple sketch to partially demonstrate the problem. Just connect a 10kOhm - 50kOhm potentiometer to 3v, ground and the pin you want to test, start serial monitor and by slowly turning it try to hit the range of 2041 to 2046. If I am correct, you should never succeed. And there are more gaps like this one.

    Code:
    #include <ADC.h>
    #define testpin 15 // analog pin to be tested
    #define led 13  //warning light
    ADC *adc = new ADC();
    
    void setup() {
    
      pinMode(testpin, INPUT);
      pinMode(led, OUTPUT);
      digitalWrite (led, 0);
    
      adc->adc0->setResolution(12); // other values not tested
      adc->adc0->setAveraging(0); // changing to nonzero value "solves" the problem. Kinda...
      adc->adc0->setConversionSpeed(ADC_CONVERSION_SPEED::HIGH_SPEED); // changing  value doesn't solve anything
      adc->adc0->setSamplingSpeed(ADC_SAMPLING_SPEED::HIGH_SPEED); // changing  value doesn't solve anything
    
      adc->adc0->startContinuous(testpin); // starting continuous sampling
    
    }
    
    void loop() {
    
      uint16_t sample = adc->adc0->analogReadContinuous();
      Serial.println (sample);  
      if ((sample > 2040) && (sample < 2047)) {
        Serial.println("OOOPS!");  //Blind spot is not so blind after all.
        digitalWrite (led, 1); // Warning light: I am wrong!
        delay (1000);
      }  
      delay (10);
    }
    Changing conversion speed or sampling speed from LOW_SPEED to VERY_HIGH_SPEED doesn't seem to have any effect. Between ADC0 and ADC1 there in no difference in behavior either. All analog pins I have tested are affected the same way. The only thing that does seem to help is changing averaging to a nonzero value, but then effective sampling speed takes a huge dip.

    Could there be some bug in ADC library, or is it the hardware itself that is affected? Is this behavior known? Out of curiosity, I ran the sketch on Teensy 3.2. Interestingly, it does seem to be able to collect data in the range that is a "blind spot" for Teensy 4.0, but there is another problem: it is next to impossible to focus on that same range while slowly turning the potentiometer. The streaming values seem to jump abruptly from above that range to way below.

    Anyway, it is Teensy 4.0 that mostly concerns me at the moment. If someone knows the solution, please share!

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,827
    Try using pinMode INPUT_DISABLE rather than INPUT.

  3. #3
    Junior Member
    Join Date
    May 2020
    Posts
    12
    Quote Originally Posted by PaulStoffregen View Post
    Try using pinMode INPUT_DISABLE rather than INPUT.
    I did, unfortunately the gap is still there.

  4. #4
    Senior Member
    Join Date
    Apr 2016
    Location
    St. Petersburg, FL
    Posts
    195
    Instead of using a pot for the voltage sample, monitor a capacitor charging through a large value resistor. You can use a digital output pin as the source and put the code in loop() for repetitive viewing.

    PS
    Run the loop once then scan the serial monitor to see individual values.

  5. #5
    Junior Member
    Join Date
    May 2020
    Posts
    12
    Quote Originally Posted by Arctic_Eddie View Post
    Instead of using a pot for the voltage sample, monitor a capacitor charging through a large value resistor. You can use a digital output pin as the source and put the code in loop() for repetitive viewing.

    PS
    Run the loop once then scan the serial monitor to see individual values.
    Of course, there are many ways to demonstrate this behavior, some better than others.

    For such purpose of demonstration, I think my sketch works too. That is, to show that certain legitimate analog values are not sampled.

  6. #6
    Junior Member
    Join Date
    May 2020
    Posts
    12
    Ok... After analyzing my findings, I now have a theory, so to speak. Please don't laugh I believe the problem I described above has something to do with ADC internal calibration. The actual sampling is probably performed over a smaller range, and when the sampled data is "stretched" to full 12 bits according to the information stored in the calibration register, nonlinearity is introduced. I imagine this calculation is performed in integer arithmetic for speed sake; so it must be a bit crude. I understand this step is necessary to make sure the end result matches the actual voltage, but I still wish they provided the means to omit this step. For my purposes, whether voltage readings are "true" or not is not nearly as important as data linearity. If I wanted a calibration performed, I would do it myself.

    So... to restore linearity (partially, at least), at the expense of "true" voltage readings, I found a workaround which seems to work well enough for my purposes. Each sample (12 bit only!) is sent to this function:

    Code:
    uint16_t linearize (uint16_t sample) {
      sample -= (sample >> 5) & 0xFFF8;
      return sample;
    }
    The real-time waveforms displayed on my oscilloscope now look much nicer, without obvious gaps and steps, and the processor overhead is not terrible, either. I still wish there was a more elegant solution to this, though.

    Edit: found a bug. Updated.
    Last edited by fGene; 05-15-2020 at 06:06 AM.

  7. #7
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    11,512
    That's 12 bit midrange values - is this hysteresis setting?

  8. #8
    Senior Member
    Join Date
    Oct 2012
    Location
    Portland OR
    Posts
    689
    FWIW here is what leaving the "keeper" port setting on looked like on my T4.0 beta: https://forum.pjrc.com/threads/54711...l=1#post198315
    It had the effect of causing a pretty big differential nonlinearity but only in one spot near the midpoint (in my case, around count 2075 out of 4095).
    The exact location may depend on the external impedance seen by the pin.

    The larger the impedance at the pin, the larger a "dead zone" in the ADC transfer function I would expect to see.
    R=5k is already getting pretty large for an unbuffered ADC input, and the impedance effects on ADC inputs get worse with faster sampling times.

    That particular issue was easy to fix: just turn the keeper setting off, as shown here (specific to the A0 pin):
    https://forum.pjrc.com/threads/54711...l=1#post198365
    Last edited by JBeale; 05-15-2020 at 05:52 AM.

  9. #9
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    11,512
    yeah - keeper/hysteresis - I thought that got disabled in analogRead() - maybe it didn't carry into ADC library settings?

  10. #10
    Junior Member
    Join Date
    May 2020
    Posts
    12
    Quote Originally Posted by JBeale View Post
    FWIW here is what leaving the "keeper" port setting on looked like on my T4.0 beta: https://forum.pjrc.com/threads/54711...l=1#post198315
    It had the effect of causing a pretty big differential nonlinearity but only in one spot near the midpoint (in my case, around count 2075 out of 4095).
    The exact location may depend on the external impedance seen by the pin.

    The larger the impedance at the pin, the larger a "dead zone" in the ADC transfer function I would expect to see.
    R=5k is already getting pretty large for an unbuffered ADC input, and the impedance effects on ADC inputs get worse with faster sampling times.

    That particular issue was easy to fix: just turn the keeper setting off, as shown here (specific to the A0 pin):
    https://forum.pjrc.com/threads/54711...l=1#post198365
    Pretty interesting... In my case though, I found the nonlinear portions repeating every 256 steps, involving 8 consecutive values. Look at my "fix" above -- should be pretty self-explanatory... It looks to me like mapping data over a wider than original range using integer operations. This is why internal calibration is my prime suspect.

  11. #11
    Senior Member
    Join Date
    Oct 2012
    Location
    Portland OR
    Posts
    689
    Quote Originally Posted by fGene View Post
    Pretty interesting... In my case though, I found the nonlinear portions repeating every 256 steps, involving 8 consecutive values. Look at my "fix" above -- should be pretty self-explanatory... It looks to me like mapping data over a wider than original range using integer operations. This is why internal calibration is my prime suspect.
    At the time I was testing T4beta1 the ADC library wasn't supporting T4 yet so I didn't use it, and I did not see the 8-sample gap each 256 steps that you describe. I had averaging on, but I believe this problem would have shown as a periodic change in the std.dev values.
    This is the code I used: https://github.com/jbeale1/DataAcq/b...nsyADCTest.ino

  12. #12
    Junior Member
    Join Date
    May 2020
    Posts
    12
    Quote Originally Posted by defragster View Post
    yeah - keeper/hysteresis - I thought that got disabled in analogRead() - maybe it didn't carry into ADC library settings?
    I tried analogRead as well -- with analogReadAveraging(0) it has shown the same result... I can't use it for continuous sampling anyway...

  13. #13
    Junior Member
    Join Date
    May 2020
    Posts
    12
    Quote Originally Posted by JBeale View Post
    At the time I was testing T4beta1 the ADC library wasn't supporting T4 yet so I didn't use it, and I did not see the 8-sample gap each 256 steps that you describe. I had averaging on, but I believe this problem would have shown as a periodic change in the std.dev values.
    This is the code I used: https://github.com/jbeale1/DataAcq/b...nsyADCTest.ino
    The problem occurs only when averaging is turned off. At the sampling speeds I need for my project, I have no choice but to turn it off.

    P.S. I tried the code you have suggested, and I believe with analogReadAveraging(0) it did reveal the nonlinearity exactly where I suspected to find it. Or maybe I am just interpreting results incorrectly... In any case, in the last two days I myself wrote a whole bunch of sketches to pinpoint the problem (it really exists, I am sure now) and devise a workaround. I wish I could understand how to access the internals, for instance ADC1_CAL register. When I try to read it, it always reads zero, and I don't think it should. I am probably doing something wrong.
    Last edited by fGene; 05-15-2020 at 07:38 AM.

  14. #14
    Senior Member
    Join Date
    Oct 2012
    Location
    Portland OR
    Posts
    689

    histogram test of 12-bit ADC on T4.1

    I tried out a new Teensy 4.1 that came in the mail today, with Arduino 1.8.12 and Teensyduino 1.52-beta6.
    I accumulated a simple 4096-bin histogram of raw samples without averaging, for 200k samples around 1 kHz using this code:
    Code:
    // testing Teensy 4.1 ADC  2020-May-15  J.Beale
    
    #define ADCMAX (4095)        // maximum possible reading from ADC
    #define BINS 4096         // how many bins in histogram
    
    const int analogInPin = A0;  // Analog input is AIN0 (Teensy3 pin 14, next to LED)
    const int LED1 = 13;         // output LED connected on Arduino digital pin 13
    
    int sensorValue = 0;        // value read from the ADC input
    long oldT;
    long readingCount = 0;      // how many samples delivered so far
    
    unsigned int histbuf[4096];          // histogram buffer
    
    void setup() {    // ==============================================================
          pinMode(LED1,OUTPUT);       // enable digital output for turning on LED indicator
          analogReadRes(12);          // Teensy: set ADC resolution to this many bits
          analogReadAveraging(1);    // average this many readings
         
          Serial.begin(115200);       // baud rate is ignored with Teensy USB i/o
          digitalWrite(LED1,HIGH);   
          delay(1000);                // LED on for 1 second
          digitalWrite(LED1,LOW);    
    
          for (int i=0;i<BINS;i++) {  // zero out histogram
            histbuf[i] = 0;
          }
         
          Serial.println("# Teensy T4Beta1 ADC test 2020-05-15: ");
          Serial.println("count, avg");
    } // ==== end setup() ===========
    
    void loop() {  // ================================================================ 
    int raw;
         
        raw = analogRead(analogInPin);
        histbuf[raw]++;                  // count another one of this particular reading
        readingCount++;
        
        Serial.print(readingCount);  Serial.print(",");
        Serial.println(raw);
        delay(1);          // wait a little bit
    
        if (readingCount > 200000) {
          Serial.println("# ---- Histogram");
          for (int i=0;i<BINS;i++) {  // zero out histogram
            Serial.print(i);
            Serial.print(",");
            Serial.println(histbuf[i]);
          }
          while(1) {}            // halt here
     
        }
    } // end main()  =====================================================
    I did a few slow ramps up/down with a 3300 uF capacitor and some resistors alternately pulling ADC input pin A0 up to +3.3V and then down to 0, and looked at the histogram.
    There are a few bins with zero, mostly at the lowest values below 100 which I didn't cover, but there are no zero bins between 118 and 3230 so I do not think I'm seeing what you saw.
    Full histogram follows:
    Code:
    ADC-bin,counts
    0,0
    1,0
    2,0
    3,0
    4,0
    5,0
    6,0
    7,0
    8,0
    9,0
    10,0
    11,0
    12,0
    13,0
    14,0
    15,0
    16,0
    17,0
    18,0
    19,0
    20,0
    21,0
    22,0
    23,0
    24,0
    25,0
    26,0
    27,0
    28,0
    29,0
    30,0
    31,0
    32,0
    33,0
    34,0
    35,0
    36,0
    37,0
    38,0
    39,0
    40,0
    41,0
    42,0
    43,0
    44,0
    45,0
    46,0
    47,0
    48,0
    49,0
    50,0
    51,0
    52,0
    53,0
    54,0
    55,0
    56,0
    57,0
    58,0
    59,0
    60,0
    61,0
    62,0
    63,0
    64,0
    65,0
    66,0
    67,0
    68,0
    69,0
    70,0
    71,0
    72,0
    73,0
    74,0
    75,0
    76,0
    77,0
    78,0
    79,0
    80,0
    81,0
    82,0
    83,0
    84,0
    85,0
    86,0
    87,0
    88,0
    89,0
    90,0
    91,0
    92,0
    93,0
    94,0
    95,0
    96,0
    97,0
    98,0
    99,0
    100,0
    101,0
    102,1
    103,0
    104,0
    105,0
    106,0
    107,0
    108,0
    109,1
    110,0
    111,0
    112,1
    113,1
    114,3
    115,1
    116,1
    117,0
    118,2
    119,7
    120,1
    121,2
    122,10
    123,26
    124,29
    125,79
    126,121
    127,75
    128,137
    129,269
    130,233
    131,356
    132,230
    133,294
    134,271
    135,391
    136,151
    137,330
    138,236
    139,347
    140,217
    141,308
    142,254
    143,157
    144,117
    145,204
    146,145
    147,181
    148,110
    149,154
    150,126
    151,189
    152,78
    153,144
    154,126
    155,156
    156,99
    157,142
    158,130
    159,63
    160,66
    161,132
    162,120
    163,147
    164,106
    165,122
    166,128
    167,168
    168,71
    169,120
    170,118
    171,135
    172,94
    173,119
    174,118
    175,69
    176,59
    177,137
    178,116
    179,133
    180,94
    181,131
    182,111
    183,134
    184,64
    185,139
    186,107
    187,117
    188,77
    189,114
    190,106
    191,60
    192,75
    193,110
    194,100
    195,139
    196,85
    197,93
    198,98
    199,137
    200,61
    201,95
    202,93
    203,123
    204,87
    205,103
    206,105
    207,60
    208,59
    209,114
    210,87
    211,104
    212,68
    213,109
    214,93
    215,132
    216,60
    217,101
    218,71
    219,108
    220,71
    221,99
    222,101
    223,49
    224,58
    225,111
    226,90
    227,113
    228,77
    229,93
    230,70
    231,131
    232,47
    233,126
    234,96
    235,127
    236,87
    237,110
    238,107
    239,99
    240,66
    241,151
    242,133
    243,191
    244,127
    245,174
    246,127
    247,217
    248,83
    249,158
    250,135
    251,175
    252,108
    253,169
    254,184
    255,110
    256,104
    257,156
    258,121
    259,189
    260,117
    261,156
    262,104
    263,215
    264,90
    265,137
    266,129
    267,179
    268,109
    269,146
    270,163
    271,90
    272,76
    273,158
    274,110
    275,151
    276,130
    277,130
    278,140
    279,183
    280,86
    281,144
    282,123
    283,172
    284,112
    285,125
    286,123
    287,85
    288,88
    289,143
    290,136
    291,152
    292,110
    293,135
    294,136
    295,173
    296,87
    297,140
    298,109
    299,164
    300,87
    301,118
    302,124
    303,85
    304,75
    305,118
    306,107
    307,152
    308,107
    309,123
    310,121
    311,189
    312,72
    313,140
    314,105
    315,152
    316,106
    317,125
    318,117
    319,55
    320,75
    321,127
    322,116
    323,150
    324,87
    325,117
    326,124
    327,156
    328,66
    329,131
    330,116
    331,123
    332,91
    333,149
    334,109
    335,79
    336,56
    337,125
    338,105
    339,136
    340,71
    341,136
    342,98
    343,160
    344,62
    345,115
    346,124
    347,130
    348,82
    349,117
    350,104
    351,53
    352,70
    353,122
    354,113
    355,124
    356,85
    357,105
    358,99
    359,173
    360,64
    361,102
    362,104
    363,129
    364,95
    365,114
    366,112
    367,56
    368,56
    369,94
    370,94
    371,138
    372,88
    373,127
    374,88
    375,146
    376,74
    377,107
    378,100
    379,121
    380,87
    381,105
    382,99
    383,53
    384,61
    385,108
    386,82
    387,113
    388,81
    389,116
    390,89
    391,150
    392,51
    393,111
    394,97
    395,112
    396,82
    397,107
    398,103
    399,52
    400,49
    401,90
    402,86
    403,125
    404,94
    405,102
    406,101
    407,123
    408,57
    409,98
    410,87
    411,111
    412,80
    413,90
    414,112
    415,42
    416,61
    417,98
    418,101
    419,108
    420,77
    421,94
    422,92
    423,126
    424,59
    425,94
    426,84
    427,116
    428,82
    429,86
    430,90
    431,48
    432,53
    433,105
    434,89
    435,106
    436,85
    437,91
    438,71
    439,135
    440,59
    441,92
    442,77
    443,115
    444,65
    445,90
    446,101
    447,44
    448,55
    449,94
    450,83
    451,100
    452,79
    453,77
    454,93
    455,105
    456,61
    457,80
    458,92
    459,90
    460,88
    461,96
    462,91
    463,47
    464,45
    465,83
    466,98
    467,95
    468,71
    469,91
    470,85
    471,129
    472,58
    473,99
    474,70
    475,108
    476,59
    477,92
    478,73
    479,56
    480,59
    481,91
    482,71
    483,100
    484,71
    485,91
    486,78
    487,101
    488,62
    489,81
    490,70
    491,93
    492,73
    493,90
    494,70
    495,68
    496,43
    497,79
    498,80
    499,121
    500,54
    501,71
    502,91
    503,117
    504,39
    505,76
    506,63
    507,90
    508,72
    509,92
    510,81
    511,65
    512,61
    513,72
    514,84
    515,95
    516,64
    517,72
    518,62
    519,105
    520,56
    521,82
    522,87
    523,100
    524,52
    525,90
    526,83
    527,52
    528,45
    529,87
    530,60
    531,103
    532,59
    533,78
    534,70
    535,109
    536,49
    537,87
    538,74
    539,88
    540,71
    541,80
    542,79
    543,39
    544,45
    545,82
    546,72
    547,90
    548,65
    549,77
    550,66
    551,93
    552,38
    553,76
    554,63
    555,109
    556,48
    557,85
    558,67
    559,60
    560,57
    561,79
    562,68
    563,86
    564,55
    565,76
    566,69
    567,97
    568,43
    569,79
    570,69
    571,85
    572,72
    573,69
    574,70
    575,39
    576,52
    577,84
    578,57
    579,82
    580,64
    581,63
    582,70
    583,110
    584,43
    585,74
    586,63
    587,91
    588,54
    589,89
    590,85
    591,39
    592,36
    593,75
    594,66
    595,88
    596,56
    597,71
    598,84
    599,90
    600,41
    601,73
    602,68
    603,81
    604,65
    605,75
    606,74
    607,42
    608,37
    609,79
    610,47
    611,79
    612,52
    613,74
    614,65
    615,110
    616,41
    617,79
    618,53
    619,76
    620,63
    621,75
    622,70
    623,36
    624,32
    625,71
    626,79
    627,75
    628,57
    629,64
    630,60
    631,91
    632,60
    633,76
    634,54
    635,90
    636,45
    637,74
    638,68
    639,30
    640,43
    641,67
    642,51
    643,87
    644,55
    645,74
    646,52
    647,97
    648,31
    649,79
    650,60
    651,65
    652,55
    653,82
    654,62
    655,36
    656,32
    657,73
    658,75
    659,80
    660,52
    661,77
    662,60
    663,94
    664,43
    665,64
    666,63
    667,73
    668,56
    669,65
    670,81
    671,30
    672,39
    673,65
    674,64
    675,74
    676,50
    677,82
    678,55
    679,85
    680,43
    681,69
    682,55
    683,78
    684,53
    685,67
    686,59
    687,25
    688,44
    689,73
    690,45
    691,75
    692,48
    693,79
    694,66
    695,88
    696,40
    697,67
    698,49
    699,84
    700,48
    701,66
    702,61
    703,23
    704,62
    705,59
    706,54
    707,83
    708,49
    709,64
    710,69
    711,89
    712,37
    713,69
    714,60
    715,62
    716,50
    717,70
    718,54
    719,32
    720,49
    721,70
    722,56
    723,79
    724,55
    725,57
    726,58
    727,76
    728,39
    729,76
    730,68
    731,65
    732,47
    733,66
    734,54
    735,21
    736,41
    737,80
    738,51
    739,66
    740,57
    741,70
    742,53
    743,81
    744,31
    745,71
    746,49
    747,61
    748,60
    749,60
    750,69
    751,47
    752,38
    753,74
    754,62
    755,77
    756,35
    757,53
    758,59
    759,101
    760,30
    761,67
    762,51
    763,71
    764,46
    765,62
    766,73
    767,41
    768,32
    769,61
    770,61
    771,69
    772,56
    773,51
    774,57
    775,88
    776,45
    777,54
    778,52
    779,76
    780,38
    781,63
    782,65
    783,40
    784,29
    785,55
    786,59
    787,72
    788,50
    789,66
    790,52
    791,70
    792,41
    793,70
    794,52
    795,69
    796,36
    797,61
    798,80
    799,25
    800,38
    801,77
    802,50
    803,62
    804,50
    805,57
    806,61
    807,88
    808,36
    809,62
    810,52
    811,65
    812,40
    813,65
    814,72
    815,35
    816,29
    817,62
    818,56
    819,56
    820,50
    821,70
    822,44
    823,90
    824,42
    825,54
    826,58
    827,60
    828,41
    829,65
    830,57
    831,28
    832,41
    833,75
    834,52
    835,73
    836,45
    837,63
    838,59
    839,105
    840,63
    841,117
    842,86
    843,140
    844,79
    845,118
    846,123
    847,63
    848,53
    849,117
    850,107
    851,139
    852,90
    853,113
    854,96
    855,148
    856,75
    857,119
    858,106
    859,120
    860,92
    861,120
    862,117
    863,58
    864,80
    865,119
    866,97
    867,146
    868,87
    869,111
    870,103
    871,141
    872,71
    873,119
    874,112
    875,127
    876,93
    877,138
    878,113
    879,52
    880,66
    881,127
    882,96
    883,113
    884,82
    885,125
    886,104
    887,147
    888,70
    889,110
    890,102
    891,133
    892,103
    893,118
    894,104
    895,45
    896,67
    897,115
    898,87
    899,155
    900,84
    901,119
    902,104
    903,139
    904,75
    905,112
    906,97
    907,141
    908,98
    909,122
    910,119
    911,44
    912,59
    913,111
    914,115
    915,124
    916,92
    917,103
    918,108
    919,142
    920,80
    921,117
    922,88
    923,135
    924,92
    925,102
    926,100
    927,43
    928,72
    929,121
    930,103
    931,118
    932,98
    933,110
    934,106
    935,158
    936,61
    937,93
    938,98
    939,128
    940,86
    941,110
    942,138
    943,47
    944,71
    945,113
    946,95
    947,135
    948,103
    949,117
    950,97
    951,134
    952,68
    953,123
    954,108
    955,101
    956,94
    957,115
    958,121
    959,43
    960,57
    961,119
    962,112
    963,129
    964,85
    965,110
    966,102
    967,132
    968,91
    969,109
    970,92
    971,129
    972,89
    973,121
    974,106
    975,50
    976,59
    977,133
    978,109
    979,123
    980,93
    981,109
    982,99
    983,147
    984,87
    985,108
    986,79
    987,112
    988,86
    989,121
    990,102
    991,43
    992,72
    993,112
    994,108
    995,119
    996,105
    997,119
    998,89
    999,126
    1000,78
    1001,126
    1002,98
    1003,114
    1004,90
    1005,116
    1006,128
    1007,70
    1008,66
    1009,110
    1010,86
    1011,135
    1012,96
    1013,112
    1014,87
    1015,128
    1016,72
    1017,129
    1018,104
    1019,115
    1020,87
    1021,124
    1022,113
    1023,90
    1024,48
    1025,111
    1026,98
    1027,124
    1028,90
    1029,116
    1030,98
    1031,134
    1032,65
    1033,118
    1034,97
    1035,125
    1036,87
    1037,106
    1038,107
    1039,59
    1040,80
    1041,107
    1042,102
    1043,141
    1044,88
    1045,104
    1046,95
    1047,150
    1048,62
    1049,122
    1050,99
    1051,118
    1052,80
    1053,116
    1054,115
    1055,62
    1056,66
    1057,112
    1058,91
    1059,128
    1060,84
    1061,108
    1062,115
    1063,128
    1064,62
    1065,117
    1066,102
    1067,121
    1068,78
    1069,111
    1070,106
    1071,58
    1072,70
    1073,124
    1074,100
    1075,139
    1076,85
    1077,106
    1078,108
    1079,131
    1080,66
    1081,121
    1082,75
    1083,122
    1084,95
    1085,111
    1086,103
    1087,50
    1088,71
    1089,120
    1090,88
    1091,127
    1092,95
    1093,114
    1094,71
    1095,148
    1096,85
    1097,126
    1098,87
    1099,132
    1100,81
    1101,133
    1102,98
    1103,63
    1104,56
    1105,110
    1106,106
    1107,122
    1108,79
    1109,106
    1110,117
    1111,138
    1112,75
    1113,113
    1114,85
    1115,105
    1116,94
    1117,106
    1118,121
    1119,46
    1120,76
    1121,128
    1122,101
    1123,118
    1124,89
    1125,106
    1126,91
    1127,140
    1128,84
    1129,116
    1130,83
    1131,139
    1132,100
    1133,116
    1134,101
    1135,70
    1136,77
    1137,94
    1138,103
    1139,124
    1140,89
    1141,109
    1142,96
    1143,145
    1144,67
    1145,98
    1146,109
    1147,130
    1148,90
    1149,119
    1150,95
    1151,44
    1152,85
    1153,114
    1154,108
    1155,112
    1156,102
    1157,93
    1158,102
    1159,149
    1160,82
    1161,96
    1162,105
    1163,135
    1164,79
    1165,111
    1166,102
    1167,54
    1168,78
    1169,120
    1170,104
    1171,123
    1172,91
    1173,102
    1174,104
    1175,146
    1176,64
    1177,113
    1178,93
    1179,137
    1180,88
    1181,124
    1182,106
    1183,38
    1184,65
    1185,120
    1186,107
    1187,124
    1188,96
    1189,106
    1190,118
    1191,140
    1192,82
    1193,107
    1194,98
    1195,139
    1196,88
    1197,114
    1198,102
    1199,49
    1200,62
    1201,101
    1202,93
    1203,138
    1204,120
    1205,122
    1206,87
    1207,133
    1208,65
    1209,122
    1210,92
    1211,132
    1212,92
    1213,110
    1214,102
    1215,31
    1216,94
    1217,115
    1218,117
    1219,115
    1220,86
    1221,104
    1222,95
    1223,161
    1224,84
    1225,136
    1226,93
    1227,116
    1228,92
    1229,108
    1230,96
    1231,33
    1232,58
    1233,79
    1234,84
    1235,76
    1236,75
    1237,87
    1238,72
    1239,108
    1240,50
    1241,100
    1242,81
    1243,85
    1244,71
    1245,89
    1246,81
    1247,35
    1248,56
    1249,84
    1250,83
    1251,84
    1252,66
    1253,88
    1254,82
    1255,111
    1256,48
    1257,86
    1258,79
    1259,88
    1260,68
    1261,92
    1262,75
    1263,48
    1264,61
    1265,95
    1266,67
    1267,104
    1268,83
    1269,80
    1270,67
    1271,110
    1272,73
    1273,77
    1274,78
    1275,88
    1276,61
    1277,73
    1278,98
    1279,47
    1280,65
    1281,85
    1282,66
    1283,88
    1284,73
    1285,89
    1286,66
    1287,120
    1288,50
    1289,83
    1290,87
    1291,94
    1292,73
    1293,94
    1294,84
    1295,42
    1296,53
    1297,96
    1298,85
    1299,88
    1300,63
    1301,94
    1302,64
    1303,97
    1304,57
    1305,72
    1306,80
    1307,104
    1308,77
    1309,83
    1310,85
    1311,41
    1312,48
    1313,88
    1314,88
    1315,89
    1316,75
    1317,86
    1318,74
    1319,92
    1320,70
    1321,87
    1322,79
    1323,98
    1324,55
    1325,101
    1326,84
    1327,39
    1328,44
    1329,105
    1330,79
    1331,84
    1332,58
    1333,79
    1334,86
    1335,105
    1336,61
    1337,100
    1338,68
    1339,107
    1340,71
    1341,83
    1342,95
    1343,35
    1344,52
    1345,75
    1346,86
    1347,97
    1348,67
    1349,89
    1350,85
    1351,101
    1352,61
    1353,94
    1354,64
    1355,105
    1356,82
    1357,94
    1358,75
    1359,41
    1360,57
    1361,78
    1362,78
    1363,93
    1364,70
    1365,100
    1366,87
    1367,103
    1368,57
    1369,93
    1370,71
    1371,90
    1372,63
    1373,82
    1374,113
    1375,33
    1376,59
    1377,93
    1378,84
    1379,90
    1380,67
    1381,102
    1382,77
    1383,101
    1384,61
    1385,89
    1386,93
    1387,85
    1388,67
    1389,90
    1390,93
    1391,40
    1392,46
    1393,97
    1394,76
    1395,97
    1396,72
    1397,92
    1398,81
    1399,117
    1400,67
    1401,85
    1402,82
    1403,78
    1404,81
    1405,82
    1406,83
    1407,38
    1408,48
    1409,97
    1410,83
    1411,102
    1412,69
    1413,82
    1414,88
    1415,106
    1416,55
    1417,106
    1418,84
    1419,109
    1420,71
    1421,85
    1422,99
    1423,39
    1424,60
    1425,81
    1426,76
    1427,85
    1428,89
    1429,86
    1430,82
    1431,109
    1432,56
    1433,81
    1434,81
    1435,108
    1436,81
    1437,97
    1438,83
    1439,30
    1440,76
    1441,75
    1442,79
    1443,100
    1444,86
    1445,98
    1446,99
    1447,123
    1448,58
    1449,92
    1450,72
    1451,92
    1452,84
    1453,95
    1454,86
    1455,46
    1456,51
    1457,88
    1458,80
    1459,95
    1460,72
    1461,91
    1462,88
    1463,130
    1464,65
    1465,90
    1466,74
    1467,104
    1468,74
    1469,100
    1470,101
    1471,26
    1472,58
    1473,105
    1474,82
    1475,102
    1476,74
    1477,88
    1478,80
    1479,124
    1480,73
    1481,87
    1482,89
    1483,96
    1484,83
    1485,78
    1486,114
    1487,32
    1488,75
    1489,96
    1490,82
    1491,113
    1492,78
    1493,87
    1494,78
    1495,110
    1496,51
    1497,106
    1498,90
    1499,116
    1500,84
    1501,98
    1502,101
    1503,27
    1504,60
    1505,92
    1506,91
    1507,112
    1508,91
    1509,91
    1510,84
    1511,115
    1512,69
    1513,81
    1514,97
    1515,99
    1516,95
    1517,93
    1518,102
    1519,58
    1520,55
    1521,100
    1522,82
    1523,106
    1524,94
    1525,102
    1526,95
    1527,119
    1528,78
    1529,102
    1530,87
    1531,104
    1532,87
    1533,93
    1534,88
    1535,17
    1536,61
    1537,116
    1538,91
    1539,104
    1540,87
    1541,112
    1542,90
    1543,112
    1544,68
    1545,115
    1546,73
    1547,119
    1548,92
    1549,131
    1550,100
    1551,47
    1552,54
    1553,100
    1554,88
    1555,103
    1556,85
    1557,103
    1558,101
    1559,136
    1560,86
    1561,107
    1562,94
    1563,100
    1564,88
    1565,107
    1566,112
    1567,46
    1568,71
    1569,98
    1570,91
    1571,116
    1572,72
    1573,112
    1574,107
    1575,135
    1576,75
    1577,102
    1578,105
    1579,135
    1580,91
    1581,112
    1582,108
    1583,44
    1584,74
    1585,88
    1586,100
    1587,101
    1588,95
    1589,117
    1590,110
    1591,126
    1592,71
    1593,117
    1594,99
    1595,122
    1596,89
    1597,120
    1598,109
    1599,41
    1600,90
    1601,124
    1602,106
    1603,94
    1604,99
    1605,114
    1606,107
    1607,135
    1608,81
    1609,127
    1610,97
    1611,118
    1612,112
    1613,117
    1614,118
    1615,56
    1616,61
    1617,130
    1618,101
    1619,139
    1620,81
    1621,125
    1622,112
    1623,142
    1624,72
    1625,104
    1626,111
    1627,132
    1628,101
    1629,114
    1630,129
    1631,62
    1632,85
    1633,126
    1634,124
    1635,116
    1636,111
    1637,123
    1638,119
    1639,139
    1640,81
    1641,112
    1642,119
    1643,141
    1644,96
    1645,127
    1646,122
    1647,70
    1648,89
    1649,124
    1650,108
    1651,139
    1652,99
    1653,134
    1654,105
    1655,173
    1656,89
    1657,137
    1658,96
    1659,138
    1660,99
    1661,91
    1662,78
    1663,24
    1664,40
    1665,63
    1666,55
    1667,53
    1668,48
    1669,67
    1670,57
    1671,66
    1672,31
    1673,64
    1674,56
    1675,67
    1676,43
    1677,66
    1678,57
    1679,26
    1680,40
    1681,53
    1682,45
    1683,66
    1684,52
    1685,53
    1686,69
    1687,69
    1688,42
    1689,55
    1690,60
    1691,54
    1692,43
    1693,53
    1694,57
    1695,27
    1696,44
    1697,48
    1698,62
    1699,55
    1700,41
    1701,50
    1702,38
    1703,77
    1704,45
    1705,59
    1706,48
    1707,74
    1708,56
    1709,59
    1710,62
    1711,24
    1712,45
    1713,47
    1714,50
    1715,57
    1716,55
    1717,65
    1718,48
    1719,77
    1720,38
    1721,49
    1722,58
    1723,55
    1724,45
    1725,62
    1726,54
    1727,18
    1728,49
    1729,47
    1730,48
    1731,70
    1732,50
    1733,58
    1734,50
    1735,75
    1736,48
    1737,55
    1738,45
    1739,62
    1740,35
    1741,65
    1742,51
    1743,19
    1744,35
    1745,52
    1746,57
    1747,69
    1748,44
    1749,57
    1750,54
    1751,68
    1752,45
    1753,44
    1754,69
    1755,64
    1756,37
    1757,54
    1758,65
    1759,24
    1760,42
    1761,53
    1762,57
    1763,46
    1764,54
    1765,56
    1766,52
    1767,63
    1768,40
    1769,56
    1770,63
    1771,50
    1772,49
    1773,65
    1774,55
    1775,32
    1776,46
    1777,45
    1778,54
    1779,66
    1780,44
    1781,51
    1782,50
    1783,80
    1784,34
    1785,55
    1786,53
    1787,73
    1788,41
    1789,55
    1790,54
    1791,10
    1792,40
    1793,46
    1794,50
    1795,63
    1796,51
    1797,48
    1798,60
    1799,63
    1800,42
    1801,57
    1802,53
    1803,64
    1804,36
    1805,47
    1806,86
    1807,21
    1808,28
    1809,48
    1810,66
    1811,58
    1812,39
    1813,52
    1814,51
    1815,67
    1816,43
    1817,55
    1818,49
    1819,57
    1820,58
    1821,56
    1822,68
    1823,21
    1824,38
    1825,52
    1826,45
    1827,62
    1828,61
    1829,57
    1830,42
    1831,62
    1832,42
    1833,54
    1834,54
    1835,59
    1836,37
    1837,54
    1838,59
    1839,28
    1840,43
    1841,61
    1842,52
    1843,61
    1844,46
    1845,61
    1846,41
    1847,67
    1848,41
    1849,58
    1850,46
    1851,66
    1852,53
    1853,59
    1854,48
    1855,15
    1856,46
    1857,49
    1858,55
    1859,55
    1860,54
    1861,51
    1862,59
    1863,54
    1864,56
    1865,50
    1866,47
    1867,57
    1868,48
    1869,69
    1870,55
    1871,26
    1872,29
    1873,55
    1874,49
    1875,59
    1876,44
    1877,54
    1878,36
    1879,68
    1880,42
    1881,52
    1882,62
    1883,60
    1884,46
    1885,70
    1886,53
    1887,16
    1888,46
    1889,59
    1890,49
    1891,61
    1892,45
    1893,58
    1894,47
    1895,69
    1896,39
    1897,51
    1898,57
    1899,65
    1900,37
    1901,56
    1902,59
    1903,25
    1904,34
    1905,60
    1906,50
    1907,54
    1908,43
    1909,66
    1910,39
    1911,65
    1912,28
    1913,65
    1914,42
    1915,70
    1916,41
    1917,63
    1918,53
    1919,20
    1920,36
    1921,54
    1922,49
    1923,48
    1924,55
    1925,58
    1926,51
    1927,70
    1928,49
    1929,53
    1930,60
    1931,51
    1932,50
    1933,50
    1934,52
    1935,21
    1936,42
    1937,44
    1938,41
    1939,64
    1940,40
    1941,65
    1942,56
    1943,62
    1944,41
    1945,64
    1946,48
    1947,44
    1948,45
    1949,55
    1950,56
    1951,30
    1952,47
    1953,65
    1954,36
    1955,49
    1956,44
    1957,48
    1958,48
    1959,62
    1960,40
    1961,66
    1962,50
    1963,50
    1964,48
    1965,63
    1966,47
    1967,21
    1968,37
    1969,55
    1970,48
    1971,60
    1972,48
    1973,54
    1974,60
    1975,67
    1976,46
    1977,52
    1978,59
    1979,52
    1980,48
    1981,40
    1982,65
    1983,16
    1984,38
    1985,60
    1986,42
    1987,49
    1988,41
    1989,56
    1990,57
    1991,59
    1992,29
    1993,53
    1994,60
    1995,73
    1996,45
    1997,49
    1998,47
    1999,11
    2000,53
    2001,56
    2002,55
    2003,64
    2004,53
    2005,46
    2006,51
    2007,62
    2008,38
    2009,56
    2010,48
    2011,60
    2012,46
    2013,41
    2014,65
    2015,13
    2016,29
    2017,63
    2018,41
    2019,66
    2020,46
    2021,59
    2022,39
    2023,72
    2024,37
    2025,61
    2026,58
    2027,56
    2028,43
    2029,50
    2030,55
    2031,33
    2032,33
    2033,59
    2034,50
    2035,46
    2036,48
    2037,63
    2038,61
    2039,58
    2040,33
    2041,48
    2042,52
    2043,54
    2044,51
    2045,50
    2046,39
    2047,3
    2048,26
    2049,64
    2050,55
    2051,59
    2052,42
    2053,57
    2054,48
    2055,55
    2056,37
    2057,55
    2058,52
    2059,46
    2060,40
    2061,61
    2062,55
    2063,31
    2064,36
    2065,47
    2066,52
    2067,56
    2068,44
    2069,56
    2070,71
    2071,116
    2072,62
    2073,104
    2074,98
    2075,121
    2076,120
    2077,129
    2078,150
    2079,44
    2080,111
    2081,145
    2082,147
    2083,180
    2084,135
    2085,156
    2086,144
    2087,184
    2088,129
    2089,152
    2090,137
    2091,153
    2092,101
    2093,123
    2094,104
    2095,37
    2096,63
    2097,73
    2098,65
    2099,87
    2100,55
    2101,54
    2102,49
    2103,73
    2104,42
    2105,62
    2106,71
    2107,106
    2108,86
    2109,139
    2110,141
    2111,44
    2112,104
    2113,145
    2114,102
    2115,101
    2116,51
    2117,48
    2118,29
    2119,32
    2120,15
    2121,23
    2122,24
    2123,22
    2124,20
    2125,15
    2126,23
    2127,5
    2128,12
    2129,18
    2130,20
    2131,15
    2132,13
    2133,25
    2134,11
    2135,18
    2136,13
    2137,21
    2138,21
    2139,17
    2140,14
    2141,20
    2142,14
    2143,4
    2144,11
    2145,25
    2146,14
    2147,19
    2148,21
    2149,26
    2150,13
    2151,26
    2152,11
    2153,11
    2154,22
    2155,24
    2156,19
    2157,6
    2158,19
    2159,8
    2160,10
    2161,21
    2162,21
    2163,25
    2164,18
    2165,17
    2166,18
    2167,13
    2168,16
    2169,23
    2170,12
    2171,14
    2172,7
    2173,27
    2174,15
    2175,8
    2176,15
    2177,16
    2178,13
    2179,22
    2180,12
    2181,25
    2182,20
    2183,20
    2184,10
    2185,19
    2186,14
    2187,28
    2188,12
    2189,18
    2190,13
    2191,5
    2192,13
    2193,20
    2194,15
    2195,17
    2196,13
    2197,19
    2198,14
    2199,20
    2200,15
    2201,29
    2202,14
    2203,18
    2204,12
    2205,16
    2206,20
    2207,5
    2208,14
    2209,19
    2210,15
    2211,22
    2212,13
    2213,16
    2214,11
    2215,15
    2216,19
    2217,23
    2218,17
    2219,15
    2220,8
    2221,17
    2222,15
    2223,7
    2224,13
    2225,17
    2226,19
    2227,15
    2228,15
    2229,27
    2230,6
    2231,27
    2232,15
    2233,18
    2234,17
    2235,13
    2236,18
    2237,23
    2238,12
    2239,4
    2240,9
    2241,22
    2242,15
    2243,22
    2244,14
    2245,26
    2246,11
    2247,18
    2248,7
    2249,15
    2250,22
    2251,24
    2252,12
    2253,24
    2254,19
    2255,4
    2256,12
    2257,17
    2258,17
    2259,17
    2260,11
    2261,17
    2262,10
    2263,19
    2264,14
    2265,16
    2266,18
    2267,20
    2268,14
    2269,17
    2270,24
    2271,5
    2272,12
    2273,15
    2274,11
    2275,16
    2276,20
    2277,17
    2278,17
    2279,22
    2280,11
    2281,13
    2282,15
    2283,20
    2284,6
    2285,22
    2286,23
    2287,6
    2288,15
    2289,23
    2290,12
    2291,18
    2292,6
    2293,20
    2294,18
    2295,17
    2296,19
    2297,15
    2298,18
    2299,9
    2300,19
    2301,17
    2302,23
    2303,2
    2304,11
    2305,12
    2306,20
    2307,20
    2308,12
    2309,20
    2310,11
    2311,18
    2312,13
    2313,19
    2314,10
    2315,19
    2316,17
    2317,17
    2318,20
    2319,7
    2320,9
    2321,19
    2322,19
    2323,12
    2324,11
    2325,16
    2326,20
    2327,19
    2328,13
    2329,17
    2330,14
    2331,18
    2332,13
    2333,12
    2334,24
    2335,9
    2336,13
    2337,15
    2338,14
    2339,16
    2340,15
    2341,19
    2342,16
    2343,17
    2344,11
    2345,15
    2346,15
    2347,11
    2348,13
    2349,12
    2350,20
    2351,7
    2352,18
    2353,15
    2354,15
    2355,18
    2356,16
    2357,13
    2358,18
    2359,14
    2360,12
    2361,16
    2362,22
    2363,18
    2364,16
    2365,22
    2366,11
    2367,6
    2368,13
    2369,18
    2370,13
    2371,15
    2372,13
    2373,8
    2374,21
    2375,24
    2376,9
    2377,14
    2378,15
    2379,18
    2380,15
    2381,14
    2382,20
    2383,3
    2384,14
    2385,16
    2386,16
    2387,20
    2388,18
    2389,20
    2390,13
    2391,21
    2392,7
    2393,16
    2394,10
    2395,18
    2396,19
    2397,9
    2398,12
    2399,6
    2400,15
    2401,17
    2402,18
    2403,24
    2404,16
    2405,14
    2406,10
    2407,17
    2408,9
    2409,19
    2410,14
    2411,17
    2412,14
    2413,15
    2414,13
    2415,8
    2416,12
    2417,20
    2418,16
    2419,14
    2420,7
    2421,22
    2422,19
    2423,19
    2424,15
    2425,13
    2426,11
    2427,11
    2428,16
    2429,13
    2430,20
    2431,4
    2432,8
    2433,24
    2434,14
    2435,17
    2436,12
    2437,11
    2438,12
    2439,20
    2440,14
    2441,12
    2442,13
    2443,14
    2444,12
    2445,19
    2446,16
    2447,5
    2448,14
    2449,17
    2450,19
    2451,14
    2452,11
    2453,18
    2454,16
    2455,16
    2456,11
    2457,18
    2458,14
    2459,20
    2460,11
    2461,19
    2462,17
    2463,1
    2464,10
    2465,14
    2466,16
    2467,17
    2468,16
    2469,15
    2470,16
    2471,13
    2472,14
    2473,16
    2474,16
    2475,16
    2476,11
    2477,14
    2478,21
    2479,4
    2480,7
    2481,13
    2482,17
    2483,15
    2484,16
    2485,16
    2486,11
    2487,20
    2488,9
    2489,17
    2490,14
    2491,16
    2492,15
    2493,17
    2494,14
    2495,2
    2496,17
    2497,22
    2498,14
    2499,7
    2500,16
    2501,17
    2502,18
    2503,15
    2504,12
    2505,12
    2506,14
    2507,16
    2508,9
    2509,21
    2510,18
    2511,2
    2512,8
    2513,14
    2514,12
    2515,20
    2516,10
    2517,19
    2518,16
    2519,11
    2520,17
    2521,17
    2522,9
    2523,12
    2524,15
    2525,17
    2526,15
    2527,5
    2528,11
    2529,13
    2530,14
    2531,16
    2532,15
    2533,21
    2534,11
    2535,19
    2536,13
    2537,10
    2538,14
    2539,11
    2540,20
    2541,14
    2542,19
    2543,5
    2544,5
    2545,11
    2546,19
    2547,16
    2548,13
    2549,14
    2550,13
    2551,18
    2552,12
    2553,20
    2554,14
    2555,17
    2556,12
    2557,12
    2558,18
    2559,7
    2560,5
    2561,23
    2562,15
    2563,9
    2564,10
    2565,17
    2566,10
    2567,20
    2568,8
    2569,15
    2570,15
    2571,13
    2572,18
    2573,15
    2574,11
    2575,2
    2576,13
    2577,10
    2578,12
    2579,21
    2580,15
    2581,20
    2582,7
    2583,16
    2584,17
    2585,20
    2586,12
    2587,18
    2588,9
    2589,16
    2590,18
    2591,10
    2592,6
    2593,9
    2594,13
    2595,19
    2596,16
    2597,11
    2598,9
    2599,16
    2600,7
    2601,17
    2602,21
    2603,14
    2604,19
    2605,22
    2606,9
    2607,7
    2608,9
    2609,12
    2610,17
    2611,16
    2612,13
    2613,9
    2614,10
    2615,21
    2616,9
    2617,13
    2618,14
    2619,12
    2620,16
    2621,16
    2622,13
    2623,5
    2624,15
    2625,13
    2626,14
    2627,13
    2628,15
    2629,13
    2630,10
    2631,11
    2632,12
    2633,18
    2634,16
    2635,14
    2636,20
    2637,15
    2638,9
    2639,2
    2640,9
    2641,13
    2642,12
    2643,20
    2644,18
    2645,15
    2646,8
    2647,15
    2648,8
    2649,19
    2650,11
    2651,16
    2652,9
    2653,17
    2654,16
    2655,4
    2656,11
    2657,13
    2658,18
    2659,11
    2660,11
    2661,19
    2662,11
    2663,18
    2664,10
    2665,17
    2666,6
    2667,14
    2668,8
    2669,15
    2670,21
    2671,5
    2672,14
    2673,16
    2674,9
    2675,17
    2676,11
    2677,15
    2678,7
    2679,14
    2680,10
    2681,16
    2682,21
    2683,17
    2684,11
    2685,11
    2686,18
    2687,1
    2688,10
    2689,17
    2690,9
    2691,15
    2692,13
    2693,13
    2694,18
    2695,15
    2696,7
    2697,12
    2698,12
    2699,16
    2700,11
    2701,18
    2702,12
    2703,4
    2704,9
    2705,13
    2706,13
    2707,14
    2708,12
    2709,21
    2710,12
    2711,22
    2712,9
    2713,10
    2714,10
    2715,11
    2716,20
    2717,9
    2718,19
    2719,2
    2720,17
    2721,11
    2722,11
    2723,9
    2724,13
    2725,9
    2726,17
    2727,24
    2728,9
    2729,12
    2730,12
    2731,17
    2732,8
    2733,14
    2734,17
    2735,3
    2736,12
    2737,16
    2738,17
    2739,13
    2740,15
    2741,12
    2742,14
    2743,11
    2744,8
    2745,16
    2746,14
    2747,11
    2748,15
    2749,14
    2750,10
    2751,3
    2752,12
    2753,9
    2754,14
    2755,10
    2756,14
    2757,15
    2758,14
    2759,13
    2760,10
    2761,15
    2762,12
    2763,15
    2764,10
    2765,16
    2766,10
    2767,5
    2768,13
    2769,19
    2770,10
    2771,13
    2772,11
    2773,12
    2774,8
    2775,17
    2776,12
    2777,18
    2778,10
    2779,13
    2780,13
    2781,13
    2782,17
    2783,4
    2784,9
    2785,13
    2786,12
    2787,10
    2788,13
    2789,14
    2790,20
    2791,15
    2792,6
    2793,15
    2794,12
    2795,12
    2796,8
    2797,12
    2798,18
    2799,8
    2800,12
    2801,10
    2802,11
    2803,17
    2804,16
    2805,12
    2806,10
    2807,17
    2808,14
    2809,12
    2810,9
    2811,17
    2812,9
    2813,18
    2814,9
    2815,9
    2816,10
    2817,12
    2818,9
    2819,19
    2820,13
    2821,10
    2822,15
    2823,17
    2824,9
    2825,7
    2826,11
    2827,17
    2828,9
    2829,19
    2830,12
    2831,2
    2832,9
    2833,12
    2834,20
    2835,15
    2836,8
    2837,12
    2838,17
    2839,15
    2840,4
    2841,15
    2842,9
    2843,16
    2844,14
    2845,15
    2846,11
    2847,5
    2848,9
    2849,9
    2850,14
    2851,16
    2852,16
    2853,10
    2854,10
    2855,14
    2856,11
    2857,11
    2858,14
    2859,14
    2860,13
    2861,11
    2862,17
    2863,2
    2864,11
    2865,16
    2866,10
    2867,12
    2868,17
    2869,14
    2870,10
    2871,15
    2872,6
    2873,13
    2874,9
    2875,18
    2876,10
    2877,15
    2878,20
    2879,4
    2880,9
    2881,8
    2882,12
    2883,7
    2884,13
    2885,20
    2886,13
    2887,11
    2888,12
    2889,17
    2890,10
    2891,13
    2892,6
    2893,13
    2894,11
    2895,5
    2896,11
    2897,17
    2898,13
    2899,13
    2900,12
    2901,14
    2902,9
    2903,16
    2904,6
    2905,7
    2906,15
    2907,16
    2908,12
    2909,15
    2910,18
    2911,2
    2912,8
    2913,9
    2914,8
    2915,12
    2916,15
    2917,13
    2918,10
    2919,12
    2920,7
    2921,19
    2922,13
    2923,23
    2924,9
    2925,10
    2926,16
    2927,1
    2928,8
    2929,15
    2930,13
    2931,12
    2932,13
    2933,12
    2934,10
    2935,13
    2936,9
    2937,11
    2938,10
    2939,16
    2940,16
    2941,8
    2942,11
    2943,4
    2944,7
    2945,13
    2946,15
    2947,11
    2948,7
    2949,10
    2950,16
    2951,21
    2952,12
    2953,11
    2954,10
    2955,10
    2956,14
    2957,16
    2958,17
    2959,3
    2960,9
    2961,7
    2962,13
    2963,16
    2964,7
    2965,8
    2966,14
    2967,15
    2968,8
    2969,15
    2970,11
    2971,11
    2972,18
    2973,9
    2974,11
    2975,4
    2976,10
    2977,10
    2978,15
    2979,14
    2980,11
    2981,16
    2982,10
    2983,10
    2984,11
    2985,10
    2986,13
    2987,16
    2988,9
    2989,12
    2990,12
    2991,4
    2992,14
    2993,10
    2994,13
    2995,10
    2996,13
    2997,7
    2998,13
    2999,19
    3000,8
    3001,11
    3002,15
    3003,12
    3004,10
    3005,18
    3006,8
    3007,1
    3008,9
    3009,13
    3010,8
    3011,18
    3012,10
    3013,6
    3014,11
    3015,14
    3016,12
    3017,11
    3018,15
    3019,13
    3020,15
    3021,10
    3022,11
    3023,4
    3024,10
    3025,8
    3026,8
    3027,11
    3028,13
    3029,16
    3030,12
    3031,12
    3032,10
    3033,11
    3034,13
    3035,18
    3036,10
    3037,13
    3038,13
    3039,4
    3040,11
    3041,8
    3042,14
    3043,11
    3044,10
    3045,9
    3046,15
    3047,15
    3048,7
    3049,12
    3050,7
    3051,13
    3052,11
    3053,10
    3054,13
    3055,4
    3056,12
    3057,11
    3058,15
    3059,9
    3060,13
    3061,15
    3062,7
    3063,13
    3064,11
    3065,8
    3066,15
    3067,17
    3068,11
    3069,11
    3070,11
    3071,15
    3072,9
    3073,14
    3074,10
    3075,12
    3076,10
    3077,6
    3078,12
    3079,14
    3080,10
    3081,7
    3082,12
    3083,13
    3084,12
    3085,14
    3086,12
    3087,2
    3088,10
    3089,9
    3090,13
    3091,21
    3092,8
    3093,7
    3094,12
    3095,16
    3096,13
    3097,7
    3098,11
    3099,12
    3100,12
    3101,10
    3102,16
    3103,5
    3104,10
    3105,6
    3106,17
    3107,10
    3108,5
    3109,17
    3110,13
    3111,17
    3112,9
    3113,11
    3114,10
    3115,9
    3116,11
    3117,14
    3118,7
    3119,5
    3120,14
    3121,10
    3122,11
    3123,14
    3124,12
    3125,12
    3126,11
    3127,8
    3128,9
    3129,14
    3130,16
    3131,9
    3132,10
    3133,8
    3134,15
    3135,3
    3136,10
    3137,9
    3138,11
    3139,12
    3140,11
    3141,15
    3142,8
    3143,12
    3144,9
    3145,16
    3146,10
    3147,10
    3148,13
    3149,12
    3150,6
    3151,4
    3152,8
    3153,11
    3154,14
    3155,12
    3156,18
    3157,10
    3158,9
    3159,13
    3160,10
    3161,10
    3162,13
    3163,11
    3164,6
    3165,18
    3166,11
    3167,3
    3168,8
    3169,14
    3170,10
    3171,11
    3172,12
    3173,12
    3174,4
    3175,12
    3176,12
    3177,9
    3178,12
    3179,9
    3180,13
    3181,9
    3182,18
    3183,2
    3184,6
    3185,15
    3186,10
    3187,8
    3188,10
    3189,10
    3190,19
    3191,16
    3192,6
    3193,12
    3194,12
    3195,15
    3196,4
    3197,10
    3198,7
    3199,1
    3200,11
    3201,17
    3202,12
    3203,9
    3204,15
    3205,13
    3206,11
    3207,10
    3208,9
    3209,11
    3210,10
    3211,8
    3212,16
    3213,9
    3214,10
    3215,1
    3216,12
    3217,9
    3218,15
    3219,9
    3220,9
    3221,14
    3222,10
    3223,13
    3224,9
    3225,8
    3226,11
    3227,15
    3228,11
    3229,10
    3230,15
    3231,0
    3232,7
    3233,10
    3234,9
    3235,12
    3236,13
    3237,13
    3238,11
    3239,12
    3240,9
    3241,9
    3242,11
    3243,11
    3244,11
    3245,11
    3246,16
    3247,1
    3248,5
    3249,8
    3250,12
    3251,14
    3252,16
    3253,7
    3254,14
    3255,5
    3256,12
    3257,14
    3258,11
    3259,8
    3260,8
    3261,11
    3262,13
    3263,1
    3264,4
    3265,18
    3266,12
    3267,15
    3268,6
    3269,13
    3270,12
    3271,11
    3272,12
    3273,10
    3274,9
    3275,11
    3276,12
    3277,18
    3278,11
    3279,1
    3280,8
    3281,7
    3282,8
    3283,8
    3284,13
    3285,11
    3286,11
    3287,19
    3288,6
    3289,13
    3290,8
    3291,16
    3292,9
    3293,8
    3294,8
    3295,2
    3296,9
    3297,12
    3298,20
    3299,7
    3300,11
    3301,7
    3302,11
    3303,7
    3304,12
    3305,7
    3306,9
    3307,13
    3308,7
    3309,19
    3310,17
    3311,9
    3312,3
    3313,5
    3314,9
    3315,11
    3316,11
    3317,13
    3318,7
    3319,7
    3320,13
    3321,14
    3322,10
    3323,12
    3324,13
    3325,13
    3326,9
    3327,7
    3328,12
    3329,2
    3330,15
    3331,11
    3332,15
    3333,8
    3334,7
    3335,9
    3336,14
    3337,10
    3338,10
    3339,7
    3340,14
    3341,10
    3342,8
    3343,0
    3344,12
    3345,12
    3346,10
    3347,9
    3348,15
    3349,6
    3350,13
    3351,13
    3352,12
    3353,8
    3354,11
    3355,11
    3356,12
    3357,6
    3358,15
    3359,3
    3360,11
    3361,9
    3362,12
    3363,12
    3364,5
    3365,10
    3366,11
    3367,16
    3368,9
    3369,11
    3370,6
    3371,13
    3372,8
    3373,8
    3374,6
    3375,1
    3376,11
    3377,12
    3378,11
    3379,14
    3380,11
    3381,9
    3382,12
    3383,10
    3384,11
    3385,8
    3386,8
    3387,11
    3388,9
    3389,14
    3390,15
    3391,3
    3392,12
    3393,10
    3394,9
    3395,11
    3396,10
    3397,8
    3398,11
    3399,10
    3400,16
    3401,7
    3402,9
    3403,12
    3404,7
    3405,11
    3406,12
    3407,4
    3408,5
    3409,12
    3410,9
    3411,9
    3412,7
    3413,13
    3414,8
    3415,13
    3416,13
    3417,5
    3418,14
    3419,12
    3420,11
    3421,11
    3422,9
    3423,1
    3424,10
    3425,8
    3426,9
    3427,13
    3428,9
    3429,17
    3430,7
    3431,12
    3432,12
    3433,11
    3434,8
    3435,5
    3436,8
    3437,13
    3438,10
    3439,3
    3440,12
    3441,7
    3442,13
    3443,13
    3444,8
    3445,12
    3446,8
    3447,14
    3448,10
    3449,9
    3450,5
    3451,5
    3452,16
    3453,9
    3454,11
    3455,3
    3456,11
    3457,8
    3458,7
    3459,11
    3460,12
    3461,10
    3462,10
    3463,15
    3464,3
    3465,17
    3466,11
    3467,5
    3468,8
    3469,7
    3470,12
    3471,0
    3472,13
    3473,13
    3474,5
    3475,13
    3476,12
    3477,12
    3478,10
    3479,7
    3480,8
    3481,10
    3482,13
    3483,14
    3484,3
    3485,11
    3486,9
    3487,0
    3488,11
    3489,10
    3490,10
    3491,10
    3492,9
    3493,7
    3494,12
    3495,18
    3496,10
    3497,9
    3498,9
    3499,15
    3500,8
    3501,9
    3502,10
    3503,1
    3504,9
    3505,7
    3506,12
    3507,12
    3508,9
    3509,11
    3510,13
    3511,9
    3512,7
    3513,10
    3514,11
    3515,10
    3516,7
    3517,10
    3518,14
    3519,1
    3520,8
    3521,7
    3522,5
    3523,16
    3524,12
    3525,7
    3526,12
    3527,6
    3528,9
    3529,12
    3530,12
    3531,11
    3532,7
    3533,11
    3534,9
    3535,1
    3536,6
    3537,10
    3538,4
    3539,15
    3540,13
    3541,11
    3542,9
    3543,9
    3544,6
    3545,19
    3546,5
    3547,13
    3548,7
    3549,7
    3550,11
    3551,3
    3552,9
    3553,9
    3554,13
    3555,5
    3556,13
    3557,12
    3558,6
    3559,17
    3560,12
    3561,5
    3562,8
    3563,9
    3564,12
    3565,12
    3566,11
    3567,2
    3568,7
    3569,6
    3570,10
    3571,13
    3572,7
    3573,11
    3574,12
    3575,9
    3576,14
    3577,13
    3578,3
    3579,10
    3580,5
    3581,14
    3582,19
    3583,1
    3584,6
    3585,9
    3586,7
    3587,13
    3588,12
    3589,7
    3590,10
    3591,15
    3592,5
    3593,6
    3594,10
    3595,10
    3596,5
    3597,11
    3598,12
    3599,0
    3600,9
    3601,14
    3602,8
    3603,11
    3604,7
    3605,12
    3606,6
    3607,9
    3608,10
    3609,13
    3610,12
    3611,3
    3612,9
    3613,7
    3614,12
    3615,0
    3616,11
    3617,17
    3618,8
    3619,12
    3620,10
    3621,8
    3622,8
    3623,10
    3624,7
    3625,10
    3626,8
    3627,7
    3628,12
    3629,10
    3630,11
    3631,1
    3632,13
    3633,9
    3634,8
    3635,9
    3636,10
    3637,15
    3638,6
    3639,10
    3640,9
    3641,8
    3642,7
    3643,9
    3644,12
    3645,10
    3646,17
    3647,0
    3648,8
    3649,9
    3650,10
    3651,7
    3652,6
    3653,9
    3654,11
    3655,13
    3656,2
    3657,13
    3658,15
    3659,12
    3660,12
    3661,11
    3662,6
    3663,1
    3664,9
    3665,13
    3666,12
    3667,9
    3668,7
    3669,8
    3670,7
    3671,7
    3672,8
    3673,17
    3674,7
    3675,5
    3676,6
    3677,12
    3678,13
    3679,4
    3680,8
    3681,10
    3682,6
    3683,9
    3684,11
    3685,5
    3686,6
    3687,15
    3688,6
    3689,8
    3690,12
    3691,9
    3692,11
    3693,8
    3694,9
    3695,1
    3696,9
    3697,12
    3698,8
    3699,9
    3700,8
    3701,9
    3702,11
    3703,8
    3704,8
    3705,12
    3706,9
    3707,6
    3708,14
    3709,11
    3710,12
    3711,0
    3712,9
    3713,9
    3714,8
    3715,10
    3716,10
    3717,7
    3718,9
    3719,9
    3720,12
    3721,8
    3722,6
    3723,10
    3724,11
    3725,9
    3726,10
    3727,0
    3728,12
    3729,10
    3730,8
    3731,4
    3732,13
    3733,9
    3734,7
    3735,9
    3736,10
    3737,13
    3738,4
    3739,10
    3740,11
    3741,9
    3742,11
    3743,1
    3744,9
    3745,9
    3746,9
    3747,9
    3748,10
    3749,10
    3750,6
    3751,6
    3752,15
    3753,10
    3754,4
    3755,13
    3756,8
    3757,7
    3758,10
    3759,4
    3760,6
    3761,9
    3762,9
    3763,17
    3764,5
    3765,9
    3766,7
    3767,12
    3768,8
    3769,8
    3770,7
    3771,8
    3772,8
    3773,9
    3774,13
    3775,0
    3776,7
    3777,12
    3778,7
    3779,12
    3780,7
    3781,14
    3782,7
    3783,13
    3784,7
    3785,5
    3786,7
    3787,11
    3788,13
    3789,10
    3790,5
    3791,2
    3792,12
    3793,10
    3794,8
    3795,8
    3796,8
    3797,10
    3798,6
    3799,11
    3800,4
    3801,10
    3802,15
    3803,4
    3804,9
    3805,6
    3806,13
    3807,0
    3808,9
    3809,6
    3810,9
    3811,10
    3812,9
    3813,7
    3814,13
    3815,7
    3816,4
    3817,14
    3818,10
    3819,11
    3820,7
    3821,7
    3822,14
    3823,4
    3824,5
    3825,10
    3826,11
    3827,7
    3828,11
    3829,13
    3830,8
    3831,9
    3832,7
    3833,10
    3834,8
    3835,10
    3836,14
    3837,7
    3838,10
    3839,1
    3840,7
    3841,9
    3842,10
    3843,10
    3844,7
    3845,14
    3846,6
    3847,7
    3848,11
    3849,10
    3850,6
    3851,7
    3852,7
    3853,12
    3854,7
    3855,2
    3856,9
    3857,6
    3858,10
    3859,10
    3860,4
    3861,15
    3862,13
    3863,10
    3864,9
    3865,8
    3866,3
    3867,14
    3868,5
    3869,11
    3870,6
    3871,2
    3872,11
    3873,7
    3874,14
    3875,5
    3876,7
    3877,5
    3878,11
    3879,13
    3880,10
    3881,5
    3882,16
    3883,12
    3884,6
    3885,6
    3886,7
    3887,4
    3888,8
    3889,11
    3890,5
    3891,5
    3892,5
    3893,16
    3894,8
    3895,8
    3896,7
    3897,5
    3898,12
    3899,10
    3900,11
    3901,9
    3902,9
    3903,0
    3904,9
    3905,6
    3906,10
    3907,8
    3908,5
    3909,10
    3910,12
    3911,8
    3912,6
    3913,11
    3914,11
    3915,5
    3916,12
    3917,5
    3918,12
    3919,0
    3920,8
    3921,13
    3922,4
    3923,8
    3924,7
    3925,11
    3926,8
    3927,10
    3928,9
    3929,10
    3930,4
    3931,12
    3932,10
    3933,12
    3934,7
    3935,0
    3936,11
    3937,8
    3938,3
    3939,11
    3940,8
    3941,9
    3942,10
    3943,7
    3944,8
    3945,3
    3946,13
    3947,12
    3948,10
    3949,7
    3950,6
    3951,1
    3952,6
    3953,5
    3954,19
    3955,8
    3956,11
    3957,14
    3958,5
    3959,6
    3960,8
    3961,8
    3962,8
    3963,11
    3964,7
    3965,6
    3966,12
    3967,0
    3968,5
    3969,13
    3970,8
    3971,7
    3972,7
    3973,7
    3974,7
    3975,9
    3976,5
    3977,9
    3978,15
    3979,4
    3980,5
    3981,13
    3982,12
    3983,0
    3984,11
    3985,7
    3986,4
    3987,10
    3988,8
    3989,9
    3990,12
    3991,7
    3992,6
    3993,9
    3994,12
    3995,6
    3996,10
    3997,6
    3998,8
    3999,1
    4000,9
    4001,12
    4002,7
    4003,6
    4004,2
    4005,13
    4006,10
    4007,9
    4008,8
    4009,3
    4010,7
    4011,11
    4012,8
    4013,7
    4014,15
    4015,0
    4016,9
    4017,5
    4018,5
    4019,10
    4020,9
    4021,7
    4022,9
    4023,6
    4024,9
    4025,10
    4026,9
    4027,5
    4028,8
    4029,9
    4030,14
    4031,1
    4032,4
    4033,6
    4034,10
    4035,10
    4036,14
    4037,4
    4038,9
    4039,8
    4040,4
    4041,11
    4042,6
    4043,15
    4044,5
    4045,8
    4046,10
    4047,0
    4048,7
    4049,10
    4050,6
    4051,10
    4052,8
    4053,8
    4054,12
    4055,10
    4056,10
    4057,10
    4058,19
    4059,12
    4060,17
    4061,10
    4062,36
    4063,3
    4064,38
    4065,93
    4066,153
    4067,252
    4068,236
    4069,265
    4070,270
    4071,300
    4072,263
    4073,309
    4074,291
    4075,314
    4076,271
    4077,278
    4078,359
    4079,80
    4080,304
    4081,307
    4082,292
    4083,293
    4084,279
    4085,277
    4086,310
    4087,324
    4088,315
    4089,317
    4090,266
    4091,293
    4092,315
    4093,499
    4094,1256
    4095,1357

  15. #15
    Junior Member
    Join Date
    May 2020
    Posts
    12
    Thank you for taking your time to test it. Any chance you might do the same with Teensy 4.0, to confirm/disprove my findings?

  16. #16
    Senior Member
    Join Date
    Oct 2012
    Location
    Portland OR
    Posts
    689

    Teensy 4.0 ADC histogram without averaging

    Running the same code as in my previous post, on Teensy 4.0 board shows a different pattern than on T4.1. On the Teensy 4.0 board, every 16th ADC value, that is ADC readings of the form (16*n - 1) or specifically values 15, 31, 47, 63 and so on) is under-represented. These "weak" histogram bins are much lower (less frequently observed) than the others, but are generally not 0. I wonder if the CPU speed has any influence on this, I used 600 MHz. I attach the raw histogram data as a zipped CSV file.

    Click image for larger version. 

Name:	Teensy4-ADC-Histogram.png 
Views:	5 
Size:	64.3 KB 
ID:	20124

    Teensy4p0_ADC_Hist.csv.zip

  17. #17
    Junior Member
    Join Date
    May 2020
    Posts
    12
    Correct me if I am wrong, but this looks like a data mapping/scaling issue, again, but done properly, maybe even with some kind of randomizer to fill the gaps between "meaningful" values... At least the underexposed values are distributed uniformly across the range, not grouped together at the end of each 256-long segment as in my case. Why am I seeing such a different pattern on my T4.0 boards?? Could it be signal impedance that is affecting data? Not likely... I tried it with different signal sources, from microphone to pot to Teensy 3.2 generating a sine wave through DAC. All with different impedances, the results were the same. I guess at this point I need to accept this behavior, implement workarounds and move on with my coding. Maybe explanation will come later.

    Thank you for your time, JBeale.

    P.S. I am also running my boards at 600Mhz.

  18. #18
    Senior Member
    Join Date
    Oct 2015
    Location
    Roma (IT, EU)
    Posts
    314
    Wild speculation:

    At 600 MHz, the 1062 core is running at a slightly higher voltage (to get stability).
    At 528 MHz, it runs at lower voltage (as a result, is more power efficient: https://forum.pjrc.com/threads/60698...at-various-MHz )
    Maybe you get less EMI as a result, and less spurious ADC reading?
    I know they don't look like spurious reading (more like a systematic error), but maybe it's worth a try?

  19. #19
    Senior Member
    Join Date
    Oct 2012
    Location
    Portland OR
    Posts
    689
    Quote Originally Posted by XFer View Post
    At 600 MHz, the 1062 core is running at a slightly higher voltage (to get stability).
    At 528 MHz, it runs at lower voltage (as a result, is more power efficient: https://forum.pjrc.com/threads/60698...at-various-MHz )
    Maybe you get less EMI as a result, and less spurious ADC reading?
    I know they don't look like spurious reading (more like a systematic error), but maybe it's worth a try?
    I did try the same program & setup with the processor set to 528 MHz. The results look about the same, with the same comb-filter spikes spaced 16 units apart at 15, 31, etc.
    I also tried without intermediate Serial.print() statements, just incrementing the histogram array internally and printing out afterwards; same result.
    Also at maximum speed without the 1 msec delay between readings; same result.
    With a little bit of averaging, like analogReadAveraging(4); the pattern is still there, but a lot less noticeable.
    I might guess it's just how the ADC hardware works on the T4.0 chip.

    By the way, it looks like the "keeper" mode is still on by default. There is a larger histogram dip around ADC value = 2064, but if you turn it off in setup like
    IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_02 = 0xb0; (specific to channel A0) then the dip is gone. Plots were done with analogReadAveraging(16)

    Click image for larger version. 

Name:	T4-Keeper-on-off.png 
Views:	1 
Size:	207.3 KB 
ID:	20146
    Last edited by JBeale; 05-16-2020 at 10:16 PM. Reason: add keeper on/off comparison

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •