2015-12-02 05:05 AM
hi
i have configurd to get an interrupt nce the timer update . But it did not work, can anyone knows whats the problem.I am using stm32f429 discovery board... void timer_init() { /**** clock for the timer *****/ RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM2, ENABLE); // RCC->AHB2RSTR |= timer2_RCC_Enable; /*** timebase init and nested vector init *****/ TIM_TimeBaseInitTypeDef TIM_TimeBaseStruct; /**** timer has the delay of 45MHz *****/ TIM_TimeBaseStruct.TIM_ClockDivision = 0; TIM_TimeBaseStruct.TIM_CounterMode = TIM_CounterMode_Up ; TIM_TimeBaseStruct.TIM_Period = 1000000-1; // 1Mhz to 1hz which equals to 1s TIM_TimeBaseStruct.TIM_Prescaler = 45-1; //45 Mhz to 1 Mhz which equals to 1us TIM_TimeBaseStruct.TIM_RepetitionCounter = 0 ; TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStruct); /**** Enable the timer ****/ /* start timer */ TIM_Cmd(TIM2, ENABLE); /**** interrupt ****/ NVIC_InitTypeDef NVIC_IntStruct; NVIC_IntStruct.NVIC_IRQChannel = TIM2_IRQn; NVIC_IntStruct.NVIC_IRQChannelCmd = ENABLE; NVIC_IntStruct.NVIC_IRQChannelPreemptionPriority = 0; NVIC_IntStruct.NVIC_IRQChannelSubPriority = 1 ; NVIC_Init(&NVIC_IntStruct); /*** interrupt on nvic ******/ TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE); }2015-12-02 08:24 AM
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE); // Enable the clock, not hold the peripheral in reset?
2015-12-04 03:31 AM
ok clive, i just wanna know whats mean holding the pheripheralin reset?... does it mean, stop giving clocks to pheriperal?
2015-12-04 05:07 AM
clive,
could you give me what theRCC_APB1PeriphResetCmd do?
and what you mean bynot hold the peripheral in reset?
i am newbie and learn on my own.2015-12-04 05:23 AM
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE); // Start the engine
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM2, ENABLE); // Standing of the brakes RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM2, DISABLE); // Remove foot from brake Nothing is going to happen in the timer if you keep it in the reset state, and being synchronous logic, you need to have it's clock enabled.2015-12-04 05:31 AM