Вот рабочий код для SDADC_1 50kHz. Осторожно: смотреть как подключен SDADC_VREF (у меня внешний), иначе не загрузится мк!
//ноги сигма дельта ацп
#define SDADC1_PIN1 GPIO_Pin_8
#define SDADC1_PIN2 GPIO_Pin_9
#define SDADC1_PORT GPIOE
#define SDADC_VREF SDADC_VREF_Ext
#define SDADC1_CHANNEL SDADC_Channel_8
//----------------------------------------------------------------------------
void InitSDADC(void)
{
// Enable SDADCx analog interface
PWR_SDADCAnalogCmd(PWR_SDADCAnalog_1, ENABLE);
// Set the SDADC divider: The SDADC should run @6MHz
// If Sysclk is 72MHz, SDADC divider should be 12
RCC_SDADCCLKConfig(RCC_SDADCCLK_SYSCLK_Div12);
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Pin = SDADC1_PIN1 | SDADC1_PIN2;
GPIO_Init(SDADC1_PORT, &GPIO_InitStructure);
SDADC_VREFSelect(SDADC_VREF);
// Insert delay equal to ~5 ms
__delay_mks(6000);
SettingSDADCx(SDADC1);
}
//------------------------------------------------------------------------------
void SettingSDADCx (SDADC_TypeDef* SDADCx)
{
SDADC_AINStructTypeDef SDADC_AINStructure;
// Enable
SDADC_Cmd(SDADCx, ENABLE);
// Enter initialization mode
SDADC_InitModeCmd(SDADCx, ENABLE);
// wait for INITRDY flag to be set
while((SDADC_GetFlagStatus(SDADCx, SDADC_FLAG_INITRDY) == RESET)); // && (--SDADCTimeout != 0));
// Analog Input configuration conf0: use single ended zero reference
SDADC_AINStructure.SDADC_InputMode = SDADC_InputMode_Diff; //SDADC_InputMode_SEZeroReference;
SDADC_AINStructure.SDADC_Gain = SDADC_Gain_1;
SDADC_AINStructure.SDADC_CommonMode = SDADC_CommonMode_VSSA;
SDADC_AINStructure.SDADC_Offset = 0;
SDADC_AINInit(SDADCx, SDADC_Conf_0, &SDADC_AINStructure);
// select SDADCx channel to use conf0
SDADC_ChannelConfig(SDADCx, SDADC1_CHANNEL, SDADC_Conf_0);
// select channel
//SDADC_InjectedChannelSelect(SDADCx, SDADC1_CHANNEL);
SDADC_ChannelSelect(SDADCx, SDADC1_CHANNEL);
// Enable continuous mode
//SDADC_InjectedContinuousModeCmd(SDADCx, ENABLE);
SDADC_ContinuousModeCmd(SDADCx, ENABLE);
SDADC_FastConversionCmd(SDADC1, ENABLE);
// Exit initialization mode
SDADC_InitModeCmd(SDADCx, DISABLE);
// configure calibration to be performed on conf0
SDADC_CalibrationSequenceConfig(SDADCx, SDADC_CalibrationSequence_1);
// start POT_SDADC Calibration
SDADC_StartCalibration(SDADCx);
// wait for POT_SDADC Calibration process to end
while((SDADC_GetFlagStatus(SDADCx, SDADC_FLAG_EOCAL) == RESET));// && (--SDADCTimeout != 0));
}