So i'm trying to figure how how to do the encoding and decoding of an M-array Differential Phase Shift Keying (DPSK) signal. I understand how to do it for binary DPSK, but on higher ordered signals I'm missing something. Here's how I would do it for binary DPSK (M=2).
The steps should be as follows: get Data sequence -> Differential encoding -> assign phase for Tx -> (on the receiver side) do Differential decoding - assign bits from phase. The following assumes an initial bit of 1, where 1 corresponds to a phase of $\pi$
$\;\;\;\;$Data Sequence $b$ = | 1 0 1 1 0 0 1 0 1 0
$\;\;\;\;$Diff Encoding $a$ = 1 | 0 0 1 0 0 0 1 1 0 0 -> this opperation should be $a_k = a_{k-1}\oplus b_k$
$\;\;\;\;$Assign phase $\phi$= $\pi$ | 0 0 $\pi$ 0 0 0 $\pi$ $\pi$ 0 0
$\;\;\;\;$Diff Decoding $\rho$= $\ $$\ $$\ $| $\pi$ 0 $\pi$ $\pi$ 0 0 $\pi$ 0 $\pi$ 0 -> where $\rho = \phi_n - \phi_{n-1}$
$\;\;\;\;$Phase to bit = $\;\;\;\;\;\;\;$| 1 0 1 1 0 0 1 0 1 0
So I end up with my original sequence. but if I try to do this with M=4, I don't end up with the same sequence. Lets assume for M = 4 that 00 = 0, 01 = $\frac{\pi}{2}$, 11 = $\pi$ , and 10 = $\frac{3\pi}{2}$, and that we start with initial data 11
$\;\;\;\;$Data Sequence $b$ = $\ $ | 10 11 00 10 10
$\;\;\;\;$Diff Encoding $a$ = 11 | 00 11 11 01 11 -> this opperation should be $a_k = a_{k-1}\oplus b_k$ = ($a_{k-1} + b_k$) mod M
$\;\;\;\;$Assign phase $\phi$= $\ $ $\pi$ | 0 $\pi$ $\pi$ $\frac{\pi}{2}$ $\pi$
$\;\;\;\;$Diff Decoding $\rho$=$\ $$\ $$\ $$\ $$\ $ | $\pi$ $\pi$ 0 $\frac{3\pi}{2}$ $\frac{\pi}{2}$ -> where $\rho = \phi_n - \phi_{n-1}$
$\;\;\;\;$Phase to bit =$\, $ $\, $$\, $$\, $$\, $$\, $$\, $$\, $$\, $$\, $ | 11 11 00 10 01
So here I don't end up with the same sequence. I'm not quite sure where I'm messing up there. If feel like if I can do this for M=4 I can do this for any size M. Can someone help me see where I'm going wrong? Thanks for your time!