BrushlessPower / SBUS2-Telemetry

Arduino Library for SBUS and SBUS2 with Futaba Telemetry

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

700µs Delay between SBUS Frame and USART RX Interrupt

BrushlessPower opened this issue · comments

The USART RX Interrupt is processed 700µs after the SBUS Frame

This could be a Problem with the ESP32 FIFO and Interrupt source:

Interrupt is activated by Fifo full event (120Bytes) or RX Timeout

Here some facts and a possible fix

https://www.esp32.com/viewtopic.php?t=3751

uart_intr.rxfifo_full_thresh = 1; //UART_FULL_THRESH_DEFAULT, //120 default!! aghh! need receive 120 chars before we see them
uart_intr.rx_timeout_thresh = 10; //UART_TOUT_THRESH_DEFAULT, //10 works well for my short messages I need send/receive

uart_intr_config_t uart_intr;
uart_intr.intr_enable_mask = UART_RXFIFO_FULL_INT_ENA_M | UART_RXFIFO_TOUT_INT_ENA_M;
uart_intr.rxfifo_full_thresh = 25;
uart_intr.rx_timeout_thresh = 10;
uart_intr.txfifo_empty_intr_thresh = 10;
uart_intr_config(UART_NUM_1, &uart_intr);

This was the Solution.

rxfifo_full_thresh was set to 120Byte. But SBUS frame is just 25 Byte. So the interruopt was not called by incoming bytes, but by the Timeout.

i set the rxfull to 25 Bytes...now the USART Interrupt handler is called right after the SBUS Frame