Delay in web page loading on v1.4.2

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

Delay in web page loading on v1.4.2

vinu
Hi all,

I am having issue in loading web page using netconn APIs in LWIP v1.4.2 on
FreeRTOS.

Earlier the issue was not there when we where running the MCU at 12MHz
clock. But once we switched to 120MHz, we are noticing random page loading
issues.

After few days of debugging  the stack, we found that the messages are
actually received at the TCP layer, but not received by the application
layer.

We have found that the request reaches the point *TCP_EVENT_RECV(pcb,
recv_data, ERR_OK, err);* in file tcp_in.c (added debug prints and
confirmed) - PFA image_1.
 Sometimes the packet reaches netconn_recv mailbox after a delay and
sometimes the packets never reach. I'm attaching the wireshark capture of
this issue. See packet no 92. login_page_issue.pcapng
<http://lwip.100.n7.nabble.com/file/t2163/login_page_issue.pcapng>  

<http://lwip.100.n7.nabble.com/file/t2163/Screenshot_%2828%29.png>

Please help.

regards,
Vinu






--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Delay in web page loading on v1.4.2

vinu
Anybody please give some insight into debugging this issue .. we have been
blocked for weeks.

regards,
Vinu



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Delay in web page loading on v1.4.2

Mario Luzeiro
Hi Vinu,
could you provide more details, configuration, webpage loading waterfall, wireshark,etc ?

I have some issues with page loading too because browsers are throwing multiple parallel connections at same time.

Mario Luzeiro

________________________________________
From: lwip-users <lwip-users-bounces+mrluzeiro=[hidden email]> on behalf of vinu <[hidden email]>
Sent: 28 October 2019 06:04
To: [hidden email]
Subject: Re: [lwip-users] Delay in web page loading on v1.4.2

Anybody please give some insight into debugging this issue .. we have been
blocked for weeks.

regards,
Vinu



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Delay in web page loading on v1.4.2

Trampas Stern
In reply to this post by vinu
What processor are you using? 

I had a problem with slow delay loading and found that the Atmel's example driver for the GMAC was using DMA to transfer data and then polling the SRAM DMA location to see when transfer was done. The issue was that if I turned the data cache on in the processor it would cache the SRAM data and then cause weird slow or non responsive behavior.   For the moment I have data cache off but will have to rewrite the drivers to use interrupts eventually. 

Trampas

On Thu, Oct 24, 2019 at 3:08 PM vinu <[hidden email]> wrote:
Hi all,

I am having issue in loading web page using netconn APIs in LWIP v1.4.2 on
FreeRTOS.

Earlier the issue was not there when we where running the MCU at 12MHz
clock. But once we switched to 120MHz, we are noticing random page loading
issues.

After few days of debugging  the stack, we found that the messages are
actually received at the TCP layer, but not received by the application
layer.

We have found that the request reaches the point *TCP_EVENT_RECV(pcb,
recv_data, ERR_OK, err);* in file tcp_in.c (added debug prints and
confirmed) - PFA image_1.
 Sometimes the packet reaches netconn_recv mailbox after a delay and
sometimes the packets never reach. I'm attaching the wireshark capture of
this issue. See packet no 92. login_page_issue.pcapng
<http://lwip.100.n7.nabble.com/file/t2163/login_page_issue.pcapng

<http://lwip.100.n7.nabble.com/file/t2163/Screenshot_%2828%29.png>

Please help.

regards,
Vinu






--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Delay in web page loading on v1.4.2

Mario Luzeiro
I had a similar issue with DMA and DeviceDrivers but it was on ST. The ST DMA driver was not flushing properly the data.

________________________________________
From: lwip-users <lwip-users-bounces+mrluzeiro=[hidden email]> on behalf of Trampas Stern <[hidden email]>
Sent: 28 October 2019 12:03
To: Mailing list for lwIP users
Subject: Re: [lwip-users] Delay in web page loading on v1.4.2

What processor are you using?

I had a problem with slow delay loading and found that the Atmel's example driver for the GMAC was using DMA to transfer data and then polling the SRAM DMA location to see when transfer was done. The issue was that if I turned the data cache on in the processor it would cache the SRAM data and then cause weird slow or non responsive behavior.   For the moment I have data cache off but will have to rewrite the drivers to use interrupts eventually.

Trampas

On Thu, Oct 24, 2019 at 3:08 PM vinu <[hidden email]<mailto:[hidden email]>> wrote:
Hi all,

I am having issue in loading web page using netconn APIs in LWIP v1.4.2 on
FreeRTOS.

Earlier the issue was not there when we where running the MCU at 12MHz
clock. But once we switched to 120MHz, we are noticing random page loading
issues.

After few days of debugging  the stack, we found that the messages are
actually received at the TCP layer, but not received by the application
layer.

We have found that the request reaches the point *TCP_EVENT_RECV(pcb,
recv_data, ERR_OK, err);* in file tcp_in.c (added debug prints and
confirmed) - PFA image_1.
 Sometimes the packet reaches netconn_recv mailbox after a delay and
sometimes the packets never reach. I'm attaching the wireshark capture of
this issue. See packet no 92. login_page_issue.pcapng
<http://lwip.100.n7.nabble.com/file/t2163/login_page_issue.pcapng>

<http://lwip.100.n7.nabble.com/file/t2163/Screenshot_%2828%29.png>

Please help.

regards,
Vinu






--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]<mailto:[hidden email]>
https://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Delay in web page loading on v1.4.2

vinu
In reply to this post by Mario Luzeiro
Hi Mario,

We are using a single threaded web server. The wireshark capture is already
attached in the first mail.
<http://lwip.100.n7.nabble.com/file/t2163/login_page_issue.pcapng>  

Please see the lwip configuration below -
lwip_opts.txt <http://lwip.100.n7.nabble.com/file/t2163/lwip_opts.txt>  

We assume that the request shall be received by the application mailbox once
the below statement is executed -

 /* Notify application that data has been received. */
*TCP_EVENT_RECV(pcb, recv_data, ERR_OK, err);*
We could see a *sys_mbox_trypost() * , but the mailbox handle is different
from the application mailbox handle.

However, when the issue occurs we find that the request is received
immediately after executing the below statement, but only after a delay of
10 seconds to 1 minute.

*TCP_EVENT_CLOSED(pcb, err);*




--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Delay in web page loading on v1.4.2

vinu
In reply to this post by Mario Luzeiro
I am using Atmel ATSAME53 along with the GMAC driver generated from Atmel
Start.



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Delay in web page loading on v1.4.2

PramodAtmel
Are you seeing this issue only when the core working at 120Mhz and not in
12MHz?



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Delay in web page loading on v1.4.2

Trampas Stern
So the Cortex M4 processor has an internal cache see the CMCC peripheral in the datasheet. 
Try in your main code to disable the cache:
CMCC->CTRL.bit.CEN=0;

Then run your code and see if it works. 

Again Atmel writes all their drivers with the cache turned off and if you turn on you are on your own...   If you want to argue with the tech-less support about this please do, I have given up.   Also check that the registers for the GMAC are defined correctly in the include files.  The SAME70 had some of the GMAC register addresses wrong and I had to fix them before it would work.  Took weeks before Microchip tech-less support would acknowledge their error, they kept saying the datasheets were wrong... 

If the code runs better with cache off then it is time to review the drivers and address issues.  I had to do this with the SAMD51 chip and flash driver, specifically after writing to flash it would read as being incorrect because the cache was caching the old data.   

If you need help beyond this you can contact me off list. 

Trampas


On Tue, Oct 29, 2019 at 10:19 AM PramodAtmel <[hidden email]> wrote:
Are you seeing this issue only when the core working at 120Mhz and not in
12MHz?



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Delay in web page loading on v1.4.2

vinu
In reply to this post by PramodAtmel
I am seeing issue forboth 12Mhz and 120Mhz. The issue seems to be not
frequency related.



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Delay in web page loading on v1.4.2

Trampas Stern
So the Cortex M4 processor has an internal cache see the CMCC peripheral in the datasheet. 
Try in your main code to disable the cache:
CMCC->CTRL.bit.CEN=0;

Then run your code and see if it works. 

Trampas

On Mon, Nov 4, 2019 at 1:20 AM vinu <[hidden email]> wrote:
I am seeing issue forboth 12Mhz and 120Mhz. The issue seems to be not
frequency related.



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Delay in web page loading on v1.4.2

vinu
Hi Trampas,

I tried disabling cache, but the issue is still there. Let me check if its
getting enabled from some other place in any other way.
Thanks!



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Delay in web page loading on v1.4.2

Trampas Stern
vinu,

Can you share your code? 

I am using the SAME70 (which is a bit different than the E51) and have the lwip working and might be able to help.  My email is my first name at gmail.com

Trampas

On Tue, Nov 5, 2019 at 4:01 AM vinu <[hidden email]> wrote:
Hi Trampas,

I tried disabling cache, but the issue is still there. Let me check if its
getting enabled from some other place in any other way.
Thanks!



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Delay in web page loading on v1.4.2

vinu
Sorry Trampas, i cant share my codebase, but can send you the config files or
snippets.  
Another finding is that when i enable the debug prints of the stack, i dont
see the issue. I guess its something related to timing.



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Delay in web page loading on v1.4.2

Trampas Stern
I have found weird things like that is often the cache.  Put a break point in the code where you are checking  if the packet has been received in the GMAC and see if the cache is enabled.  It most likely is.

When you do the debug prints it has to load data from other memory locations which can force the cache to be flushed on the GMAC DMA buffer and then things seem to magically work.   

Trampas
 

On Wed, Nov 6, 2019 at 8:42 AM vinu <[hidden email]> wrote:
Sorry Trampas, i cant share my codebase, but can send you the config files or
snippets. 
Another finding is that when i enable the debug prints of the stack, i dont
see the issue. I guess its something related to timing.



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Delay in web page loading on v1.4.2

vinu

We found that the issue was only occuring when the browser used is chrome
and not evident while testing with Firefox browser or wget from a linux pc.

Also we were using netconn_listen() for web server. Note that our webserver
is single threaded. Once we replaced it with netconn_listen_with_backlog(
serverConn, 1 ), the issue was not evident. However the page loading was
pretty slow.

TCP_DEFAULT_LISTEN_BACKLOG is set to 0XFF. Still debugging . . .

Vinu




--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Delay in web page loading on v1.4.2

goldsimon@gmx.de


Am 7. November 2019 11:06:07 MEZ schrieb vinu <[hidden email]>:
>
>We found that the issue was only occuring when the browser used is
>chrome
>and not evident while testing with Firefox browser or wget from a linux
>pc.

The problem might be the number of parallel connectionss then?

Regards,
Simon

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Delay in web page loading on v1.4.2

Trampas Stern
I had to increase number of TCP connections as well.  Chrome will do several connections to speed up web page loading, not that it does on embedded devices... 

Trampas

On Thu, Nov 7, 2019 at 6:13 AM goldsimon <[hidden email]> wrote:


Am 7. November 2019 11:06:07 MEZ schrieb vinu <[hidden email]>:
>
>We found that the issue was only occuring when the browser used is
>chrome
>and not evident while testing with Firefox browser or wget from a linux
>pc.

The problem might be the number of parallel connectionss then?

Regards,
Simon

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users