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.

UPP reads and Ethernet writes for the C6748EVM

Other Parts Discussed in Thread: OMAPL138

Hello All,

I am attempting to develop and application that will read data from a peripheral over the UPP bus and then transmit some data over the MII Ethernet port for the OMAPL138/C6748 EVM board.

I have both sub systems working from example code, but I am having a difficult time with the architecture side of things. I don't understand how to put both functions into one project. I started working with the socket examples Helloworld, client... but those projects spin off tasks to allow servers and the like. I don't need or want anything that sophisticated or resource hungry, I just want to spit out data to ta host computer every now and again to offload some DSP data. I did write a simple socket application which runs- but does 'nothing' since the sockets do not apparently inherently know how to get of the DSP. I looked a the MII example code supplied by Logic PD which was originally inteded to do a loopback test and that does work, but after modifying the code to just continuously send data- I find that it does not have any protocol associated and I can't seem to change the IP Address or the port for that matter- it's just EMAC transfers.

The UPP code looks pretty strainght forward I think- although I have not yet dug into it as I have been trying to get the Ethernet work right.

Any help on this would be great!

Mark

  • Mark,

    I'm wondering about what is the best way to help you...

    Are you mostly looking at the PSP examples?  What version of the PSP software are you using?

    Are you using BIOS?  If so, what version?

    Are you looking for further help on how to set up the UPP? 

    Dave

  • Using:

    CCS v4.2.3

    NDK v2_20_04_06

    NPS v1_00_00_09

    BIOS v5_41_10_36

    PSP v2.3 (if this is the same thing as BSL)

    I am basically wanting to use the Ethernet port  with sockets to do periodic sends from the DSP to simply offload data ( probably UDP). I was trying to port the CLient project with the NDK, but it uses tasks and then DAEMONS for each of the functions: TCP/UDP echo, telnet server, HTTP server... I just want to initialize the ehternet port in main() (it could be a task that allows me to come back to main() to manage my own Ethernet sends. I guess I will have to wait on the UDP stuff.

    What I am thinking of as my next step is to dynamically allocate a task to initialize the MII ethernet port at the beginning of main() and then delay a few seconds until initialization completes, then start offloading in main().

    Mark

  • oops, I guess I meant I will have to wait on the UPP stuff

  • I am using PSP v 01_30_00_06

  • Mark,

    I'm just wondering why you'd want to do all of this in main()? Are you having problems creating tasks in BIOS?  (if so, I'd be glad to help you with that.)

    While the NDK examples do have daemons, I agree that this is not the way you probably want to go.

    I'd suggest something like the following (pseudo code):

    dataTask()

    {

        while (stillGettingData) {

       if (data is ready) {

           SEM_post(dataSem);

        }

       if (doneGettingData) {

           stillGettingData = FALSE;

       }

        }

    }


    networkTask()

    {

        SOCKET  stcp = INVALID_SOCKET;
        struct  sockaddr_in sin1;

            /* Allocate the file environment for this task */
            fdOpenSession( TaskSelf() );

             stcp = socket(AF_INET, SOCK_STREAM, 0);
             connect( stcp, (PSA) &sin1, sizeof(sin1);

            ...

             /* wait for data to be ready */

            SEM_pend(dataSem);

            /* data is ready, send it out */

           while(stillData) {

                send( stcp, pBuf, sizeof(int), 0 ); // pBuf contains the data to send

            }

            fdClose( stcp );

        /* Close the session*/
        fdCloseSession( TaskSelf() );

    }


    // excerpt of standard NDK stack thread (sets up NDK and Ethernet, you can find in client or helloWorld NDK examples)

    int StackTest()
    {
        int               rc;
        HANDLE            hCfg;
        CI_SERVICE_TELNET telnet;
        CI_SERVICE_HTTP   http;

        //
        // THIS MUST BE THE ABSOLUTE FIRST THING DONE IN AN APPLICATION!!
        //
        rc = NC_SystemOpen( NC_PRIORITY_LOW, NC_OPMODE_INTERRUPT );
       

        ...

            do
        {
            rc = NC_NetStart( hCfg, NetworkOpen, NetworkClose, NetworkIPAddr );
        } while( rc > 0 );

        // Free the WEB files
        RemoveWebFiles();

        // Delete Configuration
        CfgFree( hCfg );

        // Close the OS
    main_exit:
        NC_SystemClose();
        return(0);
    }

  • Steve,

    thank you for the reply. I did get the network sockets to finally work after hacking away pieces of the NDK client sample application. I am planning on using your mentioned method above with a small twist, here's my psuedo code:

     

    Main()
    {}

    StackTest();

    NetworkOpen()
    {
     myDataOffloaderFunc();
    }

     

    myDataOffloaderFunc()
    {
     //Setup the socket for TCP/IP

     //accept a client connection

     //send a packet to the client to complete the connection

     //receive a packet from the client to ensure life.

     //switch to UDP mode

     while(1)
     {
      //grab UPP data and process it

      //send a small result to the client over UDP
     }
    }

     

    So far this seems to be working ok. Do you see any issues associated with this approach?

  • Since I have not had a reply for ten days on this I have moved onto other issues with using the BIOS. I was previously not using Ethernet and so I did not need the BIOS 5 integration with my project. As I have had to add the need for Ethernet with my UPP project I have also had to use a BIOS. Previously I was using all L2RAM as my memory location for all of my array data in my program, and simply not using any DDR. Now that I have migrated to the BIOS approach I am having a ahard time figuring out how to get my data arrays into L2RAM again. How do I force my arrays in my program into L2RAM ?

    Thanks,

    Mark

  • Hi Mark,

    I think I must have taken what you said in the first sentence of your previous post to mean that your problem was solved.  Sorry about that!

    Regarding your pseudo code, I would still recommend creating a BIOS task within NetworkOpen(), for the function myDataOffloaderFunc().  However, if what you have is working for you, then I suppose it could be ok.

    For your question about getting your arrays into the appropriate memory section, are your data arrays global?

    If so, they will go into the .bss memory section

    You can open the MEM module properties in your application's DSP/BIOS configuration file (*.tcf file) and select the MEM segment for which the .bss section should reside in.  The following screen, for example, is from my program and setting .bss to reside in DDR memory. You could set .bss to L2RAM.

    If you still feel you need even more control over the placement of memory sections, you could define a linker command file.  For more info about linker command files, please see the following documents:

    TMS320C6000 Optimizing Compiler User's Guide

    TMS320C6000 Assembly Language Tools User's Guide

    Steve

  • Steve,

    thank you for the insight on the BIOS configuration.

    As I am trying out the .bss memory segment partitioning for IRAM I am finding that I have yet to see that .bss data arrays are actually in IRAM- they are still coming out at the 0xC8000000 memory segments for DDR.

    I don't understand it...

     

    I have however gotten this approch to work fine. In the BIOS utility .bss and all other memory segments are setup for DDR, however, in my code- where I declarearray variables I use the compiler pragma as such:

    #pragma DATA_SECTION( someVariable, "L2RAM");

    uint32_t  someVariable[4096];

    with this approach I notice that someVariable is within the memory segment 0x11800000 so I know that it is where it should be. Also, I do some performance tests with the

    clock() and see that access to my variables is FAST as opposed to the slow DDR.

    Mark

  • Mark,

    Ok, great! I think it sounds like your issue is solved.  I'll mark the thread as resolved.

    Steve