ADC Hangs

20 Dec 2011

Hi

I'm currently using both simon's ADC_test code (http://mbed.org/users/simonb/programs/ADC_test/5zlnn/docs/) as well as the mbed AnalogIn lib The code calling Simons lib is

                ADC adc(SAMPLE_RATE,1);
                
                ...
                PinName p = ndx==0?p19:p20;
                
                adc.setup(p, 1);
    
                adc.select(p);

                //Start ADC conversion
                adc.start();

                //Wait for it to complete
                while (!adc.done(p));
                                               
                int value = adc.read(p);
                printf("Raw=0x%4.4X\r\n", value);

                adc.setup(p, 0);

What I notice is that use AnalogIn calls, then use Simons lib but after that each subsequent call to AnalogIn fails (mbed hangs until reset).

The same happens with my timer1/mat based code. After a single call to that both simons lib and AnalogIn fail by hanging.

Any suggestions where the two bite each other?