Ethernet issue at powerup

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Ethernet issue at powerup

跳至解决方案
4,210 次查看
rajani_kolani
Contributor III

Hi,

   I have an issue with the sdk example for mimxrt1060-EVK board. The lwip example project (evkmimxrt1060_lwip_httpsrv_freertos) doesn't work after powerup. It works fine after a hardware or software reset. 

I have connected an eval board to my laptop directly and assigned an IP address to the PC to match the IP mask as per the project. When I powerup the board with USB cable(from PC) the webserver doesn't work. It doesn't reply to a ping request also! But if I press the reset button, it works fine. (Both the webserver and the ping requests!) In both cases, it does print the debug as below

Initializing PHY...
************************************************
 HTTP Server example
************************************************
 IPv4 Address     : 192.168.0.102
 IPv4 Subnet mask : 255.255.255.0
 IPv4 Gateway     : 192.168.0.100
 mDNS hostname    : lwip-http
************************************************

Could you please see if you can replicate this issue on your side? 

Thanks & regards,

Rajani

标签 (1)
0 项奖励
回复
1 解答
4,111 次查看
rajani_kolani
Contributor III

Hi Mark,

     I added a PHY status polling thread to monitor the Link down and up status and then updated the speed of the ENET using ENET_SetMII() function and my problem is resolved. I anyway needed this thread to make the system detect the LAN connection while application is running. 

Thanks & Regards,

Rajani

  

在原帖中查看解决方案

0 项奖励
回复
10 回复数
4,174 次查看
mjbcswitzerland
Specialist V

Hi Rajani

That means that you have the same issue on both boards and tests can be made on the EVB to identify the problem.

Therefore I will go back to my initial suggestion and have attached a binary that you can load to your EVB to see whether there is a difference or not. If there is a difference it may be possible to use it as reference to solve the issue and if you can also find problems I can then look at it on my board directly.

1. Set the DIP switches to SW7-4 ON only and reset the board. The board is now in programming mode.
2. Drag and drop the attached (after extracting the binary file) to the board, which appears as hard drive. It takes about 30s to load.
3. Set the DIP switch back to SW7-3 ON only and reset the board to run the code.
4. On the VCOM debug interface (LPUART) at 115kBaud you have a menu. Enter the LAN menu with the command '1' (+ ENTER) and check the IP settings - I set it as default to match your case I think. If not it can be changed and saved using the commands.


Hello, world... MIMXRT1060 [Software 1]
Static memory = 0x00000960
OS Heap use = 0x3700 from 0xc000
Initial stack margin 0x0005b4ec
FlexRAM:
3 Code banks [0x00000000..0x00017fff]
13 Data banks [0x20000000..0x20067fff]
SPI Flash: ISSI 8MByte IS25LP032A
uFileSystem integrity
Start: 0x600a0000
Granularity: 0x0001c000
End: 0x607d3fff
OK

Serial number: 05-00
Software version V1.4.012
Device identification: uTasker Number 1

Main menu
===================
1 Configure LAN interface
2 Configure serial interface
3 Go to I/O menu
4 Go to administration menu
5 Go to overview/statistics menu
6 Go to USB menu
7 Go to I2C menu
8 Go to utFAT disk interface
9 FTP/TELNET/MQTT client commands
a CAN commands
help Display menu specific help
quit Leave command mode
1


LAN configuration
===================
up go to main menu
phy Dump PHY registers
set_phy <reg> <val>
ipstat Show Ethernet statistics
r_ipstat Reset Ethernet statistics
set_dhcp <enable/disable> DHCP
set_ip_add Set IPV4 address
set_ip_mask Set IP subnet mask
set_ip_gway Set default gateway
set_ip_dns Set default DNS
set_eth_speed Set LAN speed (10/100/AUTO)
show_config Show network configuration
show_config_o Show original network configuration
save Save configuration to FLASH
validate Validate temporary config. in FLASH
ping Ping IPv4 addr [cnt]/i (infinite)}
ping? Ping status
arp -a Request ARP table
arp -d Delete ARP table
prime Prime IP
multi <ip> send test frame
help Display menu specific help
quit Leave command mode

#show_config

IPV4 address = 192.168.1.3
MAC address = 00-00-00-00-00-05
Subnet mask = 255.255.255.0
Default gateway = 192.168.1.1
DNS server = 192.168.0.100
LAN speed AUTO
DHCP_SERVER - disabled


With the PHY commands you can also read the PHY registers and modify them for experimentation if required.

 

When you remove and plug the Ethernet cable you will see link up/down with details:

 
 

Eth0 link-up 100 full-duplex
Eth0 link-down
Eth0 link-up 100 full-duplex

Also you can command fixed link speeds in the LAN menu and save them, etc.

You can ping the board (or ping other devices from the board with its own ping command) or browse to its web server or connect to its FTP server or control the same command line menu via Telnet.

Then you can test various reset cases and power cycles to see whether you can find a combination causing problems. (In the Administration menu you can command software resets or test watchdog resets too).

You can also command the board to its boot loader mode to update new applications (it support serial loading and Over-The-Air updates and all code is encrypted).

See whether this helps to find a reference for comparisons.

Good luck

Regards

Mark
uTasker project developer for Kinetis and i.MX RT]
Contact me by personal message or on the uTasker web site to discuss professional training or product development requirements

 

 

 

 

4,128 次查看
rajani_kolani
Contributor III

Hi Mark,

    Thanks for the bin file. I have downloaded it and as you described I can see the LAN configurations.

I noticed that when I connect Ethernet cable it prints

Eth0 link-up 10 full-duplex

Eth0 link-down

Eth0 link-up 100 full-duplex

Are you resetting the PHY chip at the first instance? Why it has a link-down after a link up? This is the issue I noticed and you may have the same issue, but as you are resetting it, it goes to a link-down and link-up to recover it?

Thanks & Regards,

Rajani

0 项奖励
回复
4,120 次查看
mjbcswitzerland
Specialist V

Rajani

I don't have a link down on connection (on my network) - these messages are controlled by status changes reported by the PHY and no resets are being commanded. It may therefore be a characteristic of the network that you are connecting to. The PHY is set to work in auto-negotiation mode by default but you can also command and save fixed modes in the LAN menu ("save" commits settings so that they are retained across resets and power cycles)

The question is when you have the link up stable can you always communicate with the board, irrespective of the reset/power up method?

Maybe your firmware uses only the initial LAN configuration and doesn't adapt itself to changes that can take place during operation (?) - note that when the PHY's auto-negotiation state changes it is important that the Ethernet controller is also reconfigured to match it otherwise it won't work if the speeds don't match (if RMII is used) or data can be lost if the collision setting (duplex/semi-duplex) is not set correctly.

Regards

Mark
uTasker project developer for Kinetis and i.MX RT]
I can be contacted by personal message or on the uTasker web site to discuss professional training or product development requirements, to accelerate progress or to solve technical problems

0 项奖励
回复
4,112 次查看
rajani_kolani
Contributor III

Hi Mark,

     I added a PHY status polling thread to monitor the Link down and up status and then updated the speed of the ENET using ENET_SetMII() function and my problem is resolved. I anyway needed this thread to make the system detect the LAN connection while application is running. 

Thanks & Regards,

Rajani

  

0 项奖励
回复
4,106 次查看
mjbcswitzerland
Specialist V

Hi Rajani

That is good news.

I hope that having the reference was useful to finding the shortcomings of the original reference and could save your project some time and development costs.

Regards

Mark

0 项奖励
回复
4,205 次查看
rajani_kolani
Contributor III

Sorry, on my custom board i use J-Link and on the eval board I use  CMSIS-DAP LinkServer.

0 项奖励
回复
4,206 次查看
rajani_kolani
Contributor III

Hi Mark,
I am using MCUXpresso and Segger J-Link to compile and download the SDK example. I didn’t understand what you mean by binaries at this utasker page!
I have this problem in our custom board, where I have used the same lwip library/source files. That’s why I came back to the eval board to check if it is a hardware issue or software!
I can reproduce this issue using the sdk example code, which doesn’t use LED in this example!

I have investigated it further and can see that during this issue, the autonegotiation returns 10mbps. When I reset the board, the autonegotiation is returning 100mbps! 

 

Thanks & regards,
Rajani

0 项奖励
回复
4,203 次查看
mjbcswitzerland
Specialist V

Hi Rajani

You didn't give any information that you have the problem on a custom board - you only mentioned the EVB.

It is still not clear whether you have the problem only on your custom board or also on the EVB. I gave you a link to a binary file that can be loaded to the EVB with drag and drop on its CMSIS-DAP debug interface to see whether it has the same behavior or not.

Regards

Mark
uTasker project developer for Kinetis and i.MX RT]
Contact me by personal message or on the uTasker web site to discuss professional training or product development requirements

0 项奖励
回复
4,189 次查看
rajani_kolani
Contributor III

Hi Mark,

   The reason why I didn't mention about our custom board is because usually you don't support any modification to hardware or software, also I can not share my custom board schematics and software. That's why I went back to the SDK example I based my webserver software to replicate the issue. So we have this issue on both boards. In my custom board, I am not sharing ethernet reset line. 

We noticed that this issue happens only when we connect the ethernet directly to the PC's RJ45 port. If we go through a USB to Ethernet Adapter it doesn't behave like this. During powerup, the PHY is returning with Link active and 10mbps full duplex, and then stops receiving any ethernet interrupts! After a reset it gets 100mbps on auto negotiation. Also, if I force the PC's ethernet speed to 10mbps, it works fine. 

 

Thanks & Regards,

Rajani

0 项奖励
回复
4,208 次查看
mjbcswitzerland
Specialist V

Hi

See whether the binaries for your board here have the same issue? https://www.utasker.com/iMX/RT1060.html

I believe that one problem with the board is that the strap inputs on the PHY are not well defined and so the PHY can start up in electrically isolated mode (it communicates but is physically isolated from the MII bus).

Check where code is reading and configuring the PHY control register 0. Read the value and see whether the isolation bit is set (0x0400) is set. Clear this bit and rewrite it back.

Beware that on this board the USER LED is also connected to the PHY reset line so if Ethernet is used you have to avoid using the USER LED and keep it as input otherwise it causes Ethernet to fail.

Regards

Mark
uTasker project developer for Kinetis and i.MX RT]
Contact me by personal message or on the uTasker web site to discuss professional training or product development requirements