Timer1 in capture more (reads pulses that come in pa8)
Timer2 interrupt on overlow
Timer3 PWM outputs the singal to PB0
I'd been having strange issues trying to send a signal to a NeoPixel ring (leds in different colors, leds turned off, etc), so I guessed it could be related to the timers, and decided to get a read of the library I'm using for the neopixels, which is Adafruit_NeoPixel.h, and I was surprised that it does not use in any form any timer not any other interrupt either, it just uses the SysTick functionality of the STMF1 (the method .SHOW is the important part of the code)
After then (even when there was not any kind of timer code involved) I tried a couple of things such as
Code: Select all
NVIC_DisableIRQ(TIM1_IRQn); // Disable TIM1 interrupt
NVIC_DisableIRQ(TIM2_IRQn);
NVIC_DisableIRQ(TIM3_IRQn);
NEOPIXEL CODE HERE //<<<NOTE THIS CODE doesnt use any timer
NVIC_EnableIRQ(TIM1_IRQn); // Disable TIM1 interrupt
NVIC_EnableIRQ(TIM2_IRQn);
NVIC_EnableIIRQ(TIM3_IRQn);
Code: Select all
__disable_irq();
NEOPIXEL CODE HERE // //<<<NOTE THIS CODE doesnt use any timer
__enable_irq();
But, with
Code: Select all
TIM3->CR1 &= ~TIM_CR1_CEN;
TIM3->CCER &= ~(TIM_CCER_CC1E | TIM_CCER_CC2E | TIM_CCER_CC3E | TIM_CCER_CC4E);
NEOPIXEL CODE HERE // //<<<NOTE THIS CODE doesnt use any timer
TIM3->CCER |= (TIM_CCER_CC1E | TIM_CCER_CC2E | TIM_CCER_CC3E | TIM_CCER_CC4E);
TIM3->CR1 |= TIM_CR1_CEN; //
I'd like to know -for the sake of curiosity- in wich way a PWM signal can "interfere" with code in the main loop that uses the sysTick and needs to be very timing precise (neopixels require that)
regards
julian