Lwip stack gets hanged in netconn_recv api

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lwip stack gets hanged in netconn_recv api

Jump to solution
9,065 Views
rak14
Contributor III

I'm sending continuous data packets from PC client to S32k148 uC server, after some point the netconn_recv gets hanged and doesn't come out of loop.

I've sent the packets from client but noe received in server.

What's the problem here and how can it be solved?

Thanks in advance..

 

0 Kudos
Reply
1 Solution
6,198 Views
rak14
Contributor III

Hi @Nhi_Nguyen ,

Thanks for sharing the source code we'll test it and get back to you.

I enabled the DHCP as it's needed for our project initially ut assigns a IP from DHCP server, ping also works but after sometime it's showing request timeout and the destination host unreachable.

What might be the reason and how to resolve this?

Thanks & regards

Rak

View solution in original post

0 Kudos
Reply
38 Replies
5,877 Views
Nhi_Nguyen
NXP Employee
NXP Employee

Hi rak14,

This is response from SW team:

"As I understood the customer is sending continuous data packets, while doing this after some time the packets are getting lost.

The issue was reproduced on the reported software version S32K1 SDK3.0.2 by sending messages every 100 ms, the TCP server stopped receiving messages. It looks like there is no indication of a new message from the enet driver.

Solutions and recommendations for the customer:

  1. Integrate latest version of TCPIP, RTD and FreeRTOS for which this issue was already solved.
    • S32K1 RTD RTM 1.0.1
    • S32K1 FreeRTOS 1.0.1
    • S32K1 TCPIP 1.0.1

 

If integration of the latest software package is not possible please try the following:

  1. Increase the RX/TX buffer size from 4 to 10 from enetif.h file

#define ENET_RXBD_NUM       4

#define ENET_TXBD_NUM       4

  1. If the use-case allows start send messages every ~250 ms or slower in order to allow processing time for the tcp server."

Best regards,

Nhi

 

0 Kudos
Reply
5,863 Views
rak14
Contributor III

Hi @Nhi_Nguyen ,

Thanks for the update.

1. We tried increasing the ENET_RXBD_NUMENET_TXBD_NUM to 10 sent the data every 500ms but still it's not working.

2. Currently we are using:

  • RTM Version:  v3.0.0
  • FreeRTOS:  v10.0.1
  • LWIP stack: stable v2.0.2
  • TCP/IP stack:  v3.0.2Which version needs to install to make this work, and Can I get the links for the same?

    Also, can I know what's the reason the TCP server is unable to receive the data?

Thanks & regards,

Rak**bleep**h 

0 Kudos
Reply
5,856 Views
Nhi_Nguyen
NXP Employee
NXP Employee

Hi Rak14,

This is from SW team

"

RTD Standard software can be downloaded from here: https://www.nxp.com/webapp/swlicensing/sso/downloadSoftware.sp?catid=SW32K1-RTD44-D

Reference software can be downloaded from here: https://www.nxp.com/webapp/swlicensing/sso/downloadSoftware.sp?catid=SW32K1-REFSW-D

Please follow the documentation for installation details.

The issue how it has been diagnosed so far comes from the low level driver, and I could not continue with the analysis."

How did you configure Clock for TX_CLK and RX_CLK? and Port?

Nhi_Nguyen_0-1692610398147.png

 

Did you try to measure signal at TX_CLK and RX_CLK? you're configuring MII 100 Mbps, so 2 these signals need to provide from external clock source is 25MHz.

Because ETH driver didn't receive message, so did you try to measure signal on both 4 Tx and RX data pins when you transmit/receive message to avoid interrupt by configuring or signal on board?

Best rehards,

Nhi

 

0 Kudos
Reply
5,789 Views
rak14
Contributor III

Hi,


We are giving the Clock to the TX_CLK & TR_CLK from PHY (to the PHY from external crystal) with 25MHz clock for MII 100Mbps mode.

We can't measure the signals of 4 TX & RX pins when it hangs right? Because we'll be not knowing when it will hangs.

Thanks 

 

0 Kudos
Reply
5,782 Views
Nhi_Nguyen
NXP Employee
NXP Employee

Hi Rak14,

Could you please send me value of registers ENET after any frame was sent to Chip?

Best regards,

Nhi

 

 

0 Kudos
Reply
5,763 Views
rak14
Contributor III

Hi,

Please find the attachment of the ENET Registers value when it's working.

0 Kudos
Reply
5,620 Views
Nhi_Nguyen
NXP Employee
NXP Employee

Hi Rak14,

I saw this from registers that you sent me:

<register path="ENET/IEEE_R_CRC" value="0x00000002"/>

Form my view of low level driver, this usually come from RX_CLK is incorrect or not stable. But, because you received some frames, so my thought is second point, Rx_Clk is not stable. So, please sure that RX_CLK is stable and is 25 MHz. I'll ask upper layer if they have any experience about this.

Best regards,

Nhi

 

Tags (1)
0 Kudos
Reply
5,496 Views
Nhi_Nguyen
NXP Employee
NXP Employee

Hi rak14,

This is feedback from Stack team:

"

I’m not sure about this. It could be the clock or something else that might be fixed in the meantime. That is a very old version of TCPIP.

As Liviu said, I would suggest to customer to install these packages and see if the issue still happens. On these packages we could not see the issue anymore. They are working on S32DS 3.4.

  • S32K1 RTD RTM 1.0.1
  • S32K1 FreeRTOS 1.0.1
  • S32K1 TCPIP 1.0.1

Also, we plan a new release for S32K1 on September and if you like, we can see if that issue still occurs or not.

"

Best regards,

Nhi

 

 

0 Kudos
Reply
5,207 Views
rak14
Contributor III

Hi @Nhi_Nguyen ,

I've installed the following:

  • S32 DS V3.4.1
  • TCPIP_STACK for S32K1 version 1.0.1
  • S32K1 RTD AUTOSAR 4.4 Version 1.0.1 HotFix 01
  • FreeRTOS for S32K1 1.0.1
  • S32SDK S32K1XX RTM 4.0.2

Can I get the example code where TCP/IP (1.0.1), FreeRTOS(1.0.1) and Ethernet driver are combined?

Or the example code which doesn't get hang which was tested by NXP SW team it would be helpful.

Thanks & regards,

Rak

0 Kudos
Reply
5,193 Views
Nhi_Nguyen
NXP Employee
NXP Employee

Hi @rak14 ,

SW team said that they have an example but it need to import into Design Studio. Can you import to this tool?

Best regards,

Nhi

 

0 Kudos
Reply
5,191 Views
rak14
Contributor III

Yes I can import as the IDE is S32 Design studio for S32 platform v3.4.1.

0 Kudos
Reply
5,173 Views
Nhi_Nguyen
NXP Employee
NXP Employee

Hi @rak14 ,

SW team said that the example was available in the package.

" You can import the example from

File -> New -> S32DS Project from example. There is lwip_s32k148 example provided by TCP/IP update site, that can be imported and tested further.

"

Best regards,

Nhi

 

0 Kudos
Reply
5,133 Views
rak14
Contributor III

Hi @Nhi_Nguyen ,

In S32K1xx SDK RTM v4.0.2 example projects -> lwip_s32k148 example was there but TCP/IP and FreeRTOS vrsion was 1.0.0. I tested this one it was hanging.

That's why if you can provide the example code which is working it would be helpful.

Thanks

Rak

0 Kudos
Reply
5,108 Views
Nhi_Nguyen
NXP Employee
NXP Employee

Hi @rak14 ,

This is response from SW team:

"

You don’t need to use S32SDK S32K1XX RTM 4.0.2 package anymore because from now on we use only these 3 packages:

  • TCPIP_STACK for S32K1 version 1.0.1
  • S32K1 RTD AUTOSAR 4.4 Version 1.0.1 HotFix 01
  • FreeRTOS for S32K1 1.0.1

Make sure you import the lwip_s32k148 from TCP/IP 1.0.1, not from S32SDK S32K1XX RTM 4.0.2.

Nhi_Nguyen_0-1696491290741.png

"

Best regards,

Nhi

0 Kudos
Reply
5,105 Views
rak14
Contributor III

Hi,

I tried with that but I couldn't build it properly that's why I asked the integrated example code, it will helpful if the tested code was provided.

Thanks in advance 

0 Kudos
Reply
5,102 Views
Nhi_Nguyen
NXP Employee
NXP Employee

Hi @rak14 ,

Because example is always verified before the package was public. So, what error did you encounter with this example? Could you please capture it?

Best regards,

Nhi

0 Kudos
Reply
5,089 Views
rak14
Contributor III

Hi @Nhi_Nguyen,

In the lwip_s32k148 example only this much is there no stack code or nothing present I tried to generate using code generator but after that also no code were present it's showing: 

Issue: Code generation failed
Level: Error
Type: Tool problem
Tool: Peripherals
Origin: Peripherals
Resource: Sources
Information: Code generation failed

 

rak14_0-1696509052276.png

Thanks 

Rak

 

0 Kudos
Reply
4,855 Views
Nhi_Nguyen
NXP Employee
NXP Employee

Hi @rak14 ,

I tried to install 3 packages include:

Nhi_Nguyen_0-1696563553419.png

You can check packages updated by:

Nhi_Nguyen_1-1696563658767.png

I can generate the example without error:

Nhi_Nguyen_2-1696563688852.png

I attached release note that you can refer to see how to install packages.

Best regards,

Nhi

 

0 Kudos
Reply
4,812 Views
rak14
Contributor III

Hi @Nhi_Nguyen , When I open the peripheral configurator for freeRTOS/ TCP/IP example I'm getting the following error. How can I resolve the same?

MicrosoftTeams-image (14).png

MicrosoftTeams-image (15).png

 

Thanks

Rak

  

 

0 Kudos
Reply
4,770 Views
Nhi_Nguyen
NXP Employee
NXP Employee

Hi @rak14 ,

Maybe this came from your tool version. But from my point of view, there was no error that was in Problem view showed, so, no problem. In my site, I got same issue, but I was still generate code normally. Just ensure that you installed all packages that required.

Best regards,

Nhi

0 Kudos
Reply