2012-06-26 03:33 AM
controller resets when I enable timer interrupt with the period about half second.
watchdog is ok.timer config:TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM6, ENABLE);TIM_TimeBaseStructInit(&TIM_TimeBaseStructure);TIM_TimeBaseStructure.TIM_Period = 10000;TIM_TimeBaseStructure.TIM_Prescaler = 16800-1;TIM_TimeBaseInit(TIM6, &TIM_TimeBaseStructure);TIM_ITConfig(TIM6, TIM_IT_Update, ENABLE);TIM_Cmd(TIM6, ENABLE);enabling interrupt:NVIC_EnableIRQ(TIM6_DAC_IRQn);
also I've tried to enable interrupt this way:NVIC_InitTypeDef NVIC_InitStructure;
NVIC_InitStructure.NVIC_IRQChannel = TIM6_DAC_IRQn;NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;NVIC_Init(&NVIC_InitStructure);interrupt handler:void TIM6_DAC_IRQnHandler() {
if (TIM_GetITStatus(TIM6, TIM_IT_Update) != RESET) {
TIM_ClearITPendingBit(TIM6, TIM_IT_Update);
IWDG_ReloadCounter();
}
}
what can I do?thanks in advance.2012-06-26 05:41 AM
what can I do?
Attach a debugger, and see what actually happens. Read out the RCC_CSR register, it should tell you what did reset the uC, if at all.
2012-06-26 06:02 AM
The interrupt handlers must match the names specified in the vector table so instead of
void TIM6_DAC_IRQnHandler() {
... usevoid TIM6_DAC_IRQHandler() {
... Confirm you are using the correct startup_stm32f1xx_xx_xx.s file for your specific part.