APM2.5 Input/Output Pin Mapping

All,

  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 into Mega 2560) 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 

Serial.println(SteeringValue);
delay(50);
}

Anyone have a reliable mapping of the APM2.5 pinouts to the underlying Mega 2560 board?  

I am using the FlySky 79P-R8B-Receiver.

http://www.hobbypartz.com/79p-r8b-receiver.html

Any help would be much appreciated.

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

Join diydrones

Email me when people reply –

Replies

  • Update: Learned that the ATMEGA32U2 may be a special PPM encoder Chip.  I will use A0 to A3 (pin 97 to94) as my inputs from my Radio RX outputs instead.  Still not seeing what I would expect for PulseIn command.  All power is applied correctly.  Here is what I think the Analog input/output pins to 2560 mapping is:

    A0 = 97

    A1 = 96

    A2 = 95

    A3 = 94

    Is that correct?

This reply was deleted.

Activity

Neville Rodrigues liked Neville Rodrigues's profile
Jun 30
Santiago Perez liked Santiago Perez's profile
Jun 21
More…