Jun 19, 2019
02:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 19, 2019
02:56 AM
Hi,
Currently the IP Address of the ethernet interface is hardcoded in the lwip header files.
Is it possible to circumvent this during Dave_init() so that the IP address can be read from Flash or a register or SD Card?
Thank you in advance
Kuros
Currently the IP Address of the ethernet interface is hardcoded in the lwip header files.
Is it possible to circumvent this during Dave_init() so that the IP address can be read from Flash or a register or SD Card?
Thank you in advance
Kuros
- Tags:
- IFX
2 Replies
Jun 27, 2019
01:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 27, 2019
01:50 AM
Hi,
You could use the netif status callback.
In the callback you could before starting your network applications, do the following
Regards,
Jesus
You could use the netif status callback.
In the callback you could before starting your network applications, do the following
#if LWIP_NETIF_STATUS_CALLBACK == 1
/* The status callback will be called anytime the interface is brought up and down.
For example, if you would like to log the IP address chosen by DHCP when it has got one,
and know when this address changes, then you can use the status callback hook.
The function being called is netif_status_callback */
void netif_status_cb(struct netif *netif)
{
#if LWIP_DHCP
if (dhcp_supplied_address(netif) > 0)
{
/* Initialize echo server */
shell_init();
}
#else
if (netif_is_up(netif))
{
#define IP_ADDR0_0 (192U)
#define IP_ADDR1_0 (168U)
#define IP_ADDR2_0 (0U)
#define IP_ADDR3_0 (11U)
/*IPv4 subnet mask*/
/*Static IPv4 address*/
#define NETMASK_ADDR0_0 (255U)
#define NETMASK_ADDR1_0 (255U)
#define NETMASK_ADDR2_0 (255U)
#define NETMASK_ADDR3_0 (0U)
/*IPv4 gateway address*/
/*Static IPv4 address*/
#define GW_ADDR0_0 (192U)
#define GW_ADDR1_0 (168U)
#define GW_ADDR2_0 (0U)
#define GW_ADDR3_0 (10U)
ip_addr_t ipaddr;
ip_addr_t netmask;
ip_addr_t gw;
IP4_ADDR(&ipaddr, IP_ADDR0_0, IP_ADDR1_0, IP_ADDR2_0, IP_ADDR3_0);
IP4_ADDR(&netmask, NETMASK_ADDR0_0, NETMASK_ADDR1_0 , NETMASK_ADDR2_0, NETMASK_ADDR3_0);
IP4_ADDR(&gw, GW_ADDR0_0, GW_ADDR1_0, GW_ADDR2_0, GW_ADDR3_0);
netif_set_addr(ETH_LWIP_0.xnetif, &ipaddr, &netmask, &gw);
/* Initialize echo server */
shell_init();
}
#endif
}
#endif
Regards,
Jesus
Jul 22, 2019
01:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 22, 2019
01:23 AM
Thank you... I came around to trying this, but unfortunately it did not work as the Filesystem object is not initializable at this time.... The SD card is not accessible at this point of the initialization