BF537 - Switch between DHCP and static IP

Hello,

I use the processor BF537 with the development environment VisualDSP++. Can I switch between DHCP and static IP during runtime?

Best regards,

SONSDM

Parents
  • +1
    •  Analog Employees 
    on Oct 16, 2020 12:19 PM 1 month ago

    Hi,

    By default you will not be able to change the configuration from DHCP to static IP on the fly, but we believe it would be possible to revert to a static IP upon DHCP failure. You may be able to configure by changing sources according to your requirements. In the lwip_sysboot_threadtype.c, "start_stack()" launches the dhcp client and gets the DHCP address if user chooses to use DHCP(default behavior). The obtained address is placed in a structure called netinfo.netif[].

    If the user chooses to configure IP manually, user chosen IP/Gateway addresses will be copied into netinfo.netif[] structure (see the "init_stack()" function).

    In VisualDSP sethostaddr() call is provided to set the IP address. This call takes the network interface number and the IP address string. Default network interface number is 0. So you can use sethostipaddr(0,"192.168.1.1") to set target IP address. Alternatively, you can directly access the netinfo.netif[] structure to set the IP Address.

    Most of the code pertaining to IP configuration is present in "...\Blackfin\lib\src\lwip\contrib\ports\ADSP-Blackfin\proj\arch-VDK\pkthandler.c", which may also need modification. We provide projects for rebuilding the Libraries in "...\Blackfin\lib\src\lwip\contrib\ports\ADSP-Blackfin\proj\lwIPv4lib\".

    Regards,
    Nishanthi.V

Reply
  • +1
    •  Analog Employees 
    on Oct 16, 2020 12:19 PM 1 month ago

    Hi,

    By default you will not be able to change the configuration from DHCP to static IP on the fly, but we believe it would be possible to revert to a static IP upon DHCP failure. You may be able to configure by changing sources according to your requirements. In the lwip_sysboot_threadtype.c, "start_stack()" launches the dhcp client and gets the DHCP address if user chooses to use DHCP(default behavior). The obtained address is placed in a structure called netinfo.netif[].

    If the user chooses to configure IP manually, user chosen IP/Gateway addresses will be copied into netinfo.netif[] structure (see the "init_stack()" function).

    In VisualDSP sethostaddr() call is provided to set the IP address. This call takes the network interface number and the IP address string. Default network interface number is 0. So you can use sethostipaddr(0,"192.168.1.1") to set target IP address. Alternatively, you can directly access the netinfo.netif[] structure to set the IP Address.

    Most of the code pertaining to IP configuration is present in "...\Blackfin\lib\src\lwip\contrib\ports\ADSP-Blackfin\proj\arch-VDK\pkthandler.c", which may also need modification. We provide projects for rebuilding the Libraries in "...\Blackfin\lib\src\lwip\contrib\ports\ADSP-Blackfin\proj\lwIPv4lib\".

    Regards,
    Nishanthi.V

Children