The pin of a button or an RPM sensor cannot be used
What ArduPilot says:
- BTN_PINN=N, set SERVON_FUNCTION=-1
- RPMN_PIN not set
- RPMN_PIN=N invalid
- RPM: Failed to attach to pin N
- RPMN_PIN=N, set SERVON_FUNCTION=-1
- BTN_PINN=N invalid
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
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_FUNCTIONto -1 (GPIO) and reboot: outputs become GPIO pins only at start-up.The RPM comes from the ESCs, not from a sensor on a pin, and
RPMn_TYPEis wrong.CheckTypes 1 and 2 are only for a hall or optical sensor wired to a pin.
FixSet
RPMn_TYPEto 5 (ESC telemetry), or to 0 if you do not use the RPM library at all.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_ENABLEto 0 (and the unused pins to -1).“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_PINto 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
| Parameter | What it is |
|---|---|
BTN_ENABLE | Enable button reporting |
BTN_PIN1 | First button Pin |
BTN_PIN2 | Second button Pin |
RPM1_TYPE | RPM type |
RPM1_PIN | Input pin number |
RPM2_TYPE | RPM type |
RPM2_PIN | Input pin number |
SERVO9_FUNCTION | Servo output function |
Where to do it:Board & Wiring Planner
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.