Question
STM32F103 Sweep frequency
Posted on August 05, 2016 at 07:50
If some body can helpme the prevent this and obtain a clean signal i will apretiate it.
Thanks
Hi im newbie with this mcu, and im try to doing a sweep of frequency with TIM3 and the chanel1, A6. my main code its the next
while (1)
{
unsigned int i=0, j=0, h=0;
for(i = FrequencyStart; i < (FrequencyStart+FrequencySweep); i++){
Frequency = i;
TIM_TimeBaseStructure.TIM_Period = Frequency;
TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure);
TIM_OCInitStructure.TIM_Pulse = (Frequency/2);
TIM_OC1Init(TIM3, &TIM_OCInitStructure);
for(j = 0; j <
0x2AFF
; j++){;}
}
for(h = (FrequencyStart+FrequencySweep); h > FrequencyStart; h--){
Frequency = h;
TIM_TimeBaseStructure.TIM_Period = Frequency;
TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure);
TIM_OCInitStructure.TIM_Pulse = (Frequency/2);
TIM_OC1Init(TIM3, &TIM_OCInitStructure);
for(j = 0; j < 0x2AFF; j++){;}
}
}
This make me the sweep frequency fine but the signal have a little errors around each 1370us look the photo
If some body can helpme the prevent this and obtain a clean signal i will apretiate it.
Thanks