NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

McBSP Channel Swapping

From Texas Instruments Wiki
Jump to: navigation, search

Introduction[edit]

A common issue that users encounter when using the McBSP is channel swapping/rotation. This issue comes in two flavors: start-up channel swapping and run-time channel swapping.

Start-up Channel Swapping[edit]

This is the more common case. In this scenario when the McBSP is enabled the channels are either correct or swapped and stay that way until a reset.

Background[edit]

This problem only occurs when the McBSP is the transmit frame slave (external device generates FSX) .

When McBSP transmitter is released from reset (XRST=1):

  • an event is sent to the DMA/EDMA such that it will put an element in the McBSP's DXR
  • when the first frame sync occurs the McBSP begins to output data

Cause[edit]

Start-up channel swapping ultimately is caused by the DMA/EDMA not servicing the McBSP with the first data element in time for the first data transfer. The amount of time is random from taking the McBSP out of reset until the first frame sync occurs. Sometimes that amount of time will be very small and the DMA/EDMA will not get the first element in the DXR prior to the start of the first transfer. In that case, the McBSP outputs an extra word prior to the first actual data. This causes the data to be permanently swapped/rotated.

Solution[edit]

In order to avoid the channel swapping, one needs to make sure the DMA/EDMA can always have enough time to service the DXR before the first frame sync. The McBSP Reference Guide gives detailed information on the startup procedure. It actually has a separate initialization procedure for the special case where the external device is the transmit frame master. The procedure boils down to monitoring the FSX signal such that one enables the McBSP immediately following a frame sync. That way, the DMA/EDMA has a full frame period to service the DXR. The Reference Guide gives several different ways to accomplish this goal. Please see the device-specific McBSP Reference Guide for more specific info.

Run-time Channel Swapping[edit]

With run-time channel swapping the McBSP channels will swap/rotate one or more times at run-time, i.e. after the initial startup.

Cause[edit]

Ultimately run-time channel swapping occurs due to not servicing the McBSP's DXR/DRR in time. There are multiple issues that could cause this to happen.

DMA/EDMA configuration issues

  • If the priority is too low the channel might be held off too long
  • The EDMA puts all events in queues, so a long transfer on the same queue can hold off the McBSP transfer too long

Switched Central Resource (SCR) Priority

  • Each "master" on the SCR (CPU, EDMA TCs, EMAC, etc.) has a priority
  • If the EDMA TC that services the McBSP is not highest priority then other masters could prevent it from accessing the data

Memory latency

  • Putting the buffer in SDRAM/DDR can cause issues.
  • SDRAM/DDR requires refreshes, page close, page open, etc. which can delay the EDMA from getting the data
  • The SDRAM/DDR controller has some additional queueing

Solutions[edit]

EDMA Configuration

  • Check the DMAQNUMn registers and the QDMAQNUM registers to make sure that all EDMA channels are being mapped to the same queue/TC.
  • Avoid having any long transfers mapped to the same TC. For starters try having only the EDMA channel servicing the McBSP on a given queue/TC.
  • If you are working with 16-bit stereo data a nice solution is to configure the McBSP for a single 32-bit element instead of 2 16-bit elements. This has a two-fold effect because it cuts the number of EDMA transfers in half and also gives the EDMA twice as much time to complete the transfer without dropping any samples. Furthermore, if there ever is an over/underrun (for the other reasons mentioned) then this solution would cause TWO samples to be dropped and so no rotation would happen.

SCR Priority

  • Make the EDMA TC that services the McBSP the highest priority master in the system.

Buffer Location

  • Try moving the buffers to internal memory. If you are using a device that has the 64x+ MDMA/SDMA Blocking Errata you need to be careful with the internal memory too. See the device-specific errata for details and workarounds if this is the case for the device you're using.
E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article McBSP Channel Swapping here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article McBSP Channel Swapping here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article McBSP Channel Swapping here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article McBSP Channel Swapping here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article McBSP Channel Swapping here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article McBSP Channel Swapping here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article McBSP Channel Swapping here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article McBSP Channel Swapping here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article McBSP Channel Swapping here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity