Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12600 Discussions

Igor Mac, DP83848 and tcpdump

Altera_Forum
Honored Contributor II
1,175 Views

Hi all, 

 

could you somebody advice me with my problem ?  

I have design (in attachement) - NIOS2, SDRAM, ethernet (igor mac) with zImage and when i boot kernel and use ifconfig eth0 192.168.2.2 and use ping, it is ok. 

But when i ping to my pc (ping 192.168.2.200) it finished with 100% loss packet and NIOS2 dont read data ok - when i read ifconfig statistics - all reading packet are dropped. In wireshark i read arp packet, pc answer, but uclinux send again arp packet, because dont read packet well and try it again. 

Setting of dp83848 looks ok - the same like in development kit, where it works. 

When i see this on oscilloscope, it looks ok. Where could be error ? on design or on the board ?  

Does anybody build tcpdump or some another tool for reading arp packet ?  

 

Thank you very much. 

 

Jan Naceradsky, Czech Republic
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
361 Views

You can build tcpdump for Nios II. It's included in uClinux-dist. You can (may need to) update it to the latest version by extracting the source in user/tcpdump/tcpdump-4.x.x and changing the Makefile to point to that version.

0 Kudos
Altera_Forum
Honored Contributor II
361 Views

When i turn on  

[*] tcpdump and use make, it finished with these mesagges: 

 

make[1]: Leaving directory `/home/uclinux/nios2-linux/linux-2.6' 

if [ -f /home/uclinux/nios2-linux/uClinux-dist/linux-2.6.x/vmlinux ]; then  

ln -f /home/uclinux/nios2-linux/uClinux-dist/linux-2.6.x/vmlinux /home/uclinux/nios2-linux/uClinux-dist/linux-2.6.x/linux ;  

fi 

. /home/uclinux/nios2-linux/uClinux-dist/linux-2.6.x/.config; if [ "$CONFIG_MODULES" = "y" ]; then  

[ -d /home/uclinux/nios2-linux/uClinux-dist/linux-2.6.x/modules ] || mkdir /home/uclinux/nios2-linux/uClinux-dist/linux-2.6.x/modules;  

make ARCH=nios2 CROSS_COMPILE=nios2-linux-uclibc- -C /home/uclinux/nios2-linux/uClinux-dist/../linux-2.6 O=/home/uclinux/nios2-linux/uClinux-dist/linux-2.6.x modules;  

fi 

for dir in lib user ; do [ ! -d $dir ] || make ARCH=nios2 -C $dir || exit 1 ; done 

make[1]: Entering directory `/home/uclinux/nios2-linux/uClinux-dist/lib' 

[ -z "" ] || make -j1 || exit $? 

[ -z "" ] || (cd /home/uclinux/nios2-linux/uClinux-dist/staging; chmod 755 ./usr/lib/lib*.so*; chmod 644 ./usr/lib/lib*.la ./usr/lib/lib*.a; sed -i -e "/^libdir=/s:=.*:='/home/uclinux/nios2-linux/uClinux-dist/staging/usr/lib':" -e "/^dependency_libs=/s: /usr/lib/: /home/uclinux/nios2-linux/uClinux-dist/staging/usr/lib/:g" ./usr/lib/*.la; sed -i "/^prefix=/s:=.*:='/home/uclinux/nios2-linux/uClinux-dist/staging/usr':" ./usr/lib/pkgconfig/*.pc ./usr/bin/*-config; true) 

[ -z "" ] || make -j1 || exit $? 

[ -z "" ] || (cd /home/uclinux/nios2-linux/uClinux-dist/staging; chmod 755 ./usr/lib/lib*.so*; chmod 644 ./usr/lib/lib*.la ./usr/lib/lib*.a; sed -i -e "/^libdir=/s:=.*:='/home/uclinux/nios2-linux/uClinux-dist/staging/usr/lib':" -e "/^dependency_libs=/s: /usr/lib/: /home/uclinux/nios2-linux/uClinux-dist/staging/usr/lib/:g" ./usr/lib/*.la; sed -i "/^prefix=/s:=.*:='/home/uclinux/nios2-linux/uClinux-dist/staging/usr':" ./usr/lib/pkgconfig/*.pc ./usr/bin/*-config; true) 

[ -z "libpcap" ] || make -j1 libpcap || exit $? 

make[2]: Entering directory `/home/uclinux/nios2-linux/uClinux-dist/lib' 

[ ! -d "libpcap" ] || ( touch libpcap/.sgbuilt_lib && make -C libpcap ) || exit $? 

make[3]: Entering directory `/home/uclinux/nios2-linux/uClinux-dist/lib/libpcap' 

make -C build 

make[4]: Entering directory `/home/uclinux/nios2-linux/uClinux-dist/lib/libpcap/build' 

nios2-linux-uclibc-gcc -O2 -O2 -g -fno-builtin -I. -I.. -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -c ../pcap-linux.c 

In file included from ../pcap-linux.c:78: 

./config.h:189:28: linux/autoconf.h: No such file or directory 

./config.h:190:29: config/autoconf.h: No such file or directory 

../pcap-linux.c: In function `pcap_open_live': 

../pcap-linux.c:274: error: structure has no member named `timeout' 

../pcap-linux.c:336: error: structure has no member named `sock_packet' 

../pcap-linux.c: In function `pcap_read_packet': 

../pcap-linux.c:474: error: structure has no member named `cooked' 

../pcap-linux.c:522: error: structure has no member named `sock_packet' 

../pcap-linux.c:536: error: structure has no member named `lo_ifindex' 

../pcap-linux.c:559: error: structure has no member named `cooked' 

../pcap-linux.c: In function `pcap_inject_linux': 

../pcap-linux.c:716: error: structure has no member named `sock_packet' 

../pcap-linux.c:718: error: structure has no member named `ifindex' 

../pcap-linux.c:728: error: structure has no member named `cooked' 

../pcap-linux.c: In function `pcap_setdirection_linux': 

../pcap-linux.c:1023: error: structure has no member named `sock_packet' 

../pcap-linux.c: In function `live_open_new': 

../pcap-linux.c:1384: error: structure has no member named `sock_packet' 

../pcap-linux.c:1397: error: structure has no member named `lo_ifindex' 

../pcap-linux.c:1412: error: structure has no member named `cooked' 

../pcap-linux.c:1449: error: structure has no member named `cooked' 

../pcap-linux.c:1484: error: structure has no member named `ifindex' 

../pcap-linux.c:1485: error: structure has no member named `ifindex' 

../pcap-linux.c:1488: error: structure has no member named `ifindex' 

../pcap-linux.c:1498: error: structure has no member named `cooked' 

../pcap-linux.c:1510: error: structure has no member named `ifindex' 

../pcap-linux.c:1534: error: structure has no member named `ifindex' 

../pcap-linux.c: In function `pcap_close_linux': 

../pcap-linux.c:1675: error: structure has no member named `clear_promisc' 

../pcap-linux.c:1715: error: structure has no member named `next' 

../pcap-linux.c:1724: error: structure has no member named `next' 

../pcap-linux.c:1729: error: structure has no member named `next' 

../pcap-linux.c:1729: error: structure has no member named `next' 

../pcap-linux.c: In function `live_open_old': 

../pcap-linux.c:1765: error: structure has no member named `sock_packet' 

../pcap-linux.c:1768: error: structure has no member named `cooked' 

../pcap-linux.c:1843: error: structure has no member named `clear_promisc' 

../pcap-linux.c:1849: error: structure has no member named `next' 

../pcap-linux.c: In function `fix_program': 

../pcap-linux.c:2022: error: structure has no member named `cooked' 

make[4]: *** [pcap-linux.o] Error 1 

make[4]: Leaving directory `/home/uclinux/nios2-linux/uClinux-dist/lib/libpcap/build' 

make[3]: *** [all] Error 2 

make[3]: Leaving directory `/home/uclinux/nios2-linux/uClinux-dist/lib/libpcap' 

make[2]: *** [libpcap] Error 2 

make[2]: Leaving directory `/home/uclinux/nios2-linux/uClinux-dist/lib' 

make[1]: *** [all] Error 2 

make[1]: Leaving directory `/home/uclinux/nios2-linux/uClinux-dist/lib' 

make: *** [subdirs] Error 1 

 

But the main question is - if i have error on design - sopc builder or schematic design in Quartus ... or is there any errors on the board - with DP83848 etc. ?  

 

Thanks for your opinions. 

 

Jan
0 Kudos
Altera_Forum
Honored Contributor II
361 Views

If you mean the compile error -- it's not related to the FPGA/SOPC design. You should be able to build any of the user applications and libraries regardless of of the FPGA design. 

 

If you mean your actual problem -- yes it's very likely it's the design, but if you are not using the latest version from Linux "nios2" branch then it could likely also be the software. I don't know anything about the Igor MAC though.
0 Kudos
Altera_Forum
Honored Contributor II
361 Views

Thank you, 

but yesterday I finally found the error - it was in SOPC builder in Open Cores 10/100 Ethernet MAC Avalon - Igor Mac, which has 3 parameters: 

Total descriptors: 128 

TX Fifo size in bytes: 128 

RX Fifo size in bytes: 4096 

 

It must be 4096, when it was 128, data was not read.  

 

Although i didn´t make tcpdump, i change open_eth.c to debug mode and in this mode the kernel print RX and TX data from/to ethernet chip. (in attachment)
0 Kudos
Altera_Forum
Honored Contributor II
361 Views

Driver for igor_mac with debug print.

0 Kudos
Reply