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: Just a week to go before our next @DIYRobocars race at @circuitlaunch, complete with famous Brazilian BBQ. It's free, fun for k…
yesterday
DIY Robocars via Twitter
How to use the new @donkey_car graphical UI to edit driving data for better training https://www.youtube.com/watch?v=J5-zHNeNebQ
Nov 28
DIY Robocars via Twitter
RT @SmallpixelCar: Wrote a program to find the light positions at @circuitlaunch. Here is the hypothesis of the light locations updating ba…
Nov 26
DIY Robocars via Twitter
RT @SmallpixelCar: Broke my @HokuyoUsa Lidar today. Luckily the non-cone localization, based on @a1k0n LightSLAM idea, works. It will help…
Nov 25
DIY Robocars via Twitter
@gclue_akira CC @NVIDIAEmbedded
Nov 23
DIY Robocars via Twitter
RT @luxonis: OAK-D PoE Autonomous Vehicle (Courtesy of zonyl in our Discord: https://discord.gg/EPsZHkg9Nx) https://t.co/PNDewvJdrb
Nov 23
DIY Robocars via Twitter
RT @f1tenth: It is getting dark and rainy on the F1TENTH racetrack in the @LGSVLSimulator. Testing out the new flood lights for the racetra…
Nov 23
DIY Robocars via Twitter
RT @JoeSpeeds: Live Now! Alex of @IndyAChallenge winning @TU_Muenchen team talking about their racing strategy and open source @OpenRobotic…
Nov 20
DIY Robocars via Twitter
RT @DAVGtech: Live NOW! Alexander Wischnewski of Indy Autonomous Challenge winning TUM team talking racing @diyrobocars @Heavy02011 @Ottawa…
Nov 20
DIY Robocars via Twitter
Incredible training performance with Donkeycar https://www.youtube.com/watch?v=9yy7ASttw04
Nov 9
DIY Robocars via Twitter
RT @JoeSpeeds: Sat Nov 6 Virtual DonkeyCar (and other cars, too) Race. So bring any car? @diyrobocars @IndyAChallenge https://t.co/nZQTff5…
Oct 31
DIY Robocars via Twitter
RT @JoeSpeeds: @chr1sa awesomely scary to see in person as our $1M robot almost clipped the walls as it spun at 140mph. But it was also awe…
Oct 29
DIY Robocars via Twitter
RT @chr1sa: Hey, @a1k0n's amazing "localize by the ceiling lights" @diyrobocars made @hackaday! It's consistently been the fastest in our…
Oct 25
DIY Robocars via Twitter
RT @IMS: It’s only fitting that @BostonDynamics Spot is waving the green flag for today’s @IndyAChallenge! Watch LIVE 👉 https://t.co/NtKnO…
Oct 23
DIY Robocars via Twitter
RT @IndyAChallenge: Congratulations to @TU_Muenchen the winners of the historic @IndyAChallenge and $1M. The first autonomous racecar comp…
Oct 23
DIY Robocars via Twitter
RT @JoeSpeeds: 🏎@TU_Muenchen #ROS 2 @EclipseCyclone #DDS #Zenoh 137mph. Saturday 10am EDT @IndyAChallenge @Twitch http://indyautonomouschallenge.com/stream
Oct 23
More…