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 with 2 ethernet drivers

Other Parts Discussed in Thread: OMAPL138

Hi

how do I configure NSK to be able to use 2 ethernet connections.

I have the folder for NDK and I have 2 NSP folder for each ethernet driver. Within each driver there is the NIMUDeviceTable defined:

/**
* @brief
* NIMUDeviceTable
*
* @details
* This is the NIMU Device Table for the Platform.
* This should be defined for each platform. Since the current platform
* has a single network Interface; this has been defined here. If the
* platform supports more than one network interface this should be
* defined to have a list of "initialization" functions for each of the
* interfaces.
*/
NIMU_DEVICE_TABLE_ENTRY NIMUDeviceTable[] =
{
/**
* @brief EmacInit for Faraday Init
*/
EmacInit,
NULL
};

How and where should I define these table in oder to use both ports and how do I use them in the application?
Regards
Armin
  • Hi Armin,

    Which version of the NDK are you using?

    NSP version?

    Which hardware platform?

    Are you trying to configure 2 interface instances?  So that you can use 2 physical Ethernet ports on your device with the NDK?

    If so, please see the hints in this post:


    http://e2e.ti.com/support/embedded/bios/f/355/t/242288.aspx

    Steve

  • Hi Steve

    I'm using NDK 2.22.02.16.

    We have our home made platform, but it is similar to the EVMOMAPL138, we just added a SMSC Lan9220 to the SRAM bus.

    So I have a working NSP for the EMAC of the L138 and I also made a NSP for the SMSC Lan9220. Both work well with the sample application. 

    The question in now, how to use them together in an application. And where do I have to define the NIMUDeviceTable[]?

    Thanks

    Armin

  • Armin,

    Ok, I see.  You have 2 drivers, one for each EMAC, and you want to use them both together.

    So, you need to register both drivers with the NDK.  Since you've already made both drivers NIMU compliant, then I think you're 90% of the way there.

    The next thing you need to do (as previously mentioned) is to update the NIMUDeviceTable[] array with the init function of each driver.  The table is located in the following file in the OMAPL138 driver: nimu_eth.c

    I believe you should build both of your drivers into a single driver library, which defines the NIMUDeviceTable[]once for that library.

    For example, your table should probably be updated to look something like this:

    NIMU_DEVICE_TABLE_ENTRY NIMUDeviceTable[] =
    {
    /**
      * @brief  EmacInit for Faraday Init
      */
        EmacInit,         // <- existing OMAPL138 driver init function
        SMSCLan9220_init, // <- init function for your SMSC Lan9220 (replace with the actual name of your init fxn)
        NULL
    };

    Then, when each init function in the table is called, the driver will hook up with the NDK via the NIMURegister call.

    Steve

  • Steve,

    I plan to work on a similar issue soon. Now what I am missing is an example for the config file. How do we need to configure the two interfaces for the NDK? In the GUI I think we can only do one.

    Regards

  • Hi Armin,

    More recently I have been doing very similar.

    For using both interface - I configure network via C code (as I understand I had no other way http://e2e.ti.com/support/embedded/bios/f/355/t/260191.aspx). For base I took example "ndk_evm6748_elf_cfgdemo" which place in "nsp_1_10_01_06\packages\ti\ndk\examples\" in "ndk_evm6748_elf_examples.zip" archive. This example show how to configure NDK manually . Then I removed all unnecessary for me functions, and replace function static void GetIP( uint IfIdx ) by my function:

    static void GetIpAdressess(void)
    {
    CI_IPNET NA0, NA1;

    //Add first interface

    bzero( &NA0, sizeof(NA0) );
    NA0.IPAddr = inet_addr("192.168.0.2");;
    NA0.IPMask = inet_addr("255.255.255.0");
    strcpy( NA0.Domain, "default0.net" );
    CfgAddEntry( 0, CFGTAG_IPNET, 1, 0, sizeof(CI_IPNET), (UINT8 *)&NA0, 0 ); // Item 1 - first interface

    //Add second interface
    bzero( &NA1, sizeof(NA1) );
    NA1.IPAddr = inet_addr("192.168.2.3");;
    NA1.IPMask = inet_addr("255.255.254.0");
    strcpy( NA1.Domain, "default1.net" );
    CfgAddEntry( 0, CFGTAG_IPNET, 2, 0, sizeof(CI_IPNET), (UINT8 *)&NA1, 0 ); // Item 2 - second interface

    }

    *you need to add IP adresses from different subnet, otherwise it does not work.(As write Yaro Yaro http://e2e.ti.com/support/embedded/bios/f/355/t/237302.aspx)

    Of cause It is worth doing when you added your driver to NIMU device table, as write Steven.

    Hope this help.

    Best regards,

    Ilya