2021-03-07 10:56 PM
in my testing while I am down the power or power on of a any channel MCU is going to reset .
I have attached a schematic of my board.
If is there may issue of softwere code please suggest me
the clock setup is
void clock_setup(void)
{
CLK_DeInit();
CLK_HSECmd(DISABLE);
CLK_LSICmd(DISABLE);
CLK_HSICmd(ENABLE);
while(CLK_GetFlagStatus(CLK_FLAG_HSIRDY) == FALSE);
CLK_ClockSwitchCmd(ENABLE);
CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV2);
CLK_SYSCLKConfig(CLK_PRESCALER_CPUDIV4);
CLK_ClockSwitchConfig(CLK_SWITCHMODE_AUTO, CLK_SOURCE_HSI,
DISABLE, CLK_CURRENTCLOCKSTATE_ENABLE);
//CLK_PeripheralClockConfig(CLK_PERIPHERAL_SPI, DISABLE);
//CLK_PeripheralClockConfig(CLK_PERIPHERAL_I2C, DISABLE);
CLK_PeripheralClockConfig(CLK_PERIPHERAL_ADC, ENABLE);
//CLK_PeripheralClockConfig(CLK_PERIPHERAL_AWU, DISABLE);
//CLK_PeripheralClockConfig(CLK_PERIPHERAL_UART1, DISABLE);
//CLK_PeripheralClockConfig(CLK_PERIPHERAL_TIMER1, DISABLE);
//CLK_PeripheralClockConfig(CLK_PERIPHERAL_TIMER2, DISABLE);
//CLK_PeripheralClockConfig(CLK_PERIPHERAL_TIMER4, DISABLE);
}
void GPIO_setup(void)
{
GPIO_DeInit(GPIOB);
GPIO_DeInit(GPIOC);
//GPIO_DeInit(GPIOA);
GPIO_Init(GPIOB, GPIO_PIN_4, GPIO_MODE_OUT_PP_LOW_FAST);
GPIO_Init(GPIOB, GPIO_PIN_5, GPIO_MODE_OUT_PP_LOW_FAST);
GPIO_Init(GPIOC, GPIO_PIN_3, GPIO_MODE_OUT_PP_LOW_FAST);
GPIO_Init(GPIOC, GPIO_PIN_5, GPIO_MODE_OUT_PP_LOW_FAST);
GPIO_Init(GPIOC, GPIO_PIN_6, GPIO_MODE_OUT_PP_LOW_FAST);
GPIO_Init(GPIOC, GPIO_PIN_7, GPIO_MODE_OUT_PP_LOW_FAST);
//GPIO_Init(GPIOA, GPIO_PIN_3, GPIO_MODE_OUT_PP_LOW_FAST);
}
and ADC setup
void ADC1_setup(ADC1_Channel_TypeDef channel)
{
ADC1_DeInit();
ADC1_Init(ADC1_CONVERSIONMODE_CONTINUOUS,
channel,
ADC1_PRESSEL_FCPU_D18,
ADC1_EXTTRIG_GPIO,
DISABLE,
ADC1_ALIGN_RIGHT,
ADC1_SCHMITTTRIG_CHANNEL0,
DISABLE);
ADC1_Cmd(ENABLE);
}
thanks
Rajat