i know, my fault, i copied the wrong part of my code. I tried to initialize all 4 timers. 1 - 3 worked fine, only 4th doesn't work. I took a look at the registers of TIM4 with the debugger when this line appears
Code:
TIM_TimeBaseInit(TIM4, &TIM_TimeBaseStructure);
and nothing happens there. it looks like TIM4 isn't there! whole code is now:
i try to use timer 4 (TIM4) in my project, but it doesn't work. Till now i tried all other timers (Timer1, Timer2&3) and they are working fine. I used the same initialization routines for Timer4 as for the others:
Code:
// TIM4 clock enable 24MHz RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4, ENABLE); // Time base configuration TIM_TimeBaseStructure.TIM_Period = TIM4_Freq_16kHz; TIM_TimeBaseStructure.TIM_Prescaler = 1; TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1; TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseInit(TIM4, &TIM_TimeBaseStructure); TIM_ITConfig(TIM4,TIM_IT_Update, ENABLE); // Enable TIM4 global Interrupt NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQChannel; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); // TIM enable counter TIM_Cmd(TIM4, ENABLE); Timer 4 should be available in this device (described in the datasheet). µC: STM32F103V8 IAR Embedded Workbench IDE JLINK for ARM processors Does anybody knows this issue or knows what happens with TIM4 in this device???
Today i did some other tests with my software. i took another (unflashed) board, and tried my software without enabling the ADC with DMA. the flashing and debugging with ''IAR workbench'' worked fine! i repeated that procedure several times without any problem. Than i tried to enable the ADC with DMA. The first programming (flashing) was done correctly and all works fine. but when i try to flash again the same software the described errors appear. What could be the problem??? my ADC init routine:
in principle its the same code like in the ''getting started'' example, only with the Example 8 files included. with my company project i started also with the ''gettingStarted''. Following peripherals are in use: ADC with DMA I2C for Display I2C for Flash TIM1 to 3 and some GPIO for keyboard etc. i recognized the first problems since i included the ADC with DMA! i don't know if this could be the problem