S32K344 lwip tcp/ip udp send issue

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

S32K344 lwip tcp/ip udp send issue

跳至解决方案
5,684 次查看
malove
Contributor IV

Hello,

I am implementing logic to send messages using the lwIP TCP/IP stack, and I have encountered an issue.

Here is my current situation:

  1. The S32K344 MCU is connected to a PC via UDP.
  2. The MCU sends data to the PC.
  3. During data transmission, a memory-related issue occurs (mem_free: illegal memory: non-linked: double free).
    • The issue sometimes happens in TxNotification.
    • Alternatively, it occurs in the send_udp_data function that I implemented.

The attached test.c source file is based on the S32K344 TCP/IP 1.0.3 sample code, with the addition of the send_udp_data function.

Could you please review my UDP transmission code and let me know if I have implemented anything incorrectly?

 

 

标记 (3)
0 项奖励
回复
1 解答
5,609 次查看
PavelL
NXP Employee
NXP Employee

Hello @malove ,

Based on warnings, udp_sendto (and udp_receive_callback) requires type ip_addr. I use TCPIP_STACK for S32K3XX version 1.0.4 .

Best regards,

Pavel

在原帖中查看解决方案

0 项奖励
回复
4 回复数
5,622 次查看
malove
Contributor IV

Thank you always @PavelL 

I compared the codes and it seems like all ip4_addr have been changed to ip_addr.

Can I ask why?

 

0 项奖励
回复
5,610 次查看
PavelL
NXP Employee
NXP Employee

Hello @malove ,

Based on warnings, udp_sendto (and udp_receive_callback) requires type ip_addr. I use TCPIP_STACK for S32K3XX version 1.0.4 .

Best regards,

Pavel

0 项奖励
回复
5,599 次查看
malove
Contributor IV

Thank you! 

0 项奖励
回复
5,647 次查看
PavelL
NXP Employee
NXP Employee

Hello @malove ,

I fixed warnings in your code. The code works without any issue on my S32K344EVB-T172. Wireshark sees the UDP messages. The code is attached - please check it out.

Best regards,

Pavel

0 项奖励
回复