Timers missing in ppm_arch.c

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Timers missing in ppm_arch.c

Chris Efstathiou
Hi.

I finished writing the board file for the matek f405 wing but it looks
like the is some timer configuration missing in
paparazzi/sw/airborne/arch/stm32/subsystems/radio_control/ppm_arch.c

Timers 8, 9 and 12 need to be added.

(I don't remember if tim8 is already included)

Chris

HERE IS THE CODE I USE FOR NOW.....

#elif USE_PPM_TIM8 && defined(STM32F4)

#if defined(STM32F1)
void tim8_up_isr(void) {
#elif defined(STM32F4)
void tim8_up_tim13_isr(void) {
#endif
   if ((TIM8_SR & TIM_SR_UIF) != 0) {
     timer_rollover_cnt += (1 << 16);
     timer_clear_flag(TIM8, TIM_SR_UIF);
   }
}

void tim8_cc_isr(void) {
   if ((TIM8_SR & PPM_CC_IF) != 0) {
     timer_clear_flag(TIM8, PPM_CC_IF);

     uint32_t now = timer_get_counter(TIM8) + timer_rollover_cnt;
     ppm_decode_frame(now);
   }
}

#elif USE_PPM_TIM9 && defined(STM32F4)

void tim1_brk_tim9_isr(void)
{
   if ((TIM9_SR & PPM_CC_IF) != 0) {
     timer_clear_flag(TIM9, PPM_CC_IF);

     uint32_t now = timer_get_counter(TIM9) + timer_rollover_cnt;
     ppm_decode_frame(now);

   } else if ((TIM9_SR & TIM_SR_UIF) != 0) {
             timer_rollover_cnt += (1 << 16);
             timer_clear_flag(TIM9, TIM_SR_UIF);
          }
}

#elif USE_PPM_TIM12 && defined(STM32F4)

void tim8_brk_tim12_isr(void)
{
   if ((TIM12_SR & PPM_CC_IF) != 0) {
     timer_clear_flag(TIM12, PPM_CC_IF);

     uint32_t now = timer_get_counter(TIM12) + timer_rollover_cnt;
     ppm_decode_frame(now);

   } else if ((TIM12_SR & TIM_SR_UIF) != 0) {
             timer_rollover_cnt += (1 << 16);
             timer_clear_flag(TIM12, TIM_SR_UIF);
          }
}


_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel
Reply | Threaded
Open this post in threaded view
|

Re: Timers missing in ppm_arch.c

Gautier Hattenberger-3
Hi,

I made a pull request from your code, if you can test it:

https://github.com/paparazzi/paparazzi/pull/2584

Gautier

Le 18/09/2020 à 12:47, Chris a écrit :

> Hi.
>
> I finished writing the board file for the matek f405 wing but it looks
> like the is some timer configuration missing in
> paparazzi/sw/airborne/arch/stm32/subsystems/radio_control/ppm_arch.c
>
> Timers 8, 9 and 12 need to be added.
>
> (I don't remember if tim8 is already included)
>
> Chris
>
> HERE IS THE CODE I USE FOR NOW.....
>
> #elif USE_PPM_TIM8 && defined(STM32F4)
>
> #if defined(STM32F1)
> void tim8_up_isr(void) {
> #elif defined(STM32F4)
> void tim8_up_tim13_isr(void) {
> #endif
>   if ((TIM8_SR & TIM_SR_UIF) != 0) {
>     timer_rollover_cnt += (1 << 16);
>     timer_clear_flag(TIM8, TIM_SR_UIF);
>   }
> }
>
> void tim8_cc_isr(void) {
>   if ((TIM8_SR & PPM_CC_IF) != 0) {
>     timer_clear_flag(TIM8, PPM_CC_IF);
>
>     uint32_t now = timer_get_counter(TIM8) + timer_rollover_cnt;
>     ppm_decode_frame(now);
>   }
> }
>
> #elif USE_PPM_TIM9 && defined(STM32F4)
>
> void tim1_brk_tim9_isr(void)
> {
>   if ((TIM9_SR & PPM_CC_IF) != 0) {
>     timer_clear_flag(TIM9, PPM_CC_IF);
>
>     uint32_t now = timer_get_counter(TIM9) + timer_rollover_cnt;
>     ppm_decode_frame(now);
>
>   } else if ((TIM9_SR & TIM_SR_UIF) != 0) {
>             timer_rollover_cnt += (1 << 16);
>             timer_clear_flag(TIM9, TIM_SR_UIF);
>          }
> }
>
> #elif USE_PPM_TIM12 && defined(STM32F4)
>
> void tim8_brk_tim12_isr(void)
> {
>   if ((TIM12_SR & PPM_CC_IF) != 0) {
>     timer_clear_flag(TIM12, PPM_CC_IF);
>
>     uint32_t now = timer_get_counter(TIM12) + timer_rollover_cnt;
>     ppm_decode_frame(now);
>
>   } else if ((TIM12_SR & TIM_SR_UIF) != 0) {
>             timer_rollover_cnt += (1 << 16);
>             timer_clear_flag(TIM12, TIM_SR_UIF);
>          }
> }
>
>
> _______________________________________________
> Paparazzi-devel mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/paparazzi-devel

_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel