How to send data with PulsePosition library?

I'm trying to send high speed PPM signals from a Teensy 4.0 and I'm looking at the PulsePosition library for doing this. How does this library work? I managed to get it to output a repeating signal, but for actually modulating and outputting binary data (from an array or something) I'm lost. Am I modulating data via the difference in time between pulses on each channel? Also if I'm communicating between two Teensy boards, how do I mitigate clock drift between the microcontrollers? (which in RF land would be solved with some kind of feedback loop).
 
Have you looked at the PJRC web page:

Have you looked at the example sketches like ShiftRegisterOutput? or Loopback?
From Loopback?
Code:
void setup() {
  myOut.begin(9);  // connect pins 9 and 10 together...
  myIn.begin(10);
  myOut.write(1, 600.03);
  myOut.write(2, 1500);
  myOut.write(3, 759.24);
  // slots 4 and 5 will default to 1500 us
  myOut.write(6, 1234.56);
}
So the write calls set the pulse widths in microseconds.
This one is setup with 6 channels, by default I believe you can go to

If I remember correctly, synchronization is done by looking for a "space" and then knows the next thing should be
channel 1, 2...

 
Have you looked at the PJRC web page:

Have you looked at the example sketches like ShiftRegisterOutput? or Loopback?
From Loopback?
Code:
void setup() {
  myOut.begin(9);  // connect pins 9 and 10 together...
  myIn.begin(10);
  myOut.write(1, 600.03);
  myOut.write(2, 1500);
  myOut.write(3, 759.24);
  // slots 4 and 5 will default to 1500 us
  myOut.write(6, 1234.56);
}
So the write calls set the pulse widths in microseconds.
This one is setup with 6 channels, by default I believe you can go to

If I remember correctly, synchronization is done by looking for a "space" and then knows the next thing should be
channel 1, 2...

Do all channels get transmitted even if I'm not using them? And how long between calling write and the thing actually outputting? Also if I'm trying to transmit binary data, what kind of timings do I use? Like for 0 vs 1 do I do times t vs 2t?
 
Maybe just a bit of explanation might help? Of course you can find much info online about PPM. But the general idea of a group of signals are transmitted by sending tiny pulses, where the values of the signals are the time between each pulse. After the last pulse, a long time elapses before the sequence repeats, which the receiver uses to know when to treat the next pulse as the beginning of a new incoming group of signals.

With that in mind, here's some attempt to quickly answer some of your questions (the ones I can understand)

And how long between calling write and the thing actually outputting?

It depends on the timing of when you write relative to the PPM signal. If the 4th pulse just transmitted and you write to 3rd value, the new value you wrote will wait until the next frame. Again, that's fundamentally how PPM works. A set of values are repeated transmitted as tiny pulses, where the time between those pulses reflects their values.

Am I modulating data via the difference in time between pulses on each channel?

Yes, that's how PPM works. The library takes care of doing all the work. You could write the values you want it to transmit and it churns away in the background causing the pulses at the correct moments.

Also if I'm communicating between two Teensy boards, how do I mitigate clock drift between the microcontrollers?

PPM is about time between pulses. The transmitter uses its clock to send the pulses. The receiver measures the time with its clock. If the 2 clocks are mismatched, you'll get a slight error. It end up working pretty like an analog signal.


Several of your questions are confusing. Twice you talked about "binary data". PPM signals are fundamentally about the elapsed time between pulses. They don't actually transmit binary data.

I also don't really understand the very first words you wrote "I'm trying to send high speed PPM signals". PPM is a relatively slow protocol, and it has a pretty much fixed speed.

Maybe PPM isn't really what you want? Difficult to give advice since I really can't get a read on what you're really trying to accomplish here. If PPM isn't the way, these specific answers probably don't really help, but that's the best I can do without understanding your application.
 
Do all channels get transmitted even if I'm not using them? And how long between calling write and the thing actually outputting? Also if I'm trying to transmit binary data, what kind of timings do I use? Like for 0 vs 1 do I do times t vs 2t?
As Paul said, yes all of the channels you define by doing writes to them will output. Actually more precise all channels up till the highest channel number you have used, up to 16 will output.

Not really sure what you are wanting, or trying to do... But:
The output happens every 20ms or 50 times per second. Each channel will typically be probably in the width of 750 to 2250us centered at 1500
probably allows higher range like 500-2500.

Here shows output from the loop back. using Logic analyzer...
1729620849851.png

Where it shows one full set of pulses and the start of the next, where I measured between each of the highs. Been a long time since I used
PPM.

Sorry not sure what you really are trying to do. As I this protocol is pretty specific to output and receive data like PPM RC transmitters and receivers. Not very good for high speed data. There are lots of other things for transmitting data between two teensy boards, like UARTS, SPI, USB, ...

Edit: I see Paul just posted second message which covers most if not all of the same...
 
Sorry for the confusion, thanks for bearing with me. What I'm trying to do is implement one of the IrDA communication protocols which transmits PPM frames of 500ns, where the pulse is in one of the four 125ns windows. The description for the PulsePosition library says that it allows 20ns accuracy, so I thought it would be possible to implement this protocol with it. It seems like the usecase of this library is very different though because the sequences of pulses are repetitive.
 
Ah, now your questions make a lot more sense! I really don't know anything about the fast IrDA modes.

I added these words to the PulsePosition web page "PulsePosition is unrelated to IrDA FIR 4Mbit/sec communication. It only usesthe relatively slow PPM signals commonly used for radio controlled servo motors."
 
I have no idea if this is relevant, but if you look at the IMXRT reference manual under UARTS...
1729637647842.png
 
Yeah the FIR 4Mbps is rare because this protocol is usually only used for remotes. Not surprised it's not supported. You can't even buy transceivers for FIR anymore because they're all obsolete (which is how I ended up here lol).
 
Back
Top