← All tools

Message & Error Explainer

What an ArduPilot message means and what to do about it

Українська

The pin of a button or an RPM sensor cannot be used

Stops itRangefinder, optical flow, camera, OSD and other devices

What ArduPilot says:

A button input (BTN_ENABLE 1, pins BTN_PIN1 to BTN_PIN4) or an RPM sensor read from a pin (RPMn_TYPE 1 or 2) names a pin ArduPilot cannot read. “not set”: RPMn_PIN is still -1. “invalid”: this board has no GPIO (a general-purpose pin) with that number. “set SERVOn_FUNCTION=-1”: the pin is a servo/motor output that still works as an output. “RPM: Failed to attach to pin”: the pin exists, but its pulses cannot be counted.

What to do, most likely first

  1. The pin is one of the servo/motor outputs and has not been turned into a GPIO.

    CheckThe message names the output: “set SERVO9_FUNCTION=-1” is output 9.

    FixSet that SERVOn_FUNCTION to -1 (GPIO) and reboot: outputs become GPIO pins only at start-up.

  2. The RPM comes from the ESCs, not from a sensor on a pin, and RPMn_TYPE is wrong.

    CheckTypes 1 and 2 are only for a hall or optical sensor wired to a pin.

    FixSet RPMn_TYPE to 5 (ESC telemetry), or to 0 if you do not use the RPM library at all.

  3. The pin number belongs to another board, or the button input is not used at all.

    FixUse a GPIO number from your own board's documentation, or set BTN_ENABLE to 0 (and the unused pins to -1).

  4. “Failed to attach”: another pin with the same number on a different port already uses that interrupt line.

    FixMove the sensor to another GPIO and set RPMn_PIN to it.

The parameter list calls RPMn_TYPE 1 “Not Used”, but the code treats it exactly like 2 (GPIO), pin check included.

Parameters to look at

ParameterWhat it is
BTN_ENABLEEnable button reporting
BTN_PIN1First button Pin
BTN_PIN2Second button Pin
RPM1_TYPERPM type
RPM1_PINInput pin number
RPM2_TYPERPM type
RPM2_PINInput pin number
SERVO9_FUNCTIONServo output function
The code that sends it

BTN_PINN=N, set SERVON_FUNCTION=-1

libraries/AP_Button/AP_Button.cpp AP_Button::arming_checks() · Open in ArduPilot Copter-4.7.1

RPMN_PIN not set

libraries/AP_RPM/AP_RPM.cpp AP_RPM::arming_checks() · Open in ArduPilot Copter-4.7.1

RPMN_PIN=N invalid

libraries/AP_RPM/AP_RPM.cpp AP_RPM::arming_checks() · Open in ArduPilot Copter-4.7.1

RPM: Failed to attach to pin N

libraries/AP_RPM/RPM_Pin.cpp AP_RPM_Pin::update() · Open in ArduPilot Copter-4.7.1

And 2 more messages, sent from the same places.

Written here for Copter 4.6. In the tool you choose your vehicle and version, see your own parameter values beside the ones named here, and drop a flight log to have every message in it explained.

Open it in the Message & Error Explainer