I have a problem with our microprocessor.
I had written several programs and I tested them on a STM32vlDiscovery (has stm32f100rbt6 microprocessor.) There were no errors and it worked correctly.
Now I programmed the same program on a new STM32F100RBT6 and unfortunately, the program does not work.
The program was completely downloaded on the STM32 and verified but does not work.
In the debug environment, I saw that all registers were zero, as the microprocessor stopped in the first line of the program.
#include <stm32f10x.h>
#include <math.h>
//------------------
volatile short sinArray[20];
volatile int i=0;
//1000 Hz Sine Wave
void TIM2_IRQHandler(void)
{
TIM2->SR &=~TIM_SR_UIF;
DAC->DHR8R1=sinArray[i];
i++;
if(i==20)i=0;
}
int main()
{
RCC->APB1ENR |=RCC_APB1ENR_DACEN;
DAC->CR |=DAC_CR_EN1;
RCC->APB1ENR |=RCC_APB1ENR_TIM2EN;
TIM2->CR1 |=TIM_CR1_ARPE;
TIM2->ARR=199;
TIM2->PSC=5;
TIM2->DIER |=TIM_DIER_UIE;
NVIC_EnableIRQ(TIM2_IRQn);
TIM2->CR1 |=TIM_CR1_CEN;
//TIM2->SR &=~TIM_SR_UIF;
for ( i=0; i<10; i++)
{
sinArray[i]=(128*sin(i*3.14/10)+127);
}
i=0;
while(1)
{
}
}