[STM32F4] 哪位用过lwip,这样初始化对么

[复制链接]
 楼主| littlelida 发表于 2021-6-17 14:15 | 显示全部楼层 |阅读模式
void BSP_LWIP_Init(void)
{
        /* Initilialize the LwIP stack with RTOS */
        tcpip_init( NULL, NULL );

        /* IP addresses initialization with DHCP (IPv4) */
        ipaddr.addr  = 0;
        netmask.addr = 0;
        gw.addr      = 0;

        /* add the network interface (IPv4/IPv6) with RTOS */
        netif_add(&gnetif, &ipaddr, &netmask, &gw, NULL, &ethernetif_init, &tcpip_input);

        /* Registers the default network interface */
        netif_set_default(&gnetif);

        if (netif_is_link_up(&gnetif))
        {
                /* When the netif is fully configured this function must be called */
                netif_set_up(&gnetif);
        }
        else
        {
                /* When the netif link is down this function must be called */
                netif_set_down(&gnetif);
        }  

        /* Start DHCP negotiation for a network interface (IPv4) */
        dhcp_start(&gnetif);

}
地下縱情搖擺 发表于 2022-12-21 07:56 | 显示全部楼层
应该没啥问题吧

林间有新绿 发表于 2022-12-21 08:28 | 显示全部楼层
没用lwip,一般都是用的网络模块直接驱动的

风吻过你的不羁 发表于 2022-12-21 09:00 | 显示全部楼层
你可以用HAL,也就是用codemx配置一下

一枝香 发表于 2022-12-21 09:32 | 显示全部楼层
你参考一下正点原子的demo吧,这样能好点

岁月反驳 发表于 2022-12-21 10:04 | 显示全部楼层
我觉得应该没啥问题吧,我估计的

漫过岁月 发表于 2022-12-21 10:36 | 显示全部楼层
Lwip还没玩耍过,这个有啥优势么

漫过岁月 发表于 2022-12-21 11:08 | 显示全部楼层
Lwip还没玩耍过,这个有啥优势么

晚晚皆安 发表于 2022-12-21 11:40 | 显示全部楼层
建议楼主还是使用类似于W5500这种吧,能好点

极客晨星 发表于 2022-12-21 12:12 | 显示全部楼层
你这初始化代码那里搞得

討厭和人归類 发表于 2022-12-21 12:44 | 显示全部楼层
一般都是有标准的初始化流程的,你找个参考例程,参考一下就好了

銀河 发表于 2022-12-21 13:16 | 显示全部楼层
应该是OK的,你可以仿真再跟踪一下

您需要登录后才可以回帖 登录 | 注册

本版积分规则

139

主题

955

帖子

2

粉丝
快速回复 在线客服 返回列表 返回顶部