APM2 I/O Pin Mapping Schematic Question


  I am writing some custom code for my APM2.5 and am having trouble mapping the I/O pins that are brought out on the enclosure against the Mega 2560 pin outs. I have the APM2.5 schematic and have the Mega 2560 mapping.  Trying to get a Radio RX output signal (PWM) to Input 1 on the APM2.5  From the APM2.5 schematic, PWM Input 1 is "IN7".  "IN7" goes to "(PCINT7/OCoA/OC1C)Pb7".  The APM schematic says its pin 21 on the "ATMEGA32U2".  How do I get from the "ATMEGA32U2" to the AT2560? When I load code isnt it going to the AT2560?

  I also tried to use"A0" (pin 97) as my input on APM2.5 but still not seeing the value I expected on my serial monitor.  Below is the code that I am using...

int SteeringInputPin = 97; // Steering Servo Channel Input Pin
int SteeringValue= 50; // Steering Servo Channel Input Value

// Setup Routine
void setup()
pinMode(SteeringInputPin, INPUT); // declare the SteeringInputPin as an INPUT:
Serial.begin(9600); // initialize serial communication at 9600 bits per second:

void loop()
SteeringValue = pulseIn(SteeringInputPin, HIGH); // Read the pulse width of Steering Command


Anyone have a reliable mapping of the APM2.5 pinouts to the underlying Mega 2560 board?  Any help would be much appreciated.


You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –


  • Hi,

    The ATMega32U2 takes eight PWM signals and assemble a single PPM signal out of them; it comes out on Pin23. It goes on via SJ2 to PPM_IN and then via SJ104 to either  PL0 or PL1 on the Mega2560 (nobody ever changes SJ104, you can assume default).

    You should use the APM_RC and RC_Channel libraries (not pulseIn), they will (although slightly overcomplicated) read the PPM signal and decode it into the microsecond values that you probably want to have.

    If you have a receiver that can output a PPM signal directly, you can use SJ2 to feed that directly to Mega2560 and leave 32U2 unemployed. That eliminates a source of error.



This reply was deleted.


Shivchand Jaysaval liked Shivchand Jaysaval's profile
Aug 25