SWRU368C May 2018 – January 2021 CC3100 , CC3100MOD , CC3200 , CC3200MOD
The user must enable the DHCP server and configure DHCP server parameters, DHCP addresses, and lease time.
To start the DHCP server call:
sl_NetAppStart(SL_NET_APP_DHCP_SERVER_ID);
Where SL_NET_APP_DHCP_SERVER_ID is 2.
To stop DHCP server call:
sl_NetAppStop(SL_NET_APP_DHCP_SERVER_ID);
Default value: DHCP server enabled.
To configure the DHCP parameters use the following API:
sl_NetAppSet( unsigned char AppId ,
unsigned char Option,
unsigned char OptionLen,
unsigned char *pOptionValue)
This example shows how to configure the parameters (starting IP address 9.8.7.1, ending IP address 9.8.7.5, lease time = 1000 seconds):
SlNetAppDhcpServerBasicOpt_t dhcpParams;
unsigned char outLen = sizeof(SlNetAppDhcpServerBasicOpt_t);
dhcpParams.lease_time = 1000;
dhcpParams.ipv4_addr_start = 0x09080701;
dhcpParams.ipv4_addr_last = 0x09080705;
sl_NetAppSet(SL_NET_APP_DHCP_SERVER_ID,
NETAPP_SET_DHCP_SRV_BASIC_OPT,
outLen,
(unsigned char*)&dhcpParams);
Default value:
|
|
|
|
|
|
|
|
|
The DHCP server addresses must be in the subnet of the AP IP address. The changes will take affect after reset.