News:

Attention: For security reasons,please choose a user name *different* from your login name.
Also make sure to choose a secure password and change it regularly.

Main Menu

[TE0726 ZynqBerry] Configuring Ethernet to Work in Linux

Started by hjm142, September 18, 2017, 06:43:17 PM

Previous topic - Next topic

hjm142

Hello,

I have been working to get the Ethernet to show-up on the Debian image (ifconfig), but appear to be missing a step somewhere in my setup.  I can run the example code provided in the zip files and Ethernet shows up in the ifconfig response.  So, I am missing something and I would like to try to understand what.

For this basic bring-up, I am using the TE0726 with nothing more than the Zynq at the moment.  My Zynq setup matches the rpi_hw_ips zip file's processor, but without the two I2C modules and AXI peripherals.  Specifically, I have QSPI (MIO1:6), USB0 (MIO28:39) w/ reset set at MIO7,  SD1 (MIO10:15), and UART1 (MIO8:9).  I have created the FSBL and have gone through the petalinux setup and have an image that boots up into linux.  My OS image was stolen from the zynqberrydemo2 example zip file.  It boots and I can login as root through the UART.  However, ifconfig produces the following:

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:80 errors:0 dropped:0 overruns:0 frame:0
          TX packets:80 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:6344 (6.1 KiB)  TX bytes:6344 (6.1 KiB)

I found a previous posts on the forum (https://forum.trenz-electronic.de/index.php?topic=569.0) that seemed to have walked through what I was missing.  I modified the system-top.dts file <project folder>/subsystems/linux/configs/device-tree folder to include the lines Oleksander mentioned in the post.  I then went into the petalinux kernel configuration and selected the SMSC LAN95XX.  Then I re-ran petalinux-build, recreated the BOOT.bin, burned the new BOOT.bin to flash, and copied the new image.ub to the SD card containing the linux image.  When I booted the new system, it was the same results.  Ethernet still did not show up in response to the ifconfig.

So, I'm not really sure what I am missing.  I have gone through the pre-packaged zip files many times, but cannot seem to find anything obvious that I am missing.  Any help would really be appreciated.




JH

Hello,

which Vivado/SDK and PetaLinux Version did you use?

You wrote" have gone through the petalinux setup and have an image that boots up into linux.  My OS image was stolen from the zynqberrydemo2 example zip file."  Did you mean, you generate petalinux image.ub by ourself and used the prebuilt Debian SD image? Or did you used the petalinux template with your HDF file?

br
John

hjm142

Thanks for the reply.  I am using Vivado/SDK 2015.4 with 2015.4 PetaLinux.  I am generating the image.ub myself from scratch and using the pre-built Debian SD image.

JH

Hi,
we have also 2017.1 available:
Scripts to generate Debian image from your petalinux project is included. Also some ips are updated.

For your own petalinux, you must select correct kernel driver for eth over usb.
You can check template in the reference design (/os/petalinux).

We have also some note for petalinux usage, see:
Petalinux is changed between 2016.3 and 2016.4 so you must select correct section.

br
John

hjm142

I think I did select the correct driver for the kernel.

petalinux-config -c kernel
Went through the menus and selected:
"Device Drivers > Network device support > USB Network Adapters
<*>     SMSC LAN95XX based USB 2.0 10/100 ethernet devices"

Was that enough or is there more?


After I did this and modified the system-top.dts, I re-ran petalinux-build, and created a new BOOT.bin (petalinux-package).  I flashed the binary onto board, copied the new image.ub, and re-tried.  Is there that needs done?   Start-up script, etc.

JH

I think yes,
you can also check (2015.4)

  • demo\os\petalinux\subsystems\linux\configs\kernel\config
QuoteCONFIG_USB_NET_DRIVERS=y
# CONFIG_USB_CATC is not set
# CONFIG_USB_KAWETH is not set
# CONFIG_USB_PEGASUS is not set
# CONFIG_USB_RTL8150 is not set
# CONFIG_USB_RTL8152 is not set
CONFIG_USB_USBNET=y
CONFIG_USB_NET_AX8817X=y
CONFIG_USB_NET_AX88179_178A=y
CONFIG_USB_NET_CDCETHER=y
# CONFIG_USB_NET_CDC_EEM is not set
CONFIG_USB_NET_CDC_NCM=y
# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set
# CONFIG_USB_NET_CDC_MBIM is not set
# CONFIG_USB_NET_DM9601 is not set
# CONFIG_USB_NET_SR9700 is not set
# CONFIG_USB_NET_SR9800 is not set
# CONFIG_USB_NET_SMSC75XX is not set
CONFIG_USB_NET_SMSC95XX=y
# CONFIG_USB_NET_GL620A is not set
CONFIG_USB_NET_NET1080=y
# CONFIG_USB_NET_PLUSB is not set
# CONFIG_USB_NET_MCS7830 is not set
# CONFIG_USB_NET_RNDIS_HOST is not set
CONFIG_USB_NET_CDC_SUBSET=y
# CONFIG_USB_ALI_M5632 is not set
# CONFIG_USB_AN2720 is not set
CONFIG_USB_BELKIN=y
CONFIG_USB_ARMLINUX=y
# CONFIG_USB_EPSON2888 is not set
# CONFIG_USB_KC2190 is not set
CONFIG_USB_NET_ZAURUS=y
# CONFIG_USB_NET_CX82310_ETH is not set
# CONFIG_USB_NET_KALMIA is not set
# CONFIG_USB_NET_QMI_WWAN is not set
# CONFIG_USB_NET_INT51X1 is not set
# CONFIG_USB_IPHETH is not set
# CONFIG_USB_SIERRA_NET is not set
# CONFIG_USB_VL600 is not set

Newer Petalinux has other paths.
You can search for this parameter on petalinux config menu.
br
John

hjm142

So I took the entire "os" directory from "TE0726-rpi_hw_ips-vivado_2015.4-build_34_20160602111427.zip" and used that over top of anything I had tried before.  That includes the directory you mentioned earlier.

I then ran:
petalinux-config --get-hw-description=~/Xilinx/<project name>/<project name.sdk>

Then checked (but made no changes through)
petalinux-config
petalinux-config -c kernel

Then I ran petalinux-build then petalinux-package.  Re-burnt BOOT.bin.  Copied over the image.ub to the SD card.  Booted Linux, logged in as root through the UART, and still get the following:

root@zynq:~# ifconfig
lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:112 errors:0 dropped:0 overruns:0 frame:0
          TX packets:112 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:8936 (8.7 KiB)  TX bytes:8936 (8.7 KiB)

I am unclear what I am doing wrong.


hjm142

I made a mistake when I completed my last post.  I had not actually overwritten my petalinux files like I had thought.

So, I deleted my entire petalinux project and extracted the "os" directory from the previously mentioned zip.

I then ran:
petalinux-config --get-hw-description=~/Xilinx/<project name>/<project name.sdk>
petalinux-config  (changed BOOT.bin to run from flash instead of SD)
petalinux-config -c kernel (no changes)

petalinux-build gave errors because a lot of the things mentioned in the system-top.dts file were not implemented in my hardware.  So I deleted the lines about audio, I2C, and HDMI driver.   
Kept everything USB related.  RE-ran build and it complete without error.

Then created a new BOOT.bin, burnt the flash, copied over the image.ub, and restarted.  Still not seeing Ethernet...

hjm142

I am going to try with 2017.1 and see if I have different results.

JH

Hi,

change to 2017.1 is the better choice.

if you need not all designs components, i would recommend following proceed:
1. Generate Vivado Design with or Reference Design and export HDF
2. Generate Petalinux with our Template and your HDF
3. If everything work, delete unused  PL part, modify PS and  remove unused device tree setting and generate all files again.

br
John

hjm142

Thank you.  I have been able to get Ethernet to work after migrating to the 2017.1 tools.  It shows up in ifconfig and can ping out.  Now, I am working on my actual petalinux application.  The"hello world" works fine.  Is there any good code examples that implement Ethernet comms for this platform?


JH

Hi,

we have no sample code available at the moment.

br
John

Andrei Errapart

A petalinux application has access to the TCP/IP stack included in the Linux kernel. The basic interface consists of function calls socket(), listen(), connect(), read() and write().

Google search for the words TCP socket example or UDP socket example should get you quite far. The topic of network communications is quite extensively covered by the existing Unix/Linux reference works - books, textbooks, tutorials and HOWTO-s on the web and book stores.

However, if you'd describe your communication needs
* bandwidth
* latency
* error detection, correction and recovery?
* high-level? low-level?
* programming languages supported - C? C++? Python?
I could point you the direction to look for.