What is the purpose of the PPM encoder in APM2? Why didn't we use directly the PWM signal produced by the receiver and enter it to the microcontroller ATMEGA2560?

Working with the PPM signal is better than the PWM? if so why didn't we take the signal directly from the frequency demodulator in the receiver which it is a PPM signal and let ATMEGA2560 work as PPM decoder so the response will be faster?

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

Join diydrones

Email me when people reply –

Replies

  • What is the max channels that APM2 can read from PPM?

  • Thanks John!

    This is the answer is was looking for.

    Best regards,

    Gonzalo

  • Developer

    Hi,

    ICP5 is Input Capture Pin 5. Meaning it has an input capture interrupt that is tied to hardware Timer 5. So every time you have a signal change on the ICP5 pin (rising or falling edge depending on setup), you get a interrupt call that already contains the exact timer 5 value for when the pin change happened. This makes for a very efficient and accurate way of reading PPM/PWM signals, and is exactly what the ICP inputs where designed to do.

    Se page 140 (17.6 Input Capture Unit) in the ATmega 2560 manual for details.

    http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-2549-8-bit-AV...

    http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-2549-8-bit-AVR-Microcontroller-ATmega640-1280…
  • 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

  • Atmega328 is the PPM encoder/failsafe module, right? it is overheating on my APM1.4. When i try to calibrate radios on the APM mission planner, i get blank bars and no response for the RC channels. The situation is same for the test performed in terminal for pwm, radio. They are also giving 0 value for all channels. Now is there a way i can bypass this module, if it is not too critical, and get my APM to work with the RC receiver?

  • Actually it is possible to use a PPM signal  - see the wiki

    The PPM encoder exists mostly for safety reasons. Fail-safe and switching manual control etc.

  • OK, so here is the problem. You are using an8 bit micro controller that can ONLY do one thing at a time. So in order to measure input channels, that takes time for each channel to measure the pulse width, then you store that value, move on to capturing the sensor data which takes time, and then perform the calculations and filter equations, then use hardware timers to output PWM signals out each of the required ports to the motors and servos. If you have done any tone or PWM generation coding in microcontroller, you would already know the problem, the main loop with big time and cycle intensive tasks is going to cause huge pauses (no pwm signal on the outputs) in the main program loop. In order to spped and streamline the process, The PPM encoder does the hard work of capturing all those RC inputs, measures the values and probably does some smoothing/filtering as well), perform failsafe functions, and give I nice easy and quick to read digital input into the main processor so that in the main program loop we can achieve a 200 hz speed in the loop, which is quick enough we don't get too many pauses or delays in the pwm outputs.

    Again, follow some Arduino PWM tutorial and see that very quickly, you can run into issues trying to PWM mutiple signals out.

    So sum up your question, using one processor actually makes it slower!!!

    Here is a similiar problem on a PIC, but the principals are exactly the same from a code perspective. His main loop has a pause which results in a loud click or glitch in the pwm output, thus the same thing would be sent to the speed controls wreaking havoc!

    http://www.microcodes.info/picaxe-18m2-clicking-noise-with-sound-85...

     

This reply was deleted.

Activity

DIY Robocars via Twitter
RT @chr1sa: The @DIYRobocars @donkey_car virtual AI car race is starting in 15 minutes! Watch it live on Twitch https://www.twitch.tv/mossmann3333 htt…
yesterday
DIY Robocars via Twitter
RT @chr1sa: Don't miss our monthly @DIYRobocars @donkey_car virtual AI car race tomorrow at 10:00am PT live on Twitch. Head-to-head racing…
Friday
DIY Robocars via Twitter
RT @sparkfun: Our completed tutorial on building an @NVIDIA Jetson Nano-powered @Sphero RVR gets your bot up and running via teleoperation…
Thursday
DIY Robocars via Twitter
RT @SmallpixelCar: Freeway test https://t.co/4V5tV9lhIP
Thursday
DIY Robocars via Twitter
Very small autonomous cars racing, thanks to an overhead camera: https://control.ee.ethz.ch/research/team-projects/autonomous-rc-car-racing.html
Wednesday
DIY Robocars via Twitter
Wednesday
DIY Robocars via Twitter
Wednesday
DIY Robocars via Twitter
RT @chr1sa: Don't miss our virtual AI car race this Saturday! Real developers + virtual cars =🏎️🏎️🏎️ Head-to-head battles with thrills, sp…
Tuesday
DIY Robocars via Twitter
Jul 27
DIY Robocars via Twitter
RT @usashirou1: Jetson nano by Isaac Kaya #jetson https://t.co/Mu1N0CyQkN
Jul 23
DIY Robocars via Twitter
RT @GPUsolution: JetRacer mady by Iflytek company #JetsonNANO #Nvidia https://t.co/MimTymIwge
Jul 23
DIY Robocars via Twitter
RT @openmvcam: I love this: Mega or Mini? Image Classification on the 1MB OpenMV Cam H7 by Ish Ot Jr. in OpenMV, Edge Impulse, Internet of…
Jul 23
DIY Robocars via Twitter
RT @RoboticMasters: This is looking pretty good... but still needs a bit more refinement. Pure OpenCV Turning Sign Detection. No Tensorfl…
Jul 23
DIY Robocars via Twitter
Jul 23
DIY Robocars via Twitter
Jul 20
DIY Drones via Twitter
RT @davsca1: Here is the video of the performance. This paper was a huge group effort and more than one year of work, where we combined and…
Jul 16
More…