-
Notifications
You must be signed in to change notification settings - Fork 32
gz_ppm waveform
This core was created as a result of a request under issue #14. It is a decoder for a Combined Pulse Position Modulation (CPPM) signal. The core does two things; it demultiplexes the incoming CPPM signal into up to 8 servo compatible outputs. It also digitises each pulse width and raises an interrupt at the end of the pulse. An attached microcontroller can respond by reading a sixteen bit value from the SPI port. The top bit is the instantaneous value of the incoming CPPM stream at the moment the SPI was read. The next three bits encode the channel number and the remaining twelve bits encode the actual value representing the pulse width.
If fewer channels are received, then the core will modulate only the available channels. Likewise, interrupts are only asserted for those channels actually in the stream.
A special case exists in the case of the FrSky D4R receiver. Here the frame length is 18ms. When all eight channels are at maximum, the inter frame pulse is reduced to the point where it is the same size as the others. Thus there is no way to discover which pulse corresponds to channel zero. If this happens at reset, the core will not produce pulses until at least one channel has been reduced to the point where the inter frame pulse can be distinguished. If the channels all become saturated after this point, the core is able to continue decoding the channels. Since they are all still present, it is only necessary to ignore every ninth pulse (since that is the short inter frame pulse). The waveform shown above illustrates this behaviour and shows how it transitions back to normal operation when the inter frame gap reappears (seen at simulation time, 235ms). Of course, you'll need to enlarge the image to see this detail.
To measure the pulse width and detect the inter frame pulse, a clock is needed. If mounted on a Raspberry Pi, this clock can be provided by the GPIO04 hardware clock output.
This image shows the actual modulated outputs captured on a logic analyser. The actual hardware used to capture this image was a Turnigy 9XR Pro transmitter with an FrSky DJT module and a D4R-II receiver.