Hey everyone. I was working with the ping app in imx6 platform sdk recently, And i found it didn't work well.
Our board design is based on SABRE SDB, and it can successfully ping out with uboot/linux/android.It seems the hardware is not the problem.
I already found some bugs and fixed some of them.
1) sys_now() in sys_arch.c always returns 0 due to invalid data format transfer. Function time_get_microseconds() returns 64bit value while sys_now() returns 32bit value. I tried to pick only the lower 32bit to sys_now(), and the time value then became valid.
2)The target IP is fixed in line 240, ping_main.c
Here is the problem, after i fixed the bugs, it still won't wrok.
First, I used the default dhcp_start() to get netwrok parameters, it failed to acquire the dhcp server, and the debug output is "dhcp_discover(): set request timeout xxx msecs".
Then i tried to fix the network parameters in the code, and this time the network was up. But when i typein a hostname, it always failed to resolve the hostname. I am quite sure the dns server is reachable(22.214.171.124), and the hostname is valid(www.google.com.hk).
And then i modified the code to make it compatible with raw ip input. After entering an valid ip, the debug output showed it sent out 1 ping packet and got no answer from the target. But when i lisented the ICMP packet on the target ip, i got nothing.
After the sys_now() bug is fixed, it seems the tcp/ip stack is working, but it gets no answer from the phy.My guess is there is some bug in the phy driver of the sdk. However, the readout phy ID is correct and it can detect the link is up or down, which means the driver can read correctlly.
I was stucked in this problem for almost a week, please help! Thank you.
Here is the sys_now() i used now:
And the pt of time_get_microseconds_32: