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.

AM5728: FtpServer Example Question

Part Number: AM5728

As a follow on to my previous question about writing code for a TcpIp server, TI's (Garrett) suggestion that I looked at the FtpServer example worked great. I can now run a TCPIP server using PRU2 ETH0 on a idkAM5728 board. I would now like to change the example code to:

1. use PRU2 ETH1 instead of ETH0 - I've tried a few changes but they have not worked yet - What changes would I need to make?

As a follow on question, once I get the code working for PRU2 ETH1 I would like to change the example application to support 2 TcpIp servers on 2 seperate MACs. I would like to initialize/configure PRU1 ETH0 and PRU1 ETH1 in the same application. I would have separate threads listening for each client. I just need to see how I would configure both ports in the same application. I know how to code the rest.

Thanks in advance.

  • Kenny,

    Are you able to ping the PRU2 ETH1 currently? The PRU ETH1 IP address is configured in cfg file if you refer to the FtpServer example:

    if (enableStaticIP)

    {

       /* Settings for static IP configuration */

       Ip.ResolveIP = false;

       Ip.CallByIP = false;

       Ip.autoIp = false;

       Ip.address = "192.168.2.3";

       Ip.mask = "255.255.255.0";

       Ip.gatewayIpAddr = "192.168.2.1";

       Ip.ifIdx = 2;

    }

    If the ping works, bind the IP address to the TCP socket should be working as you expected.

    Regards,

    Garrett

  • So I'm still confused - I don't understand the static IP portion of the config file. How do I set the cfg file up to be able to ping PRU2 ETH0 & PRU2 ETH1 from a PC. I changed the config to:

    Tcp0.transmitBufSize = 8192;
    Tcp1.transmitBufSize = 8192;
    Tcp0.receiveBufSize = 65536;
    Tcp1.receiveBufSize = 65536;
    Tcp0.receiveBufLimit = 65536;
    Tcp1.receiveBufLimit = 65536;
    Global.pktNumFrameBufs = 384;

    if (enableStaticIP)
    {
    /* Settings for static IP configuration */

    Ip0.ResolveIP = false;
    Ip0.CallByIP = false;
    Ip0.autoIp = false;
    Ip0.address = "192.168.2.3";
    Ip0.mask = "255.255.255.0";
    Ip0.gatewayIpAddr = "192.168.2.1";
    Ip0.ifIdx = 1;

    Ip1.ResolveIP = false;
    Ip1.CallByIP = false;
    Ip1.autoIp = false;
    Ip1.address = "192.168.1.4";
    Ip1.mask = "255.255.255.0";
    Ip1.gatewayIpAddr = "192.168.1.1";
    Ip1.ifIdx = 2;

    }
    else
    {
    Ip0.dhcpClientMode = Ip0.CIS_FLG_IFIDXVALID;
    Ip1.dhcpClientMode = Ip1.CIS_FLG_IFIDXVALID;
    }

    CASE1:

    When I set my PC to static IP 192.168.2.22

    I connect the Cat5 to PRU2 ETH1

    I get a reply from PRU2 ETH1 from 192.168.2.3

    I connect the Cat5 to PRU2 ETH0

    I don't get a response

    CASE2:

    When I set my PC to static IP 192.168.1.22

    I connect the Cat5 to PRU2 ETH1 

    I get a reply from PRU2 ETH1 from 192.168.1.4

    I connect the Cat5 to PRU2 ETH0

    I don't get a response

    I don't understand - 192.168.1.4 and 192.168.2.3 are both mapped to PRU2 ETH1

    How do I map to PRU2 ETH0

    Is this documented somewhere so I don't have to keep asking you?

  • Kenny,

    Can you try to leave the ETH1 IP config in the .cfg file as-is, but move the ETH0 config to your C file as shown in the default FtpServer example?

    For ETH0, in the .cfg file, you only need add the hook: Global.stackInitHook = "&stackInitHook";

    In C code:

    char *ipAddr      = "192.168.2.3";

    char *ipMask      = "255.255.255.0";

    void stackInitHook(HANDLE hCfg)

    {

       CI_IPNET NA;

       NA.IPAddr = inet_addr(ipAddr);

       NA.IPMask = inet_addr(ipMask);

       CfgAddEntry(hCfg, CFGTAG_IPNET, 1, 0, sizeof(CI_IPNET),

                   (UINT8 *)&NA, 0);

    Let me check if we have a document with the details.

    Regards,

    Garrett