read PPM signal

06 Aug 2010

Dear All,

I want to read PPM signal from RC receiver (Futaba R617FS). The signal is as shown in the picture below:

RC PPM Signal

I want to store each 5 channels into 5 variables.

I already try using the code from this link: http://mbed.org/forum/mbed/topic/466/?page=1#comment-2558. I try to read the width from the falling edge to raising edge. So I made a little change in here:

    void rise() {
        _pulsewidth = _t.read();
        _t.reset();
    }
    
    void fall() {
        _period = _t.read();
    }
But it is not work properly. Is there anyone has experience to do the same thing?

I would like to appreciate for you help, Thank you

Raharja

06 Aug 2010

I make a correction for the picture: 1.6mS should be 16mS.

09 Aug 2010

Thanks a lot Mr Christian,

10 Aug 2010

this code works properly when the loop is only do this task. But when I add another task, in this case is, to read the IMU sensor data via Serial port (p28, p27) using 'attach' interrupt function. The data sampling of IMU is <100Hz @115200bps. The PPM reading become improper, so many missing data. So a certain buffer[i] cannot be assign as a channel value of the RC. When I add a timer interrupt for calling a process function, the PPm reading data become terrible thing.

Is there anyone has the same problem, or anyone who knows to do this task in a better way?

Thank you,

/rhj

11 Aug 2010

I try to read the PPM signal only using rising interrupt to reduce ISR number. Right now I only use two ISR, which are from IMU sensor and RC PPM signal, but still so many errors in PPM signal reading. What should I do?

FYI, I use 4 ISRs on AVR micro controller to handle the same task as my prototyping project using mbed right now. It works properly, it can read the PPM signal correctly. I migrate to mbed because I want to have higher speed and larger memory.

 

/rhj

11 Aug 2010

Is it possible to publish the program that is causing you difficulty, and also explain how the hardware is wired up?

12 Aug 2010

the code are here: http://mbed.org/users/agiembed/programs/Controller/5zsla

and this is the wiring:

12 Aug 2010 . Edited: 12 Aug 2010

I note that this is probably the same system you are discussing in thread http://mbed.org/forum/mbed/topic/983/ ?

Looking at your code (but not being able to run it, due to not having the hardware), I suspect that your interrupt service routines are fighting. The PPM counter is obviously the time critical one, so I woud leave that interrupt, but do everything else in the background. The serial ports on the mbed have individual TX and RX 16 byte fifos, and the serial objects have readable() and writeable() methods to see if there is anything in those fifos (readable() tells you there is received data in the RX fifo, writeable() tells you there is space in the TX fifo), so you could update the serial ports when not servicing the PPM counter.

13 Aug 2010

Yup, finally to guarantee the PPM reading always correct I only use one interrupt (raising edge interrupt). Other process, including reading IMU data, updating i2Cs and communication to PC trough RF Modem done in the while(1) loop. But it is not practical to make exact frequency for some tasks that the frequency need to be defined such as control loop.

But I'm still wondering why my AVR atmega128 can do it better?

13 Aug 2010

That's a good question.. Maybe someone on the mbed team can shed some light..