From bb6802a1ed8188d149e1de7fbce2e56246402ed6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Fri, 22 Dec 2017 08:03:25 +0100 Subject: [PATCH] kinetis: fix PPM decoding On kinetis, the TPM_STATUS_TOF was used to detect missed interrupts for PPM decoding. However this was not correct, because the TOF bit was set on each timer overflow. This happened regularly after every 64ms interval, which meant that most PPM frames were just discarded. I have not found any equivalent register/solution that is used on STMF4, so this just removes the TOF handling. However there is now no way to detect missed edges/interrupts! --- src/drivers/kinetis/drv_hrt.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/drivers/kinetis/drv_hrt.c b/src/drivers/kinetis/drv_hrt.c index 83954efacb..bc2bc437ca 100644 --- a/src/drivers/kinetis/drv_hrt.c +++ b/src/drivers/kinetis/drv_hrt.c @@ -346,11 +346,6 @@ static void hrt_ppm_decode(uint32_t status) uint16_t interval; unsigned i; - /* if we missed an edge, we have to give up */ - if (status & TPM_STATUS_TOF) { - goto error; - } - /* how long since the last edge? - this handles counter wrapping implicitly. */ width = count - ppm.last_edge; @@ -510,7 +505,7 @@ hrt_tim_isr(int irq, void *context, void *arg) #ifdef HRT_PPM_CHANNEL /* was this a PPM edge? */ - if (status & (STATUS_PPM | TPM_STATUS_TOF)) { + if (status & (STATUS_PPM)) { hrt_ppm_decode(status); }