Author Topic: Bare Metal - LWIP - Dual Ethernet TE0715-30 on TE0706  (Read 1226 times)

fractal

  • Active Member
  • *
  • Posts: 3
Bare Metal - LWIP - Dual Ethernet TE0715-30 on TE0706
« on: May 27, 2020, 11:51:49 AM »
Hi,

I am trying to get a bare metal implementation, using lwip, running on the TE0715-30 hosted on the TE0706 carrier, to bring up both Ethernet interfaces.

  • Windows 10
  • Vivado 2018.3
  • SDK 2018.3

So far I have the first Ethernet interface (ETH0), which uses to TE0715-30 PHY working. However, I am struggling with the second Ethernet interface (ETH1).

I have configured Vivado like this (see Vivado.PNG attached)....



... with the pinout like this ...

Code: [Select]
set_property PACKAGE_PIN P6 [get_ports RGMII_td[3]]
set_property PACKAGE_PIN P5 [get_ports RGMII_td[2]]
set_property PACKAGE_PIN N4 [get_ports RGMII_td[1]]
set_property PACKAGE_PIN N3 [get_ports RGMII_td[0]]
set_property PACKAGE_PIN T2 [get_ports RGMII_rxc]
set_property PACKAGE_PIN T1 [get_ports ETH_CONFIG]
set_property PACKAGE_PIN R5 [get_ports RGMII_rd[3]]
set_property PACKAGE_PIN R4 [get_ports RGMII_rd[2]]
set_property PACKAGE_PIN N1 [get_ports RGMII_rd[1]]
set_property PACKAGE_PIN P1 [get_ports RGMII_rd[0]]
set_property PACKAGE_PIN L2 [get_ports RGMII_rx_ctl]
set_property PACKAGE_PIN L1 [get_ports MDIO_PHY_mdc]
set_property PACKAGE_PIN M4 [get_ports MDIO_PHY_mdio_io]
set_property PACKAGE_PIN M3 [get_ports ETH_RST[0]]
set_property PACKAGE_PIN U2 [get_ports RGMII_txc]
set_property PACKAGE_PIN U1 [get_ports RGMII_tx_ctl]

... the TE0706 is set to operate at 1V8.

I have the following code to attempt to bring up the second Ethernet interface...

Code: [Select]
struct netif NtwrkIF;
struct ip4_addr sonarIP;
struct ip4_addr sonarNetMask;
struct ip4_addr sonarGateWay;
u8 macAddr[6] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05}; //changed from actual MAC address

static struct udp_pcb *pUDP_PCB;

...

IP4_ADDR(&sonarIP, 192,168,16,200);
IP4_ADDR(&sonarNetMask, 255,255,255,0);
IP4_ADDR(&sonarGateWay, 192,168,16,1);

...

xemac_add(&NtwrkIF, &sonarIP, &sonarNetMask,
  &sonarGateWay, macAddr, XPAR_XEMACPS_1_BASEADDR);
netif_set_default(&NtwrkIF);
netif_set_up(&NtwrkIF);

pUDP_PCB = udp_new();

udp_bind(pUDP_PCB, IP_ADDR_ANY, 1234); //changed from actual port
udp_recv(pUDP_PCB, &RcvHandler, NULL);


... but the RcvHandler is never called despite the LEDs on the RJ45 connector flashing to indicate that data is being received. The only difference between using ETH0 and ETH1 is a change of XPAR_XEMACPS_0_BASEADDR to XPAR_XEMACPS_1_BASEADDR.

ETH0 is working fine.

What have I done wrong?

Thanks,

Simon

fractal

  • Active Member
  • *
  • Posts: 3
Re: Bare Metal - LWIP - Dual Ethernet TE0715-30 on TE0706
« Reply #1 on: May 27, 2020, 10:40:54 PM »
By adding the following ...

Code: [Select]
#define LWIP_DEBUG 0
#define NETIF_DEBUG LWIP_DBG_ON
//#define DHCP_DEBUG LWIP_DBG_ON
#define UDP_DEBUG  LWIP_DBG_ON
//#define MEMP_DEBUG LWIP_DBG_ON
//#define MEM_DEBUG LWIP_DBG_ON
//#define ICMP_DEBUG LWIP_DBG_ON
#define IP_DEBUG LWIP_DBG_ON

... to lwipots.h I get a whole bunch of debug messages which suggest that ETH1 is receiving data from the other end of the link, but whilst it is also suggested that data is sent, nothing arrives at the other end of the link.



Anyone have any ideas?

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1997
Re: Bare Metal - LWIP - Dual Ethernet TE0715-30 on TE0706
« Reply #2 on: May 28, 2020, 07:05:44 AM »
Hi,
we have only an 2016.2 reference design with linux and TE0720 which works:
https://shop.trenz-electronic.de/de/Download/?path=Trenz_Electronic/Modules_and_Module_Carriers/4x5/TE0720/Reference_Design/2016.2/carrier_te0706_eth

I've tried to update to 19.2 but I had also some problems to get the second PHY completely working.
Link up was there but any data transfer failed. I've "played " a little bit and the problem on my place seems to be related to the gmii to rgmii IP, but I didn't found out the reason at the moment.
I've start to modified constrains but without suggess at the moment.
So check also gmii to rgmii there are a lot of timing constrians which must be setup manually.


br
John

fractal

  • Active Member
  • *
  • Posts: 3
Re: Bare Metal - LWIP - Dual Ethernet TE0715-30 on TE0706
« Reply #3 on: June 01, 2020, 05:40:05 PM »
Thanks John,

So to rule out if the issue I am having is a hardware (Vivado) issue or a software (LWIP) issue would it be worth trying to get PetaLinux up and running using the HDF file already generated?

I have got the PetaLinuz environment setup but where would I find what needs to go into the system-user.dsti (device tree) to bring up both ETH0 and ETH1?

Thanks,

Simon

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1997
Re: Bare Metal - LWIP - Dual Ethernet TE0715-30 on TE0706
« Reply #4 on: June 02, 2020, 06:57:38 AM »
Hi, we haven't any example with TE0715 at the moment. Only this 16.2 version with TE0720.
You can check this one, but  it depends also on the vivado version, what you must setup.  Sometimes there are also patches from xilinx necessary
As  I told you, 16.2 was running but I've trouble with 19.2 version.

To bring up second ETH, it's maybe easier to deactivate first one (which was directly connected to PS) at first. When you get the second one running, activate first one again.
Bringing up ETH with Linux is sometimes easyer as use Xilinx barmetal drivers.
Part of the device tree will be generate automatically with petalinux, but unfortunally not all, you must also check Xilinx Wiki and bindings.
see also:
https://wiki.trenz-electronic.de/display/PD/PetaLinux+KICKstart
https://wiki.trenz-electronic.de/display/PD/PetaLinux+KICKstart#PetaLinuxKICKstart-References

br
John

br
John