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 / NIMU support for both EMAC interfaces

My goal is to get the NDK and NIMU to work with both EMAC ports of the C6678 device on our custom board

It seems that the NIMU, as written, is only intended to work with one network interface.    Has anyone else already done this?

Thanks in advance for any guidance,

John

  • As far as NIMU is concerned, simultaneous port operations is not tested.

    I will let others also chime in.

  • John hello,

    I have the same problem with my board, have you succeed using both network interfcaes of the 6678? Can you send me a reference to such a soulution?

    Thanks

  • Hi ,

    We also facing same issue. If u done it , could share us some information or the code to use both EMACs simultaneously.

    Regards,

    Senthil Kumar

  • Hi,

    I was successful configuring the internal switch to use address learning and forwarding. Both ports can be used like a normal switch now.

    These are the main changes I made in nimu_eth.c:

    • EmacSend():
      Remove the following line:
          Cppi_setPSFlags (Cppi_DescType_HOST, (Cppi_Desc *)pCppiDesc, (1<<gTxPort));
    • EMACInit_Core():
      Replace the lines between "#ifndef SIMULATOR_SUPPORT" and "#else" with:
          platform_get_emac_info(0, &emac_info);
          memcpy(ptr_pvt_data->pdi.bMacAddr, emac_info.mac_address, 6);
    • Init_Switch():
      Put the following code at the end of this function:
          // Configure "Learning"/"Forward" state for all 3 ports
          int portNum;
          for (portNum=0; portNum<3; portNum++)
          {
              CSL_CPSW_3GF_ALE_PORTCONTROL alePortControlCfg;
              alePortControlCfg.portState             =   ALE_PORTSTATE_FORWARD;
              alePortControlCfg.dropUntaggedEnable    =   0;
              alePortControlCfg.vidIngressCheckEnable =   0;
              alePortControlCfg.noLearnModeEnable     =   0;
              alePortControlCfg.mcastLimit            =   0;
              alePortControlCfg.bcastLimit            =   0;
              CSL_CPSW_3GF_setAlePortControlReg (portNum, &alePortControlCfg);
          }
    • Init_Cpsw():
      Replace the whole function:
      int32_t Init_Cpsw (uint32_t mtu, uint8_t* myMACAddress)
      {                      
          uint8_t portMac[6] = {0x1, 0x1, 0x1, 0x1, 0x1, 0x1};
          Init_MAC(0, portMac, mtu);

          portMac[0] = 2;
          Init_MAC(1, portMac, mtu);

          /* Setup the Phys by initializing the MDIO - not needed for Simulator*/
          Init_MDIO();

          /* Setup the Ethernet switch finally. */
          Init_Switch(mtu);

          /* CPSW subsystem setup done. Return success */
          return 0;
      }

    In addition, Init_SGMII(0) needs to be called after platform_init(). The platform_init() function in the library only calls Init_SGMII(1) internally.

    I hope I didn't forget too much.

    Ralf

  • hi ralf

     i have tried the modification in nimu_eth.c and enable both the SGMii  i am able to ping from both the ports but able to set only one IP add

     i need enable both ports with different IP add. please tell me the modification for that

    pratik jain

  • Hi Pratik,

    I have no idea how you could bind two IP addresses to different ports. With my modifications you can think of it like a normal switch with three ports. One of them is connected internally to the core.

    Maybe it's possible to configure a second IP address using the legacy configuration API (CfgAddEntry()). But the addresses wouldn't be bound to a specific port. Can you explain what you are trying to do?

    Ralf

  • Ralf,


    Thank you for sharing the code, first of all. I just can't understand how different MAC addresses fit the picture. I mean, with normal switch we should have a single MAC for the device and I expected it to be configured for the port0. But instead we configure (different) MACs for the ports 1 and 2 (and port0 MAC is not configurable at all, according to the documentation). I tried to catch it from the GbE SS manual but failed with it.

    WBR,

    Dmitry

  • The following changes are actually needed:

    * remove (or change) Cppi_setPSFlag() (see SPRUGV9B 2.3.1.3 Table 2-1 for more info);

    * remove (or make it conditional or explicitly call CSL_CPSW_3GF_disableAleBypass()) CSL_CPSW_3GF_enableAleBypass() call in Init_Switch() ("When in bypass mode, all packets received by the MAC modules are forwarded only to the host port (port 0)", SPRUGV9B)

    * make sure both SGMII ports are initialized properly.

    "Normal" packets are generated by NDK and their source MAC fields are set equal to ptr_pvt_data->pdi.bMacAddr, see Emac_Start(). It seems that the values of the MAC[1/2]_SA_[HI/LO] registers are used only in pause frames etc. and both MAC1_SA and MAC2_SA could be programmed to be equal to the MAC address of the device (please, let me know if I'm wrong here).

    Regards,

    Dmitry