Browse Source

AP_HAL_AVR: pull-up UART RX lines to fix GPS spoofing (Tridge)

Tridge discovered this bugfix:
https://groups.google.com/d/topic/drones-discuss/aek6LJeYQo8/discussion
mission-4.1.18
Pat Hickey 12 years ago
parent
commit
0660873fa7
  1. 13
      libraries/AP_HAL_AVR/HAL_AVR_APM1_Class.cpp
  2. 13
      libraries/AP_HAL_AVR/HAL_AVR_APM2_Class.cpp

13
libraries/AP_HAL_AVR/HAL_AVR_APM1_Class.cpp

@ -69,6 +69,19 @@ void HAL_AVR_APM1::init(int argc, char * const argv[]) const { @@ -69,6 +69,19 @@ void HAL_AVR_APM1::init(int argc, char * const argv[]) const {
i2c->begin();
i2c->setTimeout(100);
analogin->init(NULL);
/* Enable the pullups on the RX pins of the 3 UARTs This is important when
* the RX line is high-Z: capacitive coupling between input and output pins
* can cause bytes written to show up as an input. Occasionally this causes
* us to detect a phantom GPS by seeing our own outgoing config message.
* PE0 : RX0 (uartA)
* PD2 : RX1 (uartB)
* PJ0 : RX3 (uartC)
*/
PORTE |= _BV(0);
PORTD |= _BV(2);
PORTJ |= _BV(0);
};
const HAL_AVR_APM1 AP_HAL_AVR_APM1;

13
libraries/AP_HAL_AVR/HAL_AVR_APM2_Class.cpp

@ -68,6 +68,19 @@ void HAL_AVR_APM2::init(int argc, char * const argv[]) const { @@ -68,6 +68,19 @@ void HAL_AVR_APM2::init(int argc, char * const argv[]) const {
i2c->begin();
i2c->setTimeout(100);
analogin->init(NULL);
/* Enable the pullups on the RX pins of the 3 UARTs This is important when
* the RX line is high-Z: capacitive coupling between input and output pins
* can cause bytes written to show up as an input. Occasionally this causes
* us to detect a phantom GPS by seeing our own outgoing config message.
* PE0 : RX0 (uartA)
* PD2 : RX1 (uartB)
* PH0 : RX2 (uartC)
*/
PORTE |= _BV(0);
PORTD |= _BV(2);
PORTH |= _BV(0);
};
const HAL_AVR_APM2 AP_HAL_AVR_APM2;

Loading…
Cancel
Save