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.

RTOS/AM5728: IPU1 RAW Ethernet send issue

Part Number: AM5728


Tool/software: TI-RTOS

Hello.

We are sending and receiving RAW Ethernet packets from IPU1 using GMAC.

Reception is OK. All packets sent from PC are received.

When sending we have the following problem.

sendnc() function returns no errors, but only 1 to 5 packets from 20 are actually sent out of the device and received by the PC.

We use NDK version 2.25.01.11.

We use the following TI RTOS configuration:

app.cfg  
Global.ndkTickPeriod = 10;
Global.kernTaskPriLevel = 11;
Global.serviceReportHook = null;
Global.IPv6 = false;
Global.enableCodeGeneration = true;
Global.pktNumFrameBufs = 1920;

We use the following procedure:

#define GOOSE_PACK_TYPE 0x88B8

static uint8_t test_pkt[] = {
    0xff, 0xff, 0xff, 0xff, 0xff, 0xff,  // SRC MAC
    0xff, 0xff, 0xff, 0xff, 0xff, 0xff,  // DEST MAC
    0x88, 0xB8,                          // proto
    0x00, 0x01, 0x08, 0x00, 0x06, 0x04, 0x00, 0x01, 0x01, 0xbb,
    0xcc, 0xdd, 0xee, 0xff, 0xc0, 0xa8, 0x01, 0x16, 0x00, 0x00,
    0x00, 0x00, 0xc0, 0xa8, 0x01, 0x02, 0x01, 0x02, 0x03, 0x04,
    0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02,
    0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0xfe, 0xfe, 0x00, 0x00};
  
  taskParams.instance->name = "IPU1_eth_taskFxn";
  taskParams.stackSize = 0x1500;
  taskParams.priority = 4;
  Task_create(IPU1_eth_taskFxn, &taskParams, &eb);  
  
Void IPU1_eth_taskFxn(UArg arg0, UArg arg1) {
  unsigned char *data_in = NULL;
  unsigned char *data_out = NULL;
  HANDLE handlerRecBuff;
  HANDLE handlerSendBuff;
  struct timeval to;
  struct sockaddr_in sockaddr;
SOCKET s = socket(AF_RAWETH, SOCK_RAWETH, GOOSE_PACK_TYPE);
setsockopt(s, SOL_SOCKET, SO_IFDEVICE, &val, sizeof(val)
  for (;;) {
    code = recvnc(s, (void **)&data_in, 0, &handlerRecBuff);
    if (code == -1)
    {
      UART_printf("Failed: %d\n", fdError());
    }
    else
    {
      UART_printf("Success: %d\n",code);
      for(int i=0;i<code;i++)
      {
          UART_printf("0x%x ",data_in[i]);
          if(i%10 == 9)
              UART_printf("\n");
      }
      UART_printf("sizeof(test_pkt) %d ",sizeof(test_pkt));
      for(int j=0;j<20;j++)
      {
      code = getsendncbuff(s,sizeof(test_pkt),&data_out,&handlerSendBuff);
      //mac_source
      data_out[0] = data_in[6];
      data_out[1] = data_in[7];
      data_out[2] = data_in[8];
      data_out[3] = data_in[9];
      data_out[4] = data_in[10];
      data_out[5] = data_in[11];
      //MAC destination
      data_out[6] = data_in[0];
      data_out[7] = data_in[1];
      data_out[8] = data_in[2];
      data_out[9] = data_in[3];
      data_out[10] = data_in[4];
      data_out[11] = data_in[5];
      for(int i=12;i < sizeof(test_pkt);i++)
          data_out[i]=test_pkt[i];
      if (code == -1)
          UART_printf("Failed getsendncbuff: %d\n", fdError());
      else
      { 
          data_out[15] = j;//count
          code = sendnc(s, data_out, sizeof(test_pkt),handlerSendBuff,0);
          if (code == -1) {
              UART_printf("Failed send: %d\n", fdError());
          } else {
              UART_printf("Success send: %d\n",code);
          }
          
      }
      sendncfree(handlerSendBuff);
      }
      recvncfree(handlerRecBuff);
    }
  }
}

Thanks
  • The RTOS team have been notified. They will respond here.
  • Pavel,

    Is your project (board int, phy/emac config) based on "EMAC_BasicExample_idkAM572x_m4BiosExampleProject" from PDK? Are you working on AM572x EVM or IDK? Do you see the issue with both port 0 and port1?

    Regards,
    Garrett
  • Garrett Ding ,

    Our project(board int, phy/emac config) is based on "NIMU_BasicExample_idkAM572x_m4Exampleproject"from pdk_am57xx_1_0_6 . We are working on AM572x IDK. We see the problem only on port1 because port0 does not detect a connection.

    We create project based on "EMAC_BasicExample_idkAM572x_m4BiosExampleProject" project. In the loopback mode, when sending 20 packets, we also get 1-4 responses only



    Regards,
    Alex

  • Alex,

    Are you running the project on AM572x IDK or your custom board? Does the default loopback example pass on your board?
    When your project fails, any error stats in CPSW STATS register?

    Does the wireshare capture show 5 packets or CPSW_STATS GOOD_TX_FRAMES?

    Do you see the same issue if sending packets from ARM core?

    Regards,
    Garrett
  • Garrett,

    We are using the project on AM5728 IDK board. Default loopback example not pass on board. In the example, the package is sent and programm is a wait for the response but the package does not received. We corrected an example that it would not hang forever waiting and it to continue sending 20 packets. Packet size is TEST_PKT_SIZE = 64 bytes.Below is the statistics  from emac_get_statistics

    Packet is sending from arm M4 IPU0-0.

    another am5728 idk board

    Regards,

    Alex

  • Board_init success
    EMAC loopback test application initialization
    SetPhyMode:000001e1 Auto:1, FD10:64, HD10:32, FD100:256, HD100:128, FD1000:0 LPBK:0
    SetPhyMode:000001e1 Auto:1, FD10:64, HD10:32, FD100:256, HD100:128, FD1000:0 LPBK:0
    main: emac_open sucess
    Link status: Up
    Link is in loopback state
    received packet: 1
    received packet: 2
    received packet: 3
    received packet: 4
    received packet: 5
    received packet: 6
    received packet: 7
    received packet: 8
    received packet: 9
    received packet: 10
    received packet: 11
    received packet: 12
    received packet: 13
    received packet: 14
    received packet: 15
    received packet: 16
    received packet: 17
    received packet: 18
    received packet: 19
    received packet: 20
    received packet: 21
    received packet: 22
    received packet: 23
    received packet: 24
    received packet: 25
    received packet: 26
    received packet: 27
    received packet: 28
    received packet: 29
    received packet: 30
    received packet: 31
    received packet: 32
    received packet: 33
    received packet: 34
    received packet: 35
    received packet: 36
    received packet: 37
    received packet: 38
    received packet: 39
    received packet: 40
    received packet: 41
    received packet: 42
    received packet: 43
    received packet: 44
    received packet: 45
    received packet: 46
    received packet: 47
    received packet: 48
    received packet: 49
    received packet: 50
    received packet: 51
    received packet: 52
    received packet: 53
    received packet: 54
    received packet: 55
    received packet: 56
    received packet: 57
    received packet: 58
    received packet: 59
    received packet: 60
    received packet: 61
    received packet: 62
    received packet: 63
    received packet: 64
    received packet: 65
    received packet: 66
    received packet: 67
    received packet: 68
    received packet: 69
    received packet: 70
    received packet: 71
    received packet: 72
    received packet: 73
    received packet: 74
    received packet: 75
    received packet: 76
    received packet: 77
    received packet: 78
    received packet: 79
    received packet: 80
    received packet: 81
    received packet: 82
    received packet: 83
    received packet: 84
    received packet: 85
    received packet: 86
    received packet: 87
    received packet: 88
    received packet: 89
    received packet: 90
    received packet: 91
    received packet: 92
    received packet: 93
    received packet: 94
    received packet: 95
    received packet: 96
    received packet: 97
    received packet: 98
    received packet: 99
    received packet: 100
    packet received; 100, alloc failed: 0
    All tests have passed
    stats: rx: 0x474746, tx: 0x474774, RxOctets: 32284360
    
    
    Alex,

    Can you try the PDK 1.0.9 from PRSDK 4.2 ( )

    Attached log is captured with EMAC_BasicExample_idkAM572x_m4BiosExampleProject which shows 100 packets received properly.

    Regards,

    Garrett