APM won't control RC output

In the course of trying to troubleshoot a different problem, I've come across what seems like a clear misbehavior of my 328 mux -- regardless of what I do with IN7 (mode switch input, the row of pins on the far edge of the board), I can't get the APM's RC outputs (set using APM_RC.OutputCh) to reach the final output pins; it's as if the 328 mux will not switch out of manual override mode.

Here's my setup:
I have a lone APM (red) board without IMU shield.  I connect the three (ground, power, signal) IN0 pins to my RC receiver's channel 1 output.  I connect a PPM generator to the three IN7 pins on the far edge of the APM board.  I connect a 5V FTDI cable to the APM board and upload the following Arduino sketch (compiled using the latest APM_Libraries.zip downloaded a few hours ago):

#include <APM_RC.h> // ArduPilot Mega RC Library

void setup() {
  APM_RC.Init();   // APM Radio initialization
  Serial.begin(57600);
  Serial.println("ArduPilot Mega RC lock test");
  delay(1000);
}

void loop() {
  for(int i=0;i<8;i++)
    APM_RC.OutputCh(i,1500);
}

I then verify that the serial monitor prints "ArduPilot Mega RC lock test" upon APM bootup.

First measurement:
I connect my two oscilloscope channels to IN0 and OUT0.  The result is a correctly-shaped RC pulse on both channels which responds to movement on the transmitter's stick.  The two pulses are perfectly overlapped (or very close to it).  Regardless of what pulse length my PPM generator generates on IN7, this behavior remains the same.

Second measurement:
I connect one of my oscilloscope channels to OUT0 and the other one to IN7.  I confirm that my PPM generator on IN7 generates pulses of measured lengths {1167us, 1294us, 1425us, 1552us, 1683us, 1814us}, and that OUT0 still responds to the transmitter's stick for every pulse length on IN7.

I have two APM boards that I have tried these steps on and the result is the behavior.  One of the boards is unmodified from SparkFun and I updated the firmware of the 328 on the other using PPM_Encoder.zip downloaded a few hours ago (also verified that the signature matched an ATmega328P).

I would have expected to observe a 1500us pulse on OUT0 for all IN7 pulse lengths except one, but instead I never observe 1500us pulses on OUT0.  The output pulse lengths for channels that have valid input pulses match the input pulses exactly under all circumstances and the output pulses for channels without valid input pulses appear to have fairly random pulse lengths.

I would debug the issue further, but I have been unable to find the source code for the PPM_Encoder firmware for the 328.  Chris or others, could you post the source code for the PPM encoder along with the compiled hex file?  Is the behavior I'm observing the intended behavior?

Thanks,
Ben

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

Join diydrones

Email me when people reply –

Replies

  • Arg, this particular problem is not due to any aspect of the ArduPilot project -- however, I'm still having a problem with the mux. The original problem was being caused by my PicoScope oscilloscope -- when the PicoScope was plugged into my Belkin powered USB hub, it did something to affect the APM board, which was being powered by the FTDI cable which was also plugged into the Belkin hub. When the PicoScope program was loaded (which activated the scope), this problem and a different problem that I didn't post about occurred. When the program was unloaded, the problem stopped. I confirmed this with a number of trials. When I moved the PicoScope to a different USB port (not through the Belkin hub), this problem no longer occurs.

    I would still like to get the source code for the PPM encoder however, because now my above program successfully forces an output of 1500us regardless of mode switch setting. That is, now I have the opposite problem -- the 328 will not switch *into* manual mode. The amber mux LED will not extinguish regardless of the pulse length on IN7. And yes, this time I have tried closing the PicoScope program (the thing that caused the problem last time). When I load the standard APM_radio example, the outputs function correctly.

    Finally, where can I find the code mentioned here?:
    http://code.google.com/p/ardupilot-mega/wiki/ModeSwitch
  • I also have a OUT0 port that doesn't seem to work, and the soldering on it looks good.

    At first I thought it was just bad solder, but could this be a wider problem?
This reply was deleted.

Activity

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