APM 2.8 - Read PPM signal using interruptions on PIN PL1/ICP5

Hey guys!

I am developing my own quadcopter, so I first started by buying an Arduino Uno + MPU9250 (IMU and mag) + GPS. I tested it and it went well. Since I my goal is to work with code and not hardware, I bought an APM 2.8 board so I would have everything already connected and working, and then focus only on programming it with Arduino IDE.

I’ve managed to communicate the AT2560 with all sensors without much problems.

I have a HITEC Minima 6S receiver which gives outputs as PWM signal. No problem there. As you know each PWM channel must be connected on the APM inputs, which are then routed to the AT32U2, which encodes the PWM signals in one PPM signal.

That PPM signal is routed to PIN PL1/ICP5 (Arduino PIN 48) as you can see on the APM schematics attached (don’t mind the blue rectangles there). I have already read this PPM signal using pulseIn() function on Arduino IDE. But as you may know pulseIn() takes up to 20ms to get all PPM channels (to long for a quadcopter). So the correct way of reading the signal should be with interrupts. But this is not an interrupt pin…

Finally my question. How does Arducopter read the PPM signal on that pin without losing 20ms? Is that PPM signal also routed to a different pin with interruptions? I have tried reading Arducopter code but I can’t seems to understand it very well.

I have also tried routing my receiver PWM signals to A0-A15 but I think those pins are not intented for that use. In fact, I was only able to read a PWM signal on pin A8.

Hope I was clear enough. Any help is welcome.

Regards,
Gonzalo

1 Like

Hello Gonzalo, did you try to take a look at ArduCopter’s libraries?
I found this link, I hope it helps: https://github.com/ArduPilot/ardupilot/blob/master/Tools/ArduPPM/Libraries/PPM_Encoder.h

I’m also using the Arduino IDE to program in APM 2.8, but I’m still trying to get the sensor readings.
I’m having difficulty reading the MPU6000, but I’ve already read the MS5611 and the HMC5883L.

Hope this helps, and I hope you can help me later
Thanks.
Filipe.

Hello Filipe,

Thanks for the link, I’ll check it out and see if I understand the code.

As for the MPU6000, what problems are you having?

If your problem is of connection, make sure you put Arduino pin 40 to HIGH before reading. That pin is the MS5611 chip select pin, so you have to disable it first before trying to read the MPU.

Then, for parametrization and sensor reading I took as reference this library for MPU6050 which is almost the same as MPU6000:
https://github.com/kriswiner/MPU6050

Let me know how it went.

Regards,
Gonzalo

Hello Gonzalo,

I made it work. Thank you for your help. There was a wrong registrer too. But it worked.

And have you had any success?

Filipe.

Hello Filipe,
I tried to open the link you provided but it is going to a 404 not found page for some reason.

It may very well be possible something changed in 4 years. APM2.x is not supported anymore, so the Ardupilot team most likely removed the no longer needed files. A quick search for “ArduPPM” or “PPM_Encoder.h” brought up this:

1 Like