LWIP Network Interface network card initialization to STM32 as an example will be useful after 2G or 4G module in the form of PPP dial-up virtual network card, so first of all, this is the premise

Source: Internet
Author: User

LWIP Network Interface network card initialization to STM32 as an example will be useful after 2G or 4G module in the form of PPP dial-up virtual network card, so first of all, this is the premise

LWIP has a structure that describes the physical interface of the Netif Struct, the great god of Chu has a detailed explanation of this: http://blog.csdn.net/zhzht19861011/article/details/6690 534

The LWIP website also has a detailed description of the structure: http://www.nongnu.org/lwip/2_0_x/structnetif.html

The code I use is the official ST demo routine that can be downloaded here to stm32f407 + DP83848

Project Open Path: C:\Users\admin\Desktop\STM32F4x7_ETH_LwIP_V1.1.0\Project\FreeRTOS\udptcp_echo_server_netconn\MDK-ARM

See how ST defines a NIC variable and initializes the

First look at the definition of the place:

Then look at how this variable is initialized:

/*-Netif_add (struct netif *netif, struct ip_addr *ipaddr,
struct ip_addr *netmask, struct ip_addr *GW,
void *state, err_t (* init) (struct netif *netif),
err_t (* input) (struct pbuf *p, struct netif *netif))

Adds your network interface to the netif_list. Allocate a struct
Netif and pass a pointer to this structure as the first argument.
Give pointers to cleared IP_ADDR structures when using DHCP,
or fill them with sane numbers otherwise. The state pointer could be NULL.

The INIT function pointer must point to a initialization function for
Your Ethernet Netif interface. The following code illustrates it ' s use.*/
Netif_add (&xnetif, &ipaddr, &netmask, &GW, NULL, &ethernetif_init, &tcpip_input);

Used Netif_add (&xnetif, &ipaddr, &netmask, &GW, NULL, &ethernetif_init, &tcpip_input); This function initializes the NIC.

This function is a function provided by LWIP, let's take a look at the official explanation: HTTP://WWW.NONGNU.ORG/LWIP/2_0_X/GROUP__NETIF.HTML#GADE5498543E74067F28CC6BEF02 09e3be

First step: We need to define a variable of netif Struct type first

LWIP Network Interface network card initialization to STM32 as an example will be useful after 2G or 4G module in the form of PPP dial-up virtual network card, so first of all, this is the premise

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.