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.

MPU2 error while setting threshold of QMSS

I running a netFp code on Core 0 of K2L6630 evm. In the function Pktlib_createHeap() , a queue threshold is set when numPkts !=0 & dataBufferPktThreshold>0 .

On executing the code I get the following error 

[C66xx_0] Pktlib_createHeap(): [Error=-4] - Unable to create netfpDataRxHeap private heap

which is the error for MPU not being Configured. 

The error occurs only when dataBufferPktThreshold=8 & not when 0.

 After studying the MPU2(SPRUGW5A) user guide I programmed the instances of MPU2 & MPU5 in Core 0 main file in the following manner 

    CSL_MpuHandle           hMpu5,hMpu2;

    hMpu5    = (CSL_MpuHandle)CSL_MPU_5_REGS;
    hMpu5->PROG_REGION[0].PROG_START_ADDRESS    = 0x02A04000;
    hMpu5->PROG_REGION[0].PROG_END_ADDRESS      = 0x02B00000;

    /* Programmable Range n Memory Protection Page Attribute Register (PROGn_MPPA)
    *   31-26   25    24    23    22    21    20    19   18   17   16   15   14   13   12   11   10   9      8     7  6   5  4  3  2  1  0
    * Reserved AID15 AID14 AID13 AID12 AID11 AID10 AID9 AID8 AID7 AID6 AID5 AID4 AID3 AID2 AID1 AID0 AIDX Reserved NS EMU SR SW SX UR UW UX
    */
    hMpu5->PROG_REGION[0].PROG_MPPA = 0x03FFFCBF;

    hMpu2    = (CSL_MpuHandle)CSL_MPU_2_REGS;
    hMpu2->PROG_REGION[0].PROG_START_ADDRESS    = 0x02A00000;
    hMpu2->PROG_REGION[0].PROG_END_ADDRESS      = 0x02B00000;
    /* Programmable Range n Memory Protection Page Attribute Register (PROGn_MPPA)
    *   31-26   25    24    23    22    21    20    19   18   17   16   15   14   13   12   11   10   9      8     7  6   5  4  3  2  1  0
    * Reserved AID15 AID14 AID13 AID12 AID11 AID10 AID9 AID8 AID7 AID6 AID5 AID4 AID3 AID2 AID1 AID0 AIDX Reserved NS EMU SR SW SX UR UW UX
    */
    hMpu2->PROG_REGION[0].PROG_MPPA = 0x03FFFCBF;

I program the 2 instances because their address overlaps which each other according to K2L user guide.

But executing the code again give the same error again

[C66xx_0] Pktlib_createHeap(): [Error=-4] - Unable to create netfpDataRxHeap private heap

 


Here is the screenshot of Registers of MPU's

As can be seen from user guide of K2L the Master id is of CorePAC 0 CFG & having a supervisor write fault even though I have enable it in the MPU2 instance.

And I want to Know what is Transfer ID ??

Also I've run the example project pktlib_DspOnlyk2lTestProject, where call to test the threshold heap function was disable(the calling of the function was commented). After enabling the test, it showed the same error.

Please tell how to resolve the error.

  • Hi Ravi Raj,

    Welcome to the TI E2E keystone forum. I hope you will find many good answers here and in the TI.com documents and in the TI Wiki Pages (for processor issues). Be sure to search those for helpful information and to browse for the questions others may have asked on similar topics (e2e.ti.com). Please read all the links below my signature.

    We will get back to you shortly on the above query. Thank you.
  • Hi,

    1. What is the MCSDK version used for testing?

    2. Are you able to run the pktlib_DspOnlyk2lTestProject example without any modification?

    3. If No, How are running the MCSDK example? Have you grouped core0 and 1, load and run the .out on both the cores?

    Please find the test log of pktlib_DspOnlyk2lTestProject:

    [C66xx_0] ****************************************
    ****** Packet Library Unit Test ********
    ****************************************
    Debug: Queue Manager and CPPI are initialized.
    [C66xx_1] ------------------------------------------------------
    Debug (Core 1): Waiting for the Shared Heap to be created.
    [C66xx_0] Debug: QMSS LLD Revision: 02.01.00.11:Sep 24 2015:00:00:52
    Debug: CPPI LLD Revision: 02.01.00.10:Sep 23 2015:23:55:44
    ------------------------------------------------------
    Debug: Merge API Test
    Debug: Merge API Test API Passed
    ------------------------------------------------------
    Debug: Cloning Test starting with 3 packet in a chain
    Debug: Testing cloning from the original.
    Debug: Testing cloning from the clone.
    Debug: Cleaning clones memory leak test
    Debug: Merge an original packet after a cloned Packet (with CPDMA simulation).
    Debug: Merge an original packet after a cloned Packet (with software free)
    Debug: Merge a cloned packet after a cloned packet (with CPDMA simulation)
    Debug: Merge a cloned packet after a cloned packet (with software free)
    Debug: Merge a cloned packet after an original packet (with CPDMA simulation)
    Debug: Merge a cloned packet after an original packet (with software free)
    Debug: Merge an original packet after an original packet (with CPDMA simulation)
    Debug: Merge an original packet after an original packet (with software free)
    Debug: All cloning tests passed.
    ------------------------------------------------------
    Debug: Split Test starting with 5 packets in a chain
    Debug: Testing split in the middle of the first packet
    Debug: Testing split in the middle of the 3 packet
    Debug: Testing split at the end of the 3 packet
    Debug: Testing 10 1 byte splits in the packet.
    Debug: Detecting MAX Reference Counts splits which can be handled. 
    Debug: Split Packet failed after 63 splits
    Debug: Please verify this with the MAX reference count in the PKTLIB documentation
    Debug: Split API test was successful.
    ------------------------------------------------------
    Debug: Split Test starting with 5 packets in a chain
    Debug: Testing split in the middle of the first packet
    Debug: Testing split in the middle of the 4 packet
    Debug: Testing split at the end of the 2 packet
    ------------------------------------------------------
    Debug: Split Test starting with 5 packets in a chain
    Debug: Testing 10 1 byte splits in the packet.
    Debug: Detecting MAX Reference Counts splits which can be handled. 
    Debug: Split Packet failed after 63 splits
    Debug: Please verify this with the MAX reference count in the PKTLIB documentation
    Debug: Split API test was successful.
    ------------------------------------------------------
    Debug: Testing Multiple Heaps
    Debug: Multiple heap test was successful.
    ------------------------------------------------------
    Debug: Testing Packet Library Free use cases
    Debug: Use Case1 -> Sending Packet to IP
    Debug: Use Case2 -> Cloning and Sending Orignal Packet to IP (With Garbage Collection)
    Debug: Use Case3 -> Cloning and Sending Cloned Packet to IP(With Garbage Collection)
    Debug: Use Case4 -> Sending Packet to IP with App deferred cleanup
    Debug: Use Case5 -> Cloning Packets and sending cloned packets to IP with App deferred cleanup
    Debug: Use Case6 -> Double cloned IP send.
    ------------------------------------------------------
    Debug: Testing Super Heap 
    Debug: 'My Test Heap' has a MAX data buffer size of 1024 bytes
    Debug: 'MyHeap1' has a MAX data buffer size of 128 bytes
    Debug: 'MyHeap2' has a MAX data buffer size of 256 bytes
    Debug: Super Heap has been created with handle 0x@0085bdd8
    Debug: Use Case 1 --> Different Packet Size allocation check
    Debug: Testing Packet Size allocations from 1 to 128 bytes
    Debug: Testing Packet Size allocations from 129 to 256 bytes
    Debug: Testing Packet Size allocations from 257 to 1024 bytes
    Debug: Super Heap Packet size allocation (1 to 1024) bytes checks passed
    Debug: Use Case 2 --> Super Heap bufferless packet allocation passed
    Debug: Use Case 3 --> Super Heap bufferless packet allocation (Member->Member) passed
    ------------------------------------------------------
    Debug: Testing Starvation Heaps 
    Debug: Starvation Heap created successfully
    Debug: Starvation Heap Data Buffer starvation counter test passed
    Debug: Starvation Heap Zero Data Buffer starvation counter test passed
    ------------------------------------------------------
    ------------------------------------------------------
    Debug: Testing Delete Heap 
    Debug: Delete Heap with only data buffer test passed.
    Debug: Delete Heap with only zero buffer test passed.
    Debug: Delete Heap with data buffer & zero buffer test passed.
    Debug: Delete Heap with data buffer & zero buffer & starvation queue test passed.
    Debug: Super Heap Deletion test passed.
    Debug: Delete Heap tests passed
    ------------------------------------------------------
    Debug: Adjustment: 2
    Debug: Get Heap Stats took 437 ticks
    ------------------------------------------------------
    Debug: Benchmarking the Packet Library Merge Operation
    Debug: Allocating Pkt0 of 200 byte took 769 ticks
    Debug: Allocating Pkt1 of 500 byte Packet took 727 ticks
    Debug: Merging Pkt0 and Pkt1 took 976 ticks
    Debug: Allocating Headroom 16 byte Packet took 723 ticks
    Debug: Adding Headroom to Merged Packet took 956 ticks
    Debug: Allocating Tailroom 400 byte Packet took 725 ticks
    Debug: Adding Tailroom packet to existing packet with 3 buffers
    Debug: Adding Tailroom to Merged Packet took 1388 ticks
    Debug: Merged Packet has 4 buffers
    Debug: Free Merged Packet took 3776 ticks
    ------------------------------------------------------
    Debug: Benchmarking the Packet Library Clone Operation
    Debug: Allocating Pkt0 of 800 byte took 724 ticks
    Debug: Allocating 0 byte Packet took 710 ticks
    Debug: Orignal Packet has 1 buffers
    Debug: Cloning Packet took 1685 ticks
    Debug: Cleaning Orignal Packet took 979 ticks
    Debug: Cleaning Cloned Packet took 2067 ticks
    Debug: Orignal Packet has 2 buffers
    Debug: Cloning Packet took 3193 ticks
    Debug: Orignal Packet has 2 buffers
    Debug: Cleaning Orignal Packet took 1802 ticks
    Debug: Cloned Packet has 2 buffers
    Debug: Cleaning Cloned Packet took 3968 ticks
    ------------------------------------------------------
    Debug: Benchmarking the Packet Library Split Operation
    Debug: Before Split the Packet has 3 buffers
    Debug: Splitting 1500 byte to 800 byte packet took 3174 ticks
    Debug: After Split Packet1 has 2 buffers
    Debug: Free Split Packet 1 took 2896 ticks
    Debug: After Split Packet2 has 2 buffers
    Debug: Free Split Packet 2 took 1970 ticks
    ------------------------------------------------------
    Debug (Core 0): Waiting for the packet to arrive.
    [C66xx_1] Debug (Core 1): Allocated Packet 0x10843080: 120 bytes & sent to Application Queue
    Debug (Core 1): Cloned Packet 0x10843080 -> 0x10842c80
    Debug: Shared Heap Test Passed.
    [C66xx_0] Debug (Core 0): Detected Packet 0x10843080: 120 bytes from application queue
    Debug (Core 0): Detected Cloned Packet 0x10842c80: 120 bytes from application queue
    Debug: All tests passed
    

    Thank you.

  • 1. The MCSDK version used is 3.1.3.6 

    2. WITHOUT ANY MODIFICATIONS the pktlib_DspOnlyk2lTestProject is running exactly like above.

    But it is not testing the threshold case. The function test_pktLibHeapThresholds() which test the threshold parameter is commented in function int32_t test_pktLibrary(void)  which lies in file pktlib_test.c.

     


    When I remove the commented code to test for the threshold case where dataBufferPktThreshold = 8, I get the following logs (3.  The code is running on both core COR0 & CORE1 & they are grouped )

    [C66xx_0] ****************************************
    ****** Packet Library Unit Test ********
    ****************************************
    Debug: Queue Manager and CPPI are initialized.
    Debug: QMSS LLD Revision: 02.01.00.10:Mar 27 2015:00:09:00
    Debug: CPPI LLD Revision: 02.01.00.09:Mar 27 2015:00:04:01
    Debug: Size of the Packet Heap is 128 bytes
    ------------------------------------------------------
    Debug: Merge API Test
    Debug: Merge API Test API Passed
    ------------------------------------------------------
    Debug: Cloning Test starting with 3 packet in a chain
    Debug: Testing cloning from the original.
    Debug: Testing cloning from the clone.
    Debug: Cleaning clones memory leak test
    Debug: Merge an original packet after a cloned Packet (with CPDMA simulation).
    Debug: Merge an original packet after a cloned Packet (with software free)
    Debug: Merge a cloned packet after a cloned packet (with CPDMA simulation)
    Debug: Merge a cloned packet after a cloned packet (with software free)
    Debug: Merge a cloned packet after an original packet (with CPDMA simulation)
    Debug: Merge a cloned packet after an original packet (with software free)
    Debug: Merge an original packet after an original packet (with CPDMA simulation)
    Debug: Merge an original packet after an original packet (with software free)
    Debug: All cloning tests passed.
    ------------------------------------------------------
    Debug: Split Test starting with 5 packets in a chain
    Debug: Testing split in the middle of the first packet
    Debug: Testing split in the middle of the 3 packet
    Debug: Testing split at the end of the 3 packet
    Debug: Testing 10 1 byte splits in the packet.
    Debug: Detecting MAX Reference Counts splits which can be handled. 
    Debug: Split Packet failed after 63 splits
    Debug: Please verify this with the MAX reference count in the PKTLIB documentation
    Debug: Split API test was successful.
    ------------------------------------------------------
    Debug: Split Test starting with 5 packets in a chain
    Debug: Testing split in the middle of the first packet
    Debug: Testing split in the middle of the 4 packet
    Debug: Testing split at the end of the 2 packet
    ------------------------------------------------------
    Debug: Split Test starting with 5 packets in a chain
    Debug: Testing 10 1 byte splits in the packet.
    Debug: Detecting MAX Reference Counts splits which can be handled. 
    Debug: Split Packet failed after 63 splits
    Debug: Please verify this with the MAX reference count in the PKTLIB documentation
    Debug: Split API test was successful.
    ------------------------------------------------------
    Debug: Testing Multiple Heaps
    Debug: Multiple heap test was successful.
    ------------------------------------------------------
    Debug: Testing Packet Library Free use cases
    Debug: Use Case1 -> Sending Packet to IP
    Debug: Use Case2 -> Cloning and Sending Orignal Packet to IP (With Garbage Collection)
    Debug: Use Case3 -> Cloning and Sending Cloned Packet to IP(With Garbage Collection)
    Debug: Use Case4 -> Sending Packet to IP with App deferred cleanup
    Debug: Use Case5 -> Cloning Packets and sending cloned packets to IP with App deferred cleanup
    Debug: Use Case6 -> Double cloned IP send.
    ------------------------------------------------------
    Debug: Testing Super Heap 
    Debug: 'My Test Heap' has a MAX data buffer size of 1024 bytes
    Debug: 'MyHeap1' has a MAX data buffer size of 128 bytes
    Debug: 'MyHeap2' has a MAX data buffer size of 256 bytes
    Debug: Member Heap 0 has buffer size of 128 bytes
    Debug: Member Heap 1 has buffer size of 256 bytes
    Debug: Member Heap 2 has buffer size of 1024 bytes
    Debug: Super Heap has been created with handle 0x@0085bce0
    Debug: Use Case 1 --> Different Packet Size allocation check
    Debug: Testing Packet Size allocations from 1 to 128 bytes
    Debug: Testing Packet Size allocations from 129 to 256 bytes
    Debug: Testing Packet Size allocations from 257 to 1024 bytes
    Debug: Super Heap Packet size allocation (1 to 1024) bytes checks passed
    Debug: Use Case 2 --> Super Heap bufferless packet allocation passed
    Debug: Use Case 3 --> Super Heap bufferless packet allocation (Member->Member) passed
    ------------------------------------------------------
    Debug: Testing Heap Thresholds 
    Error: Unable to create the heap error code -4
    Error: PACKET Library Unit Testing FAILED
    [C66xx_1] ------------------------------------------------------
    Debug (Core 1): Waiting for the Shared Heap to be created.
    

    The above error , as said earlier, is occurring in  the function Pktlib_createHeap()  when the queue threshold is tried to be set & DSP CORE0 is not able to access the memory because of MPU. I tried running it after putting my code too of MPU ,as written in my question, but it didn't work.

  • Hi,

    Could you please check the access privileges of DSP core 0 and may be there could be memory access violations? Kindly validate this.

    Thanks & regards,
    Sivaraj K
  • There is supervisor write fault by master id 16(as indicated by the screenshot in my post ) which belong to corepac 0 CFG according K2L6630 user guide. The Fault address,which is same every time, lies in QMSS PEEK REGION because we try to set threshold value in D register (according to Multi core Navigator User guide). I tried changing the privilege level as shown in my post but the error remains same.

    Please tell How this memory access error can be resolved ??
  • Hi Ravi,
    Thank you for pointing this out. I will check with factory team why test_pktLibHeapThresholds() has been commented out on the example and get back to you.

    Thank you.
  • Hi Ravi Raj Saxena,
    As per factory team the MPAX registers should be configured by the Linux kernel before running "Thershold" test case which is not supported on "DSP No boot" mode.

    Try below sequence,
    1. Boot the Linux on ARM cores and wait for root prompt.
    2. Connect to the DSP core0 using emulator on CCS without gel file.
    3. Load and run the application pktlib_DspOnlyk2hTestProject (.out) file.

    Thank you.
  • Hello Raja

    Thank you for your response.

    We were able to run the "Threshold" case on the arm boot mode.

    However for our case we want to run on "DSP No Boot" due to our application. 

    Is there any way to run it on " DSP No Boot" mode ?

    Can it be programmed in the following manner ?

      CSL_MpuHandle           hMpu5,hMpu2;
    
        hMpu5    = (CSL_MpuHandle)CSL_MPU_5_REGS;
        hMpu5->PROG_REGION[0].PROG_START_ADDRESS    = 0x02A04000;
        hMpu5->PROG_REGION[0].PROG_END_ADDRESS      = 0x02B00000;
    
        /* Programmable Range n Memory Protection Page Attribute Register (PROGn_MPPA)
        *   31-26   25    24    23    22    21    20    19   18   17   16   15   14   13   12   11   10   9      8     7  6   5  4  3  2  1  0
        * Reserved AID15 AID14 AID13 AID12 AID11 AID10 AID9 AID8 AID7 AID6 AID5 AID4 AID3 AID2 AID1 AID0 AIDX Reserved NS EMU SR SW SX UR UW UX
        */
        hMpu5->PROG_REGION[0].PROG_MPPA = 0x03FFFCBF;
    
        hMpu2    = (CSL_MpuHandle)CSL_MPU_2_REGS;
        hMpu2->PROG_REGION[0].PROG_START_ADDRESS    = 0x02A00000;
        hMpu2->PROG_REGION[0].PROG_END_ADDRESS      = 0x02B00000;
        /* Programmable Range n Memory Protection Page Attribute Register (PROGn_MPPA)
        *   31-26   25    24    23    22    21    20    19   18   17   16   15   14   13   12   11   10   9      8     7  6   5  4  3  2  1  0
        * Reserved AID15 AID14 AID13 AID12 AID11 AID10 AID9 AID8 AID7 AID6 AID5 AID4 AID3 AID2 AID1 AID0 AIDX Reserved NS EMU SR SW SX UR UW UX
        */
        hMpu2->PROG_REGION[0].PROG_MPPA = 0x03FFFCBF;

    If not then How ? 

    Thank you.