Skip to content

Commit

Permalink
kinetis: fix PPM decoding
Browse files Browse the repository at this point in the history
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!
  • Loading branch information
bkueng committed Mar 12, 2018
1 parent 5a78856 commit bb6802a
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/drivers/kinetis/drv_hrt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit bb6802a

Please sign in to comment.