The following actions can be taken to
achieve the same constant audio latency in either direction over a wireless network
(from the I2S pins on one wireless device platform to the I2S
pins on another wireless device platform):
- One node must be defined as audio clock master and the other node must be
defined as audio clock slave. The slave must use an external audio clock source
with adjustable rate.
- For both nodes, set STMPWPER = N × (AIFDMACFG.END_FRAME_IDX + 1), where N is a
whole number.
- The value of STMPWPER equals audio latency in number of frames.
- The value of STMPWPER also equals the memory buffer size in number of
samples.
- Perform samplestamp capture on the master when it transmits the RF packet
synchronization word, and include the value of the fixed-point samplestamp in
the transmitted packet.
- Perform samplestamp capture on the slave when it receives the RF packet
synchronization word, and store the samplestamp value of the master in the RF
packet. Calculate the difference between the samplestamp values of the master
and slave, which is used to:
- Initially offset the STMPWCNT counter of the slave so that it matches
the samplestamp value of the master.
- While running, adjust the external audio clock source rate so that the
difference between the samplestamp values of the slave and the master
approach 0.
- For both nodes, set up DMA pointers and DMA start triggers so that the value of
STMPWCNT represents the input and output buffer positions of the current frame
on the ADx pins.