This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CPPI details for USB on the C674x

Although I am very familiar with many types of high speed USB peripheral and OTG controllers, as I read more and more about CPPI, I'm realizing there are some definite holes.  As you can tell from these questions, I'm completely unfamiliar with the type of API CPPI is presenting and have no idea how to use it. I'm also pretty unfamiliar with USB Host design, so probably there are things in the CPPI which are extremely useful for hosts that are confusing me. The questions below only really scratch the surface, but I'm hoping that the answers might trigger some epiphanies. The USB interface for the Mentor controller seems very familiar (although I have one question below on this.) 

My interest is entirely for peripheral operation.

Referring to SPRUFM9B

1. For the CPPI packet descriptors, USB specific data, Sec 2.8.2 gives the layout, but there is no information on the Packet Information Word 0/1. How these are used, what the format is. From User Case 4 (Sec 3.4), you can kinda figure it out, but there is no formal documentation on these words. It's not even really clear how to use CPPI for host vs peripheral mode differs, although the example seems to be for a peripheral.

2. I'm having trouble finding documentation on various Qs and prioritization. Basically 2.8.8.2 is very cursory and really gives very little information on the scheduler, and again, not a lot of information on the format of the data structures and usage, excepting Example 2 in the Sec 3.1. What is a "credit" when referring to the scheduler?

3. I'd like more information on teardown. Does this happen automatically for USB initiated resets? Is this really important for the USB implementation? Why is there such a thing as teardown packets (Sec 2.8.4) when this functionality seems to be controlled by a register (See 4.70, TX_TEARDOWN bit, as well as two others indicated in 2.8.4)

4. Is there a reason that all the data buffers in all the examples are limited to 256 bytes? Is this to show buffer linking? Sec 2.8.1 seems to indicate that buffers can be up to 4Mbyte.

5.  What is the purpose of having multiple Queues per TX channel? The example makes it appear that this is specified as per Sec 4.70, but 4.70 makes it look like this is for some special "teardown" descriptor use?  Is this a typo?  I am also very confused by the comment in Sec 2.8.12.1, Step 1.4.


6. In 4.71, Table 83 says that the default receive Q can be overridden by the CPPI FIFO data block. What is the CPPI FIFO Data block?

7. For the linking RAM (Sec 4.82-84), Region 1 doesn't seem to have a size register? In fact, what is the purpose of setting up memory regions at all? When you push a buffer descriptor pointer onto a Q, you include a pointer to the descriptor and size of the descriptor onto the Q (Sec 4.90). It seems the host is responsible for doing the descriptor memory management, so I'm not sure why the queue manager needs this info at all.

8. For the Mentor controller, is there any limitation between when an INDEXed registers (0x410-0x41F) and non-INDEXed register are used (0x510-0x53A). There must be at least some kind of warning against using both simultaneously in multi-threaded code. (I can't think of why you would want to do that, but I'd expect the datasheet to mention it anyway). Are there any limitations to accessing different non-indexed endpoint status or FIFOs simultaneously?

Thanks for any help with all this...

  • Hi,

    1. The DMA configuration and operation is agnostic of the mode the USB Controller is assuming. So, the programming is the same. You only need to pay attention to the data direction flow only. Transmit Data Buffer will be defined by Host Packet and optional Host Buffer Descriptors while Receive Data Buffer will be defined by Host Buffer Descriptors only. Yes you are correct, the fields of each words are missing. Will capture the main field description within this reply and the User's Guide will be updated soon with the required information. Thank you for pointing this out.

    Both HPD is the superset of HBD. For the defined fields the meanings of the bit fields are the same for most parts. for HBD Words 0, 1, and half of Word 2 are reserved.

    HPD: Word 0 [31:27]=Host Pkt Type = 0x10 which is HPD, HPDWord0[26:22]=Number of 32-bit words in the protocol specifc region (almost all application this is program with ZERO), HPD:Word0[21:0]=Packet Length (do not confuse the term packet here with a USB Packet)=The total data size to be transmitted.

    HPD: Word 1[31:27]=Source Port Num=Endpoint #, HPD:Word1[26:21]=Source Channel Num=Always ZERO, HPD:Word1[20:16]=Source Sub Channel Num=Always ZERO, HPD:Word1[15:0]=Destination Tag=Always ZERO.

    HPD/HBD: Word2[31]=Packet Error=Meaningful for HBD only. Port sets this bit if error occured during reception and is reserved for both HPD/HBD. HPD/HBD:Word2[30:26]=Packet Type=USB=0x5 (for HBD, Ports will populate this feld with 0x5 so it is reserved), Word2[25:15]=Reserved, HBD/HPD: Word2[14]=Descriptor Location is On/Off Chip = 1/0 respectively, HBD/HPDWord2[13:12]=Return Queue Manager=Always Zero, HBD/HPD:Word2[11:0]=Packet Return Queue=Completion Queue.

    HBD/HPD:Word3[31:22]=Reserved; HBD/HPD:Word3[21:0]=Data Buffer Length for this Descriptor.

    HBD/HPD:Word4[31:0]=Pointer to the Data Buffer defined by this Descriptor.

    HBD/HPD:Word5[31:0]=Pointer to the NEXT HBD.

    HBD/HPD:Word6[31:22]=Reserved; Word621:0]=Original Data Buffer Length for this Descriptor. Should be >= Word3[21:0]

    HBD/HPD:Word7[31:0]=Pointer to the Orignal Data Buffer defined by this Descriptor.

    2.  I did see the description of the registers and it seems to be confusing and require update. Since the scheduler handles 256 entries and 4 entries are allowed to be captured per a single 32 bit words, there exist 64 Words with WORD 0 handling the first 4 entries (entries 1, 2, and 3) and WORD63 handles the last 4 of the 256 entries (entries 253, 254, 255, and 256). With this description, Section 4.75 should have been documented as: CDMA Scheduler Table Word n Registers (ENTRY[0]- ENTRY[3]). The Channel # is the Endpoint Number. This will be corrected on the next release.

    Having said that, there is a good description of the scheduler but would like to simplify what it is supposed to do. The scheduler handles the rate at which an endpoint is serviced, if the endpoint is scheduled for service by a user. The scheduler handles priority in a bit different matter, that is, by configuring the entries that the scheduler is designed to use. The size and content of this entry is user programmable. The user has the capability of implementing priority by the number of entries you assign. Note that the scheduler services the endpoints in a round robin fashion and the way you control priority is by the values you are programming the entries. As an example assume you would like to enable three endpoints on your system: EP1-Tx, EP2-Rx, and EP2-Tx. If you desire to assign equal priorities then the most efficient way to do this will be to inform the scheduler that you would have only 3 entries by programming DMA_SCHED_CTRL.LAST_ENTRY with 2 (which 3-1). This would instruct the scheduler to work with the first 3 entries only. Only the first word, WORD0, will be required to be used. ENTRY0_CHANNEL=1, ENTRY0_RXTX=0, ENTRY1_CHANNEL=2, ENTRY1_RXTX=1, and ENTRY2_CHANNEL=2, ENTRY2_RXTX=0.

    For the same defined endpoints (EP1-Tx, EP2-Rx, and EP2-Tx) suppose you want to handle EP1-Tx to be handled 4 times as much as the others. One way to achieve this is to program DMA_SCHED_CTRL.LAST_ENTRY with 5 (which 6-1) and allocate the first 4 entries to EP1-Tx operation and the two entries of WORD1 for EP2-Rx, and EP2-Tx. This means that WORD0 could be programmed as follows (ENTRY3_CHANNEL=1, ENTRY3_RXTX=0 : ENTRY2_CHANNEL=1, ENTRY2_RXTX=0  : ENTRY1_CHANNEL=1, ENTRY1_RXTX=0 : ENTRY0_CHANNEL=1, ENTRY0_RXTX=0) while WORD1 (ENTRY1_CHANNEL=2, ENTRY1_RXTX=0   :   ENTRY0_CHANNEL=2, ENTRY0_RXTX=1).

    3. Please refer to the updated User's Guide that will be released shortly and more information on this will be included there.

    4. No. The 256 bytes is just an example. See reply for Question 1 for the max data size.

    5. This is upto the application. Most of the time, you the application might require only a single queue. However, for ISO type of transfers you might two queues might be necessary.

    6. The CPPI DMA is used by multiple peripherals (EMAC, ATM, etc) and this is DMA specific and you can ignore this comment.

    7. Region 1 size is indirectly supplied since total size allowd (64K) - region 0 size.

    8. You can access EP Registers directly from the non-indexed region or indirectly from Indexed region. If want to ensure no contention arises, you might want to use the non-indexed region at all time. However, few registers require access via Indexing.

    Most of the concerns you have pointed here will be addressed on the next release. Thank you.

    Best regards, Zegeye

  • Great, thank you for all these details!  I'm starting to get a better picture of how all this fits together.

    It seems like there will be a lot of changes in the next user manual release, any idea when that is scheduled?

    Best regards, Peter.

  • Hi Peter,

    It is scheduled to be released tonight.

    Thanks for all the inputs.

    Best regards, Zegeye