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.

NDK helloworld Example problem

i am running latest CCSV6 , mcsdk_3_01_04_07 and  ndk_2_24_02_31. The problem i encountered is: the evmk2H helloworld example will not run pass the EVM_Init(), function in the example.

This example program is provided under mcsdk_bios_xxx/examples/ndk

 On the bug window, its complaining about "csl_serdes.h" is missing. I manually located the file, another problem comes up. The program got stuck in CSL_SerdesWaitForSigDet() function which i cant even step into using CCSv6. 

 any suggestion to solve this problem?

A work around is taking out the EVM_Init function. This is probably not desirable because it can cause other problems.

Now, there comes another problem, when i debug the program. Instead of using DHCP server, I I am assigning the IP to dsp core0 dynamically in the C code. The example will build and run successfully for the first time. Now, when i try to debug/run it for the second time or terminate it and re-run it, i got the following error

QMSS successfully initialized
CPPI successfully initialized
PA successfully initialized

TCP/IP Stack 'Hello World!' Application


TCP/IP Stack 'Hello World!' Application

PASS successfully initialized
Ethernet subsystem successfully initialized
Ethernet eventId : 48 and vectId (Interrupt) : 7
Timeout waiting for reply from PA to Pa_addMac command
Add_MACAddress failed
Error: Unable to register the EMAC

I assume its because the when I click the terminate button on ccsv6, the network stack doesnt shutdown cleanly. But this should be taken care of by the EVM_Init function which doesnt run probably for now. 

Any suggestions?

  • e2e.ti.com/.../259039, this thread doesnt solve the problem. just FYI
  • Hi,
    I think it is a known issue, we will update you the workaround shortly. Thank you for your patience.

  • PASS successfully initialized
    Ethernet subsystem successfully initialized
    Ethernet eventId : 48 and vectId (Interrupt) : 7
    Timeout waiting for reply from PA to Pa_addMac command
    Add_MACAddress failed
    Error: Unable to register the EMAC

    Did you load & run the NDK example without FULL RESET or RESTART the EVM board ?
    We should not reload the code without resetting the EVM.
  • Dear Wei chen,
    Its known issue and we filed an IR for that.

    Workaround:
    Just you have to modify the following file alone and please don't comment the "EVM_init" function.
    C:\ti\pdk_keystone2_3_01_04_07\packages\ti\platform\evmk2h\platform_lib\src\evmc66x_phy.c

    Use this function in "evmc66x_phy.c" file.

    //Titus : Fix for running the NDK example
    #if 1
    void CSL_SgmiiDefSerdesSetup()
    {
    unsigned int old_val;
    volatile unsigned int i;
    
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x000));
    (*mkptr(pa_serdes_cfg_base, 0x000)) = ((old_val & 0x0000FFFF)| 0x00800000);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x014));
    (*mkptr(pa_serdes_cfg_base, 0x014)) = ((old_val & 0xFFFF0000)| 0x00008282);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x060));
    (*mkptr(pa_serdes_cfg_base, 0x060)) = ((old_val & 0xFF000000)| 0x00142438);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x064));
    (*mkptr(pa_serdes_cfg_base, 0x064)) = ((old_val & 0xFF0000FF)| 0x00C3C700);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x078));
    (*mkptr(pa_serdes_cfg_base, 0x078)) = ((old_val & 0xFFFF00FF)| 0x0000C000);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x204));
    (*mkptr(pa_serdes_cfg_base, 0x204)) = ((old_val & 0x00FFFF00)| 0x38000080);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x208));
    (*mkptr(pa_serdes_cfg_base, 0x208)) = ((old_val & 0xFFFFFF00)| 0x00000000);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x20C));
    (*mkptr(pa_serdes_cfg_base, 0x20C)) = ((old_val & 0x00FFFFFF)| 0x02000000);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x210));
    (*mkptr(pa_serdes_cfg_base, 0x210)) = ((old_val & 0x00FFFFFF)| 0x1B000000);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x214));
    (*mkptr(pa_serdes_cfg_base, 0x214)) = ((old_val & 0xFFFF0000)| 0x00006FB8);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x218));
    (*mkptr(pa_serdes_cfg_base, 0x218)) = ((old_val & 0x0000FF00)| 0x758000E4);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x2AC));
    (*mkptr(pa_serdes_cfg_base, 0x2AC)) = ((old_val & 0xFFFF00FF)| 0x00004400);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x22C));
    (*mkptr(pa_serdes_cfg_base, 0x22C)) = ((old_val & 0xFF0000FF)| 0x00100800);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x280));
    (*mkptr(pa_serdes_cfg_base, 0x280)) = ((old_val & 0xFF00FF00)| 0x00820082);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x284));
    (*mkptr(pa_serdes_cfg_base, 0x284)) = ((old_val & 0x00000000)| 0x1D0F0385);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x404));
    (*mkptr(pa_serdes_cfg_base, 0x404)) = ((old_val & 0x00FFFF00)| 0x38000080);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x408));
    (*mkptr(pa_serdes_cfg_base, 0x408)) = ((old_val & 0xFFFFFF00)| 0x00000000);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x40C));
    (*mkptr(pa_serdes_cfg_base, 0x40C)) = ((old_val & 0x00FFFFFF)| 0x02000000);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x410));
    (*mkptr(pa_serdes_cfg_base, 0x410)) = ((old_val & 0x00FFFFFF)| 0x1B000000);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x414));
    (*mkptr(pa_serdes_cfg_base, 0x414)) = ((old_val & 0xFFFF0000)| 0x00006FB8);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x418));
    (*mkptr(pa_serdes_cfg_base, 0x418)) = ((old_val & 0x0000FF00)| 0x758000E4);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x4AC));
    (*mkptr(pa_serdes_cfg_base, 0x4AC)) = ((old_val & 0xFFFF00FF)| 0x00004400);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x42C));
    (*mkptr(pa_serdes_cfg_base, 0x42C)) = ((old_val & 0xFF0000FF)| 0x00100800);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x480));
    (*mkptr(pa_serdes_cfg_base, 0x480)) = ((old_val & 0xFF00FF00)| 0x00820082);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x484));
    (*mkptr(pa_serdes_cfg_base, 0x484)) = ((old_val & 0x00000000)| 0x1D0F0385);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x604));
    (*mkptr(pa_serdes_cfg_base, 0x604)) = ((old_val & 0x00FFFF00)| 0x38000080);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x608));
    (*mkptr(pa_serdes_cfg_base, 0x608)) = ((old_val & 0xFFFFFF00)| 0x00000000);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x60C));
    (*mkptr(pa_serdes_cfg_base, 0x60C)) = ((old_val & 0x00FFFFFF)| 0x02000000);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x610));
    (*mkptr(pa_serdes_cfg_base, 0x610)) = ((old_val & 0x00FFFFFF)| 0x1B000000);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x614));
    (*mkptr(pa_serdes_cfg_base, 0x614)) = ((old_val & 0xFFFF0000)| 0x00006FB8);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x618));
    (*mkptr(pa_serdes_cfg_base, 0x618)) = ((old_val & 0x0000FF00)| 0x758000E4);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x6AC));
    (*mkptr(pa_serdes_cfg_base, 0x6AC)) = ((old_val & 0xFFFF00FF)| 0x00004400);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x62C));
    (*mkptr(pa_serdes_cfg_base, 0x62C)) = ((old_val & 0xFF0000FF)| 0x00100800);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x680));
    (*mkptr(pa_serdes_cfg_base, 0x680)) = ((old_val & 0xFF00FF00)| 0x00820082);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x684));
    (*mkptr(pa_serdes_cfg_base, 0x684)) = ((old_val & 0x00000000)| 0x1D0F0385);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x804));
    (*mkptr(pa_serdes_cfg_base, 0x804)) = ((old_val & 0x00FFFF00)| 0x38000080);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x808));
    (*mkptr(pa_serdes_cfg_base, 0x808)) = ((old_val & 0xFFFFFF00)| 0x00000000);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x80C));
    (*mkptr(pa_serdes_cfg_base, 0x80C)) = ((old_val & 0x00FFFFFF)| 0x02000000);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x810));
    (*mkptr(pa_serdes_cfg_base, 0x810)) = ((old_val & 0x00FFFFFF)| 0x1B000000);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x814));
    (*mkptr(pa_serdes_cfg_base, 0x814)) = ((old_val & 0xFFFF0000)| 0x00006FB8);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x818));
    (*mkptr(pa_serdes_cfg_base, 0x818)) = ((old_val & 0x0000FF00)| 0x758000E4);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x8AC));
    (*mkptr(pa_serdes_cfg_base, 0x8AC)) = ((old_val & 0xFFFF00FF)| 0x00004400);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x82C));
    (*mkptr(pa_serdes_cfg_base, 0x82C)) = ((old_val & 0xFF0000FF)| 0x00100800);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x880));
    (*mkptr(pa_serdes_cfg_base, 0x880)) = ((old_val & 0xFF00FF00)| 0x00820082);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x884));
    (*mkptr(pa_serdes_cfg_base, 0x884)) = ((old_val & 0x00000000)| 0x1D0F0385);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0xa00));
    (*mkptr(pa_serdes_cfg_base, 0xa00)) = ((old_val & 0xFFFF00FF)| 0x00000800);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0xa08));
    (*mkptr(pa_serdes_cfg_base, 0xa08)) = ((old_val & 0x0000FFFF)| 0X38A20000);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0xa30));
    (*mkptr(pa_serdes_cfg_base, 0xa30)) = ((old_val & 0xFF0000FF)| 0x008A8A00);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0xa84));
    (*mkptr(pa_serdes_cfg_base, 0xa84)) = ((old_val & 0xFFFF00FF)| 0x00000600);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0xa94));
    (*mkptr(pa_serdes_cfg_base, 0xa94)) = ((old_val & 0x00FFFFFF)| 0x10000000);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0xaa0));
    (*mkptr(pa_serdes_cfg_base, 0xaa0)) = ((old_val & 0x00FFFFFF)| 0x81000000);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0xabc));
    (*mkptr(pa_serdes_cfg_base, 0xabc)) = ((old_val & 0x00FFFFFF)| 0xFF000000);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0xac0));
    (*mkptr(pa_serdes_cfg_base, 0xabc)) = ((old_val & 0xFFFFFF00)| 0x0000008B);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0xb08));
    (*mkptr(pa_serdes_cfg_base, 0xb08)) = ((old_val & 0x0000FFFF)| 0x583F0000);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0xb0c));
    (*mkptr(pa_serdes_cfg_base, 0xb0c)) = ((old_val & 0xFFFFFF00)| 0x0000004e);
    
    #ifdef SERDES_INTERNAL_LOOPBACK
    /*Beginning of SERDES LOOPBACK Configuration*/
    old_val = (*mkptr(pa_serdes_cfg_base, 0x200));
    (*mkptr(pa_serdes_cfg_base, 0x200)) = ((old_val & 0x00FFFFFF)| 0x40000000);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x400));
    (*mkptr(pa_serdes_cfg_base, 0x400)) = ((old_val & 0x00FFFFFF)| 0x40000000);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x600));
    (*mkptr(pa_serdes_cfg_base, 0x600)) = ((old_val & 0x00FFFFFF)| 0x40000000);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x800));
    (*mkptr(pa_serdes_cfg_base, 0x800)) = ((old_val & 0x00FFFFFF)| 0x40000000);
    /*End of Serdes loopback configuration*/
    #endif
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0x000));
    (*mkptr(pa_serdes_cfg_base, 0x000)) = ((old_val & 0xFFFFFF00)| 0x00000003);
    
    old_val = (*mkptr(pa_serdes_cfg_base, 0xa00));
    (*mkptr(pa_serdes_cfg_base, 0xa00)) = ((old_val & 0xFFFFFF00)| 0x0000005F);
    
    
    /*Enable TX and RX via the LANExCTL_STS 0x0000 + x*4 */
    *mkptr(pa_serdes_cfg_base, 0x1fe0) = 0xF800F8C0;
    *mkptr(pa_serdes_cfg_base, 0x1fe4) = 0xF800F8C0;
    *mkptr(pa_serdes_cfg_base, 0x1fe8) = 0xF800F8C0;
    *mkptr(pa_serdes_cfg_base, 0x1fec) = 0xF800F8C0;
    
    /*Enable pll via the pll_ctrl 0x0014*/
    *mkptr(pa_serdes_cfg_base, 0x1ff4) = 0xe0000000;
    
    /*Waiting for SGMII Serdes PLL lock.*/
    reg_poll_to(32, SGMII0_STATUS, 0x10, 0x10, 10000);
    reg_poll_to(32, SGMII1_STATUS, 0x10, 0x10, 10000);
    reg_poll_to(32, SGMII2_STATUS, 0x10, 0x10, 10000);
    reg_poll_to(32, SGMII3_STATUS, 0x10, 0x10, 10000);
    
    
    for(i = 0; i < 5000; i++);
    for(i = 0; i < 40000; i++);
    }

    And rebuild the K2H platform library.
    C:\ti\pdk_keystone2_3_01_04_07\packages\ti\platform\evmk2h\platform_lib

    Now rebuild the NDK example and run.


    Please let me know if you have any problem.

  • thanks, TItus. It solved the first problem.
    Yes, i am aware that i need to reset the board to get it to work again. Is there any way around that? The board is connected to a server sitting somewhere in a lab. I am remotely debugging my program from my workstation. Its kind of inconvenient to walk to the board every time i have to recompile and run the program.
    The other thing tho, the ARM on my board get the ip address from a DHCP server, but after i loaded my network program, the ARM lost its connection. I couldnt ping the ARM anymore. Any idea why? if the ARM is alive after i load my program, i can reset the program through ARM.
  • You have to use some function which will shutdown and enable it properly for second reload.
    Please refer to the following TI wiki page.
    processors.wiki.ti.com/.../NDK,_PA_Resource_Wiki_for_Keystone_Devices
  • Hi Titus,
    I am also getting stuck at the same function when I try to run.
    Getting these prints on the console>>

    QMSS successfully initialized
    CPPI successfully initialized
    PASS successfully initialized

    After this the program is stuck.
    The work around that you have provided has some issues. I am running this example for K2L board.
    Please provide some details to solve this issue.

    Thanks,
    Kushal
  • Please refer to the below NDK TI wiki page for K2E.

    processors.wiki.ti.com/.../Running_NDK_examples_for_Keystone_devices
    I hope, the similar method is used for K2L too.

    How did you run the code ?
    i) Power ON the board with No-boot mode
    ii) Connect the target with K2L gel file.
    iii) Then run the PHY script in gel option.
    iv) Now load and run the NDK code on K2L.
  • Hi Titus,
    Actually I was trying to run Raw Ethernet project(PA_emacExample_K2LArmBiosExampleProject), which sends raw packets to the connected machine.
    After running the program, following are the messages displayed on console.

    QMSS successfully initialized
    CPPI successfully initialized
    PASS successfully initialized

    After that it is stuck there and when I check the callstack, I found the program to be stuck at

    CSL_SerdesWaitForSigDet()
    CSL_SerdesLaneEnable_Lane_Init_RX()

    Are the calls in the callstack.

    Please let me know how to resolve this and proceed further.

    Thanks,
    Kushal
  • The workaround for this problem is posted here,

    Update the function CSL_SgmiiDefSerdesSetup() in evmc66x_phy.c and re-build the platform_lib and the example project.

    We always recommend you to start a new thread for faster and appropriate response. Old threads get less attention than new.

    Thank you.

  • Dear Kushal,
    Try the workaround which Raja has mentioned.

    What package version are you using ?
    If its latest processor SDK, then can you try to use the MCSDK version ?

    Processor SDK download link:
    www.ti.com/.../processor_sw.page

    MCSDK download link:
    software-dl.ti.com/.../index_FDS.html