AnsweredAssumed Answered

adc problem

Question asked by Max on Aug 25, 2011
Latest reply on Aug 25, 2011 by brazov.ajeje
Hi all,
I'm trying to work with the ADC of the Discovery board but I've some problem.
At the end of my test I can only read something from an4 to an9.
There is no way to read the first 4 channel, from an0 to an3.
If I connect the pins from ain0 to ain3 to gnd or vcc then the value read is always a random value, the same that I have if I leave the pin floating.
Please help to find a solution......
Here below some lines of my code:

          GPIO_Init(GPIOE, GPIO_PIN_6,           GPIO_MODE_IN_FL_NO_IT);          //ain9
          GPIO_Init(GPIOE, GPIO_PIN_7,           GPIO_MODE_IN_FL_NO_IT);          //ain8
          GPIO_Init(GPIOB, GPIO_PIN_ALL,      GPIO_MODE_IN_FL_NO_IT);           //ain0-ain7

          ADC1_ScanModeCmd(ENABLE); //ENABLE

          for(i=0; i<=9;i++)
               Conversion_Values[i] = ADC1_GetBufferValue(i);
          csr_temp = ADC1->CSR;
          csr_temp &= (uint8_t)~ADC1_IT_EOC;
          csr_temp |= (uint8_t)(ADC1_CHANNEL_9);
          ADC1->CSR = csr_temp;