cancel
Showing results for 
Search instead for 
Did you mean: 

SPBTLE-1S internal ADC

michelemancini2
Associate III

I'm using this device. with "BlueNRG-1_2 DK 3.1.0"

I have a problem with reading ADC.

use two channels pin1, pin2 (ADC1, ADC2), connected to two potentiometers (analog joystick)

I can read only one channel, how can I read the two channels?

In this code the value of adc is not correct, why?

//------------Configure ADC 
SysCtrl_PeripheralClockCmd(CLOCK_PERIPH_ADC, ENABLE);
xADC_InitType.ADC_OSR = ADC_OSR_200;
xADC_InitType.ADC_Input = ADC_Input_AdcPin2 | ADC_Input_AdcPin1;
xADC_InitType.ADC_ConversionMode = ADC_ConversionMode_Single;
xADC_InitType.ADC_ReferenceVoltage = ADC_ReferenceVoltage_0V0;   xADC_InitType.ADC_Attenuation = ADC_Attenuation_6dB02;
ADC_Init(&xADC_InitType);
ADC_SelectInput(ADC_Input_AdcPin2);
ADC_Cmd(ENABLE);
 
//------------------READ
 
if(ADC_GetFlagStatus(ADC_FLAG_EOC)) {
      if(channelselect==0){
        channelselect=1;
        
        raw_value2 = (int16_t)ADC_GetRawData();
        ADC_SelectInput(ADC_Input_AdcPin1);
 
      }else{
        channelselect=0;
 
         raw_value1 = (int16_t)ADC_GetRawData();
         ADC_SelectInput(ADC_Input_AdcPin2);
      }
 
      ADC_Cmd(ENABLE);
    }

5 REPLIES 5
Stabilo
Associate III

I have the same issue. Did you found something ?

Could someone help please ?

Aoruc.1
Associate II

Hello !

I have exactly the same problem !

Did you find a solution please?

Stabilo
Associate III

Hello,

The issue was that my system clock was configured to 32Mhz and the ADC is not working fine at 32Mhz (see errata sheet).

You should reconfigure the system clock to 16Mhz.

Thank you for your prompt reponse !
Thank you !

Hello Stabilo,

My ADC is working properly, but BLE disconects every 15 secondes.

The BLE disconnects every 15 seconds. I lower the frequency during my ADC routine and increase it just after. This causes a malfunction on my bluetooth communication. Do you have any advice?

bests regards,