STM32F103在进入ADC_Cmd里死机问题请教
- UID
- 863306
|
STM32F103在进入ADC_Cmd里死机问题请教
大家好:
我在调试32的ADC时,进入ADC_Cmd就死机,JTAG断线,找不到CPU,重启板子电源也不行,必须要用ISP模式启动,JTAG才找得到CPU,探险FLASH后,再从正常模式下启动才能找得到CPU。软件是V2.0.3版本,请教,谢谢,
72Mhz系统频率,PA口和ADC1的时钟以开。
...
RCC_HCLKConfig (RCC_SYSCLK_Div1); /* HCLK = SYSCLK */
RCC_PCLK2Config (RCC_HCLK_Div1); /* PCLK2 = HCLK */
RCC_PCLK1Config (RCC_HCLK_Div2); /* PCLK1 = HCLK/2 */
RCC_ADCCLKConfig (RCC_PCLK2_Div6); /* ADCCLK = PCLK2/6 */
/* PLLCLK = 8MHz * 9 = 72 MHz */
RCC_PLLConfig (RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);//9
RCC_PLLCmd (ENABLE); /* Enable PLL */
...
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |
RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD |
RCC_APB2Periph_GPIOE | RCC_APB2Periph_GPIOF |
RCC_APB2Periph_USART1 | RCC_APB2Periph_GPIOG | RCC_APB2Periph_AFIO |
RCC_APB2Periph_ADC1 | RCC_APB2Periph_ADC2 | RCC_APB2Periph_SPI1,ENABLE); //RCC_APB2Periph_GPIO_CS|
/* Enable PWR and BKP clock */
ADC初使化程序如下:
void AdcApp_Init(void)
{
ADC_InitTypeDef ADC_InitStructure;
GPIO_Init(ADC_PORT, (GPIO_InitTypeDef*)(&AdcPort));
ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;
ADC_InitStructure.ADC_ScanConvMode = ENABLE;//DISABLE; //
ADC_InitStructure.ADC_ContinuousConvMode = ENABLE; //DISABLE
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;//ADC_ExternalTrigConv_Ext_IT11
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
ADC_InitStructure.ADC_NbrOfChannel = 1;
ADC_DeInit(ADC1);
ADC_Init(ADC1, &ADC_InitStructure);
ADC_ITConfig(ADC1,ADC_IT_EOC|ADC_IT_AWD|ADC_IT_JEOC,DISABLE);
ADC_RegularChannelConfig(ADC1,ADC_Channel_1,1,ADC_SampleTime_55Cycles5); // ADC_SampleTime_28Cycles5
ADC_Cmd(ADC1, ENABLE);
ADC_SoftwareStartConvCmd(ADC1, ENABLE);
} |
|
|
|
|
|
|