8.4.7 Ping-Pong
Communication peripherals often use ping-pong buffers. Ping-pong buffers allow the CPU to process data in one buffer while a periph-
eral transmits or receives data in the other buffer.
Both transmit and receive ping-pong buffers are easily implemented using the LDMA. In either case, this requires two descriptors as
shown in
Figure 8.10 Infinite Ping-Pong Example on page
descriptor. Using two adjacent descriptors and relative link addressing ensures the descriptors are easily reloadable.
A
A receiver ping-pong buffer controller consists of two buffers and two descriptors stored in memory that point to the two buffers. Once
initialized, as the peripheral receives data, it will fill the first buffer. Once the first buffer is full, it will link automatically to the second
buffer and generate an interrupt. Software will then process the data in the first buffer while the LDMA is transferring data to the second
buffer. For a receiver ping-pong buffer each descriptor should link to the other descriptor. The link bit should be set to provide infinite
ping pong between the two buffers. The DONIFS bit in each descriptor should be set to generate an interrupt on the completion of each
descriptor.
• Descriptor A
• CTRL
• DONEIFS = 1
• other settings as desired
• SRCADDR = peripheral source address
• DSTADDR = memory destination address
• LINK = 0x00000013
• LINKADDR = 0x00000010 (next descriptor)
• LINK = 1 (link to next descriptor)
• LINKMD = 1 (relative addressing)
• Descriptor B
• CTRL
• DONEIFS = 1
• other settings as desired
• SRCADDR = peripheral source address
• DSTADDR = memory destination address
• LINK = 0xFFFFFFF3
• LINKADDR = 0xFFFFFFF0 (previous descriptor)
• LINK = 1 (link to previous descriptor)
• LINKMD = 1 (relative addressing)
For transmitter ping-pong buffer, software will fill the first buffer and then initiate the DMA transfer. The LDMA will transmit the first
buffer data while software is filling the second buffer. In this case, the two descriptors should point to each other, but not automatically
silabs.com | Building a more connected world.
177. The LINKADDR field of the LINK member should point to the other
CTRL
SRC
DST
LINK
B
CTRL
SRC
DST
LINK
Figure 8.10. Infinite Ping-Pong Example
LDMA - Linked DMA Controller
Memory
A
LINKADDR = 0x00000010
LINKMD = 1
B
LINKADDR = 0xFFFFFFF0
LINKMD = 1
Reference Manual
Rev. 1.1 | 177
Need help?
Do you have a question about the EFR32xG14 Wireless Gecko and is the answer not in the manual?