This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] TM4C1294NCPDT:Tiva UDP 发送示例

Guru**** 2030840 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/921680/tm4c1294ncpdt-tiva-udp-send-example

器件型号:TM4C1294NCPDT

我正在尝试将一个 UDP 封包从 Tiva 板发送回 PC。 我使用的是 UDP 回波示例、我可以这么做。 但我希望能够从主函数而非 UDP 接收函数发送数据包。 但是、当我这么做时、UDP_sendto 函数会崩溃。 下面是代码。 addr 和端口变量是我从接收函数中保存的值。 有人知道问题是什么? 谢谢

void eth_udp_tx ()
{
struct pbuf *p;
uint8_t buf[16];
ERR_t wr_err = ERR_OK;

P = pbuf_alloc (PBUF_transport、16、PBUF_pool);
p->len = 16;
p->to_len = 16;
p->payload = buf;

如果(p)
{
WR_ERR = UDP_sendto (new_UDP_PCB、p、UDP_addr、UDP_port);
pbuf_free (p);
}
}