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.

[参考译文] RM48L952:RM48L952

Guru**** 2482105 points
Other Parts Discussed in Thread: DP83640

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/704749/rm48l952-rm48l952

器件型号:RM48L952
主题中讨论的其他器件:DP83640

您好!

 

我有 Lwip 驱动程序、如何将其用于 TCP/IP?

 您能不能与我分享 TCP/IP 的演示应用程序代码。

 

此致、

伊曼纽尔

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    伊曼纽尔、您好、

    以下是下载用于 Hercules MCU 的 LWIP 演示项目的链接:

    processors.wiki.ti.com/.../HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、 Wang、

    感谢您的回复。

    我已经下载了它。 但 在该驱动程序代码中需要使用 TCP/IP 的演示代码。

    此致、

    伊曼纽尔

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    伊曼纽尔、您好、

    LWIP 是 TCP/IP 堆栈。 此演示是 HTTP 服务器(以太网应用)。
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好、Wang、

    我不想在应用程序中使用 http 服务器、如何将其用于 TCP/IP 或 UDP。

    此致、
    伊曼纽尔
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    伊曼纽尔、您好、

    我们没有这种示例、例如 TCP 回显服务器演示。
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Wang、

    我们没有任何线索。请提供您使用此 lwip 驱动程序实现 UDP 通信的建议。

    此致、
    伊曼纽尔

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    伊曼纽尔、您好、

    我发布了一个使用 LWIP UDP 的简单示例。
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好、Wang。

    无论给定的 UDP 代码是多少、都会显示许多错误、NETCONUDP 宏将被禁用。 如果我启用它、它会在驱动程序函数中显示大量错误。

    您能否发送 UDP 工作示例?

    此致、
    伊曼纽尔
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    伊曼纽尔、您好!

    我没有一个有效的 UDP 示例。 您需要包含以下头文件:
    #include "lwip/udp.h"
    #include "lwip/ip_addr.h"
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Wang、

    函数  

    EMAC_LwIP_Main (emacAddress);;正在进行许多服务器配置。

    我们已经包括了您提到的标题。

    int main()

    struct pbuf *Tx;
    uint16_t length=0;
    char msg[5]、error、PCB;

    _enable_IRQ ();
    EMAC_LwIP_Main (emacAddress);
    IP4_ADDR (&src、162、192、37、29);
    IP4_ADDR (&dst、162、192、37、28);
    IP4_ADDR (&SNET、255、255、0);
    IP4_ADDR (_nnet、0、0、0、0);
    pc=udp_new();

    error=udp_bind (PCB、&src、6031);
    error=udp_connect (PCB、&D、49668);
    长度= 5;
    tx=pbuf_alloc (PBUF_transport、length、PBUF_RAM);
    Tx->NEX=0;
    tx->len=tx->t_tlen=length;
    memcpy (Tx->PAYLOAD, msg, Tx->len);
    udp_sendto (PCB、Tx、&dst、49668);
    pbuf_free (Tx);

    void EMAC_LwIP_Main (uint8_t * macAddress)

    unsigned int ipaddr;
    uint8_t testChar;
    struct in_addr devIPAddress;

    //iommUnlock();
    //iommMuxEnableMdio();
    //iommMuxEnableMii ();
    //iommLock();
    sciInit();

    /*启用 CPSR 寄存器中的中断生成*/
    IntMasterIRQEnable();
    _enable_FIQ ();

    sciDisplayText (scilinREG、txtCRLF、sizeof (txtCRLF));
    sciDisplayText (scilinREG、txtTitle、sizeof (txtTitle));
    sciDisplayText (scilinREG、txtCRLF、sizeof (txtCRLF));
    sciDisplayText (scilinREG、txtTI、sizeof (txtTI));
    sciDisplayText (scilinREG、txtCRLF、sizeof (txtCRLF));
    #ifdef __little_endian__
    sciDisplayText (scilinREG、txtLittleEndian、sizeof (txtLittleEndian));
    sciDisplayText (scilinREG、txtCRLF、sizeof (txtCRLF));
    其他
    sciDisplayText (scilinREG、txtBigEndian、sizeof (txtBigEndian));
    sciDisplayText (scilinREG、txtCRLF、sizeof (txtCRLF));
    #endif

    /*使用 DHCP 初始化 lwIP 库。*/
    sciDisplayText (scilinREG、txtEnetInit、sizeof (txtEnetInit));
    ipaddr = lwIPInit (0、macAddress、0xA2C0251C、0xFFFFFF0000、0、IPADDR_USE_STATIC);
    sciDisplayText (scilinREG、(uint8_t*)"..done"、sizeof ("..done");
    sciDisplayText (scilinREG、txtCRLF、sizeof (txtCRLF));

    如果(0 = ipaddr){

    sciDisplayText (scilinREG、txtCRLF、sizeof (txtCRLF));
    sciDisplayText (scilinREG、txtCRLF、sizeof (txtCRLF));
    sciDisplayText (scilinREG、txtErrorInit、sizeof (txtErrorInit));
    sciDisplayText (scilinREG、txtCRLF、sizeof (txtCRLF));
    sciDisplayText (scilinREG、txtCRLF、sizeof (txtCRLF));
    }否则{
    /*将 IP 地址转换为字符串*/
    devIPAddress.s_addr = ipaddr;
    TxtIPAddrItoA =(uint8_t *) inet_ntoA (devIPAddress);
    LocatorConfig (macAddress、"HDK enet_lwip");

    /*初始化示例 httpd 服务器。 *
    sciDisplayText(scilinREG,(uint8_t*)“正在启动 Web 服务器”,sizeof ("Starting Web Server");
    httpd_init();
    sciDisplayText (scilinREG、(uint8_t*)"..done"、sizeof ("..done");
    sciDisplayText (scilinREG、txtCRLF、sizeof (txtCRLF));

    /*永久循环。 所有工作都在中断处理程序中完成。 *
    //while (1)

    sciDisplayText (scilinREG、txtCRLF、sizeof (txtCRLF));

    sciDisplayText (scilinREG、txtTitle、sizeof (txtTitle));
    sciDisplayText (scilinREG、txtCRLF、sizeof (txtCRLF));

    sciDisplayText (scilinREG、txtTI、sizeof (txtTI));
    sciDisplayText (scilinREG、txtCRLF、sizeof (txtCRLF));
    #ifdef __little_endian__
    sciDisplayText (scilinREG、txtLittleEndian、sizeof (txtLittleEndian));
    sciDisplayText (scilinREG、txtCRLF、sizeof (txtCRLF));
    其他
    sciDisplayText (scilinREG、txtBigEndian、sizeof (txtBigEndian));
    sciDisplayText (scilinREG、txtCRLF、sizeof (txtCRLF));
    #endif
    sciDisplayText (scilinREG、txtIPAddrTxt、sizeof (txtIPAddrTxt));
    sciDisplayText (scilinREG、txtIPAddrItoA、16);
    sciDisplayText (scilinREG、txtCRLF、sizeof (txtCRLF));

    sciDisplayText (scilinREG、txtNote1、sizeof (txtNote1));
    sciDisplayText (scilinREG、txtIPAddrItoA、16);
    sciDisplayText (scilinREG、txtCRLF、sizeof (txtCRLF));


    /*在打印下一组之前,请等待终端上的字符*/
    // sciReceive (scilinREG、1、testChar);


    UDP 不起作用。 DP83640正在生成与 src 和 dst IP 地址相同的 ARP。

    我们对这一问题没有任何了解,请提出您的建议。

    此致、

    伊曼纽尔

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

    您好!  

    我的注释为蓝色:

    int main()

    extern unsigned int len、tot_len;

    struct udp_pcb *pcb;

    struct ip_addr ipaddr、netmask、gw、src、dst;

    struct pbuf *Tx;
    uint16_t length=0;
    char msg[5]、error、PCB;

    _enable_IRQ ();
    EMAC_LwIP_Main (emacAddress);

    // IP 地址应为电路板的 IP 地址
    IP4_ADDR (&src、162、192、37、29);
    IP4_ADDR (&dst、162、192、37、28);
    IP4_ADDR (&SNET、255、255、0);
    IP4_ADDR (_nnet、0、0、0、0);

    //这适用于 gatway

    IP4_ADDR (&GW、192、168、  0、1);


    pc=udp_new();

    //这些数字是否对您有效?

    error=udp_bind (PCB、&src、6031);
    error=udp_connect (PCB、&D、49668);  //不是 UDP 的有效数字
    长度= 5;
    tx=pbuf_alloc (PBUF_transport、length、PBUF_RAM);
    Tx->NEX=0;
    tx->len=tx->t_tlen=length;
    memcpy (Tx->PAYLOAD, msg, Tx->len);
    udp_sendto (PCB、Tx、&dst、49668); //不是 UDP 的有效数字
    pbuf_free (Tx);

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


    int main()

    extern unsigned int len、tot_len;
    struct udp_pcb *pcb;
    struct ip_addr ipaddr、netmask、gw、src、dst;
    struct pbuf *Tx;
    uint16_t length=0;
    char msg[5]、error、PCB;
    _enable_IRQ ();

    EMAC_LwIP_Main (emacAddress);//此函数执行多种配置时、必须在内部执行所有操作


    //IP 地址应该是主板的 IP 地址--源和目的都应该是主板??
    IP4_ADDR (&src、162、192、37、29);
    IP4_ADDR (&dst、162、192、37、28);
    IP4_ADDR (&SNET、255、255、0);
    IP4_ADDR (_nnet、0、0、0、0);
    //这适用于 gatway
    IP4_ADDR (&GW、192、168、0、1); // PC IP??

    pc=udp_new();

    //这些数字是否对您有效?-这是 PC 生成的数字
    error=udp_bind (PCB、&src、6031);
    error=udp_connect (PCB、&D、49668);//不是 UDP 的有效数字
    长度= 5;
    tx=pbuf_alloc (PBUF_transport、length、PBUF_RAM);
    Tx->NEX=0;
    tx->len=tx->t_tlen=length;
    memcpy (Tx->PAYLOAD, msg, Tx->len);
    udp_sendto (PCB、Tx、&dst、49668);//不是 UDP 的有效数字
    pbuf_free (Tx);
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    我认为49668超出 UDP 端口号的范围。 最大值为49151。

    en.wikipedia.org/.../List_of_TCP_and_UDP_port_numbers
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好、Wang、

    EMAC_LwIP_Main (emacAddress);//此函数执行多种配置。必须在内部执行所有配置

    源和目的都应该是板的???
    IP4_ADDR (&src、162、192、37、29);
    IP4_ADDR (&dst、162、192、37、28);
    IP4_ADDR (&SNET、255、255、0);
    IP4_ADDR (_nnet、0、0、0、0);
    //这适用于 gatway
    IP4_ADDR (&GW、192、168、0、1); //这应该是 PC IP???

    请提供您的建议。

    此致、
    伊曼纽尔
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好!

    下面是一些 UDP 示例的链接。
    www.ultimaserial.com/avr_lwip_udp.html