Helpful ReplyHot!TCP/IP stack correct configuration

Author
ffb.boy.30
Senior Member
  • Total Posts : 159
  • Reward points : 0
  • Joined: 2016/08/31 00:59:51
  • Location: 0
  • Status: offline
2018/03/10 01:30:57 (permalink)
0

TCP/IP stack correct configuration

Hi,
I'm using a LAN8720 board with my pic32MZ and sometime (random) the board crash and it is impossible to ping even if I unplug / plug the board. Maybe it is a configuration problem.
There is 20 boards  mounted on a big network with 150 computer. 
I'm using UDP protocol with 3 sockets.
Could you help me to resolve my problem , The board are installed and I don't find a solution to finalize the project.
 
Here is my MHC configuration I'm using XC1.44 and Harmony 2.05
On the network the address is fixed there is no DHCP and no access to an external network.
I only need UDP and ping to test the board.
 
Thanks you

Attached Image(s)

#1
maxruben
Super Member
  • Total Posts : 3292
  • Reward points : 0
  • Joined: 2011/02/22 03:35:11
  • Location: Sweden
  • Status: offline
Re: TCP/IP stack correct configuration 2018/03/10 01:56:30 (permalink)
0
Do you have a blinking LED? Does it stop blinking?
Do you have exception traps enabled? Do you end up in one of those?
How often do you allocate and open a UDP socket?
Does the crash happen more seldom if you increase number of max sockets?
Do you have an UART available for debugging (not sure this is included in the harmony stack)?
 
/Ruben
#2
ffb.boy.30
Senior Member
  • Total Posts : 159
  • Reward points : 0
  • Joined: 2016/08/31 00:59:51
  • Location: 0
  • Status: offline
Re: TCP/IP stack correct configuration 2018/03/10 03:16:10 (permalink)
0
Yes the Led blink but when it crash only the Orange Toggle (Link) the Green is off . it means
The LED2 output is driven active when
 the operating speed is 100Mbps. This LED will go inactive when the operating
speed is 10Mbps or during line isolation.
don't know why and don't understand what it means.
 
I don't active the exception trap I never use it before. I will look at it.
I open the the UDP port at startup and I read RxBuffer  at +-20khz and do this for each socket
 
        case APP_UDP_SERVING_CONNECTION:
       {
            if (!TCPIP_UDP_IsConnected(App_UDP_SPV.socket))
            {
                App_UDP_SPV.state = APP_UDP_CLOSING_CONNECTION;
                char buffChar[10];sprintf(buffChar,"\r\nCLS SPV");SendDebugBuffer(buffChar,9);
                break;
            }
            int16_t RxCpt,tmp;
            uint16_t i;
            RxCpt = TCPIP_UDP_GetIsReady(App_UDP_SPV.socket); // Get UDP RX FIFO byte count
            tmp = TCPIP_UDP_PutIsReady(App_UDP_SPV.socket);
            int rxed = TCPIP_UDP_ArrayGet(App_UDP_SPV.socket, app_UDP_RX_SPV_buf, RxCpt);
            if (RxCpt == 0)
            {
                break;
            }
            for(i = 0; i < RxCpt; i++)
            {
                UDP_SPV_Receive(app_UDP_RX_SPV_buf[i]);
            }
            //TCPIP_UDP_Discard(App_UDP_SPV.socket);
        }
        break;

I don't know if the number of socket increase the problem because it is random and I can't repeat it, and I need 3 socket for my application.
Yes of course I've a UART debug ,with this I can see that when the LAN8720 crash my program still working perfectly because I can make the same functions with the UART or the LAN.
 
Thanks you
#3
ffb.boy.30
Senior Member
  • Total Posts : 159
  • Reward points : 0
  • Joined: 2016/08/31 00:59:51
  • Location: 0
  • Status: offline
Re: TCP/IP stack correct configuration 2018/03/10 14:27:37 (permalink)
0
I look at the Internal Mac Driver and I found that I use LAN8740 instead LAN8720 maybe it is the problem.
I will test it asap.
 

Attached Image(s)

#4
RISC
Super Member
  • Total Posts : 5310
  • Reward points : 0
  • Status: offline
Re: TCP/IP stack correct configuration 2018/03/11 04:17:44 (permalink)
0
Hi,
You should better post this subject in the dedicated Harmony thread as it will gain more feedback ;=)
Even though LAN8740 is quite similar to LAN8720, you must use the LAN8720 driver as LAN8740 has features not existing in LAN8720.
Regards
 
#5
rainad
Super Member
  • Total Posts : 1031
  • Reward points : 0
  • Joined: 2009/05/01 13:39:25
  • Location: 0
  • Status: offline
Re: TCP/IP stack correct configuration 2018/03/12 10:04:40 (permalink)
0
Please give some details about the crash: in what routine does the crash occur (look at the EPC register). Does it always crash at that location or it changes?
Make sure that you have a serial console running on your board so we can try few debugging commands if needed. 
 
#6
ffb.boy.30
Senior Member
  • Total Posts : 159
  • Reward points : 0
  • Joined: 2016/08/31 00:59:51
  • Location: 0
  • Status: offline
Re: TCP/IP stack correct configuration 2018/03/12 10:26:07 (permalink)
0
Hi,
The crash is totally random, so it is really hard to create the problem.
How can I access to the EPC register ? I'm using harmony
#7
rainad
Super Member
  • Total Posts : 1031
  • Reward points : 0
  • Joined: 2009/05/01 13:39:25
  • Location: 0
  • Status: offline
Re: TCP/IP stack correct configuration 2018/03/12 11:15:26 (permalink)
0
EPC is a CPU register. Set breakpoints at EBASE and EBASE + 0x180 addresses - using the Execution memory window.
Once the execution stops there open the PIC32 registers window and get a snapshot of all the registers, EPC included. Then using the elf/listing file we can try to understand where and why the exception takes place.
#8
ffb.boy.30
Senior Member
  • Total Posts : 159
  • Reward points : 0
  • Joined: 2016/08/31 00:59:51
  • Location: 0
  • Status: offline
Re: TCP/IP stack correct configuration 2018/03/12 11:17:36 (permalink)
0
The problem don't come from the PIC because I can speak with him trought the serial port and everything is fine, only the ethernet is down.
#9
rainad
Super Member
  • Total Posts : 1031
  • Reward points : 0
  • Joined: 2009/05/01 13:39:25
  • Location: 0
  • Status: offline
Re: TCP/IP stack correct configuration 2018/03/12 13:01:41 (permalink)
0
You mentioned " the board crash ". So it's not really a crash.
Then from the console (make sure you enable the MIIM driver commands) dump the PHY registers and check if it reports any problem. Check the link status, IRQ, etc.
Also, see what the MAC is saying using "macinfo" and "netinfo".
 
 
#10
ffb.boy.30
Senior Member
  • Total Posts : 159
  • Reward points : 0
  • Joined: 2016/08/31 00:59:51
  • Location: 0
  • Status: offline
Re: TCP/IP stack correct configuration 2018/03/12 13:41:45 (permalink)
0
Sorry I was wpeaking about the LAN8720 PHY board.
I put the MIIM config in the screenshot.
I don't know how to do what you explain
dump the PHY registers and check if it reports any problem. Check the link status, IRQ, etc.
Also, see what the MAC is saying using "macinfo" and "netinfo".

Could you explain how to do that ?
 
Thanks
 

Attached Image(s)

#11
rainad
Super Member
  • Total Posts : 1031
  • Reward points : 0
  • Joined: 2009/05/01 13:39:25
  • Location: 0
  • Status: offline
Re: TCP/IP stack correct configuration 2018/03/12 13:50:47 (permalink) ☄ Helpfulby XorLor 2018/05/03 01:42:47
0
You need to check the "Enable MIIM Commands" box and then, from the console, use the MIIM commands to view the PHY registers.
"miim dump", "miim read rIx", etc.
Just type "miim" and it will display the list of options.
 
#12
ffb.boy.30
Senior Member
  • Total Posts : 159
  • Reward points : 0
  • Joined: 2016/08/31 00:59:51
  • Location: 0
  • Status: offline
Re: TCP/IP stack correct configuration 2018/03/13 22:32:31 (permalink)
0
The console is the usb ?
How do you activate it , never use the console before.
Thanks
post edited by ffb.boy.30 - 2018/03/14 05:20:37
#13
rainad
Super Member
  • Total Posts : 1031
  • Reward points : 0
  • Joined: 2009/05/01 13:39:25
  • Location: 0
  • Status: offline
Re: TCP/IP stack correct configuration 2018/03/14 08:54:53 (permalink)
0
Console could be serial/UART (preferred) or USB.
Once you have network connectivity to the board you could use telnet as well.
 
post edited by rainad - 2018/03/14 09:30:58
#14
purna k
New Member
  • Total Posts : 15
  • Reward points : 0
  • Joined: 2018/04/16 06:14:52
  • Location: 0
  • Status: offline
Re: TCP/IP stack correct configuration 2018/04/16 21:20:58 (permalink)
0
Hi.. can any one attach the tcp ip demo code for pic32 ethernet start kit2.
 
Thank you
#15
Jump to:
© 2018 APG vNext Commercial Version 4.5